private static double createGridValue(final double baseValue, final double variationAmount) { double gridValue = baseValue; if (variationAmount > 0.0) { final double variation = (MathUtils.nextRandomDouble() * (variationAmount * 2.0)) - variationAmount; gridValue += variation; } return gridValue; } }
private static double createGridValue(final double baseValue, final double variationAmount) { double gridValue = baseValue; if (variationAmount > 0.0) { final double variation = (MathUtils.nextRandomDouble() * (variationAmount * 2.0)) - variationAmount; gridValue += variation; } return gridValue; } }
@Override public ResultSample doTransformMultTest(final int count, final int maxCount, final long timeOutMS) { MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); MathUtils.nextRandomDouble(); return null; }
private Matrix4d vecMatrixRandom() { final Matrix4d mat = new Matrix4d(); final Vector3d axis = new Vector3d(MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble()); axis.normalize(); mat.set(new AxisAngle4d(axis, MathUtils.nextRandomDouble())); final double x = MathUtils.nextRandomDouble(); final double y = MathUtils.nextRandomDouble(); final double z = MathUtils.nextRandomDouble(); translate(mat, x, y, z); return mat; }
private Matrix4 a3dMatrixRandom() { final Matrix4 mat = new Matrix4(); final Vector3 axis = new Vector3(MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble()); axis.normalizeLocal(); mat.applyRotation(MathUtils.nextRandomDouble(), axis.getX(), axis.getY(), axis.getZ()); mat.applyTranslationPost(MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble()); return mat; }
@Override public ResultSample doTransformMultTest(final int count, final int maxCount, final long timeOutMS) { final ReadOnlyMatrix4 m1 = new Matrix4().fromAngleAxis(MathUtils.nextRandomDouble(), new Vector3(MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble())); final ReadOnlyMatrix4 m2 = new Matrix4().fromAngleAxis(MathUtils.nextRandomDouble(), new Vector3(MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble(), MathUtils.nextRandomDouble())); final Transform a = new Transform().fromHomogeneousMatrix(m1); final Transform b = new Transform(); final Transform by = new Transform().fromHomogeneousMatrix(m2); final long start = System.currentTimeMillis(); int loopCount = 0; while (System.currentTimeMillis() - start < timeOutMS && loopCount != maxCount) { ++loopCount; for (int i = 0; i < count; ++i) { if (i % 2 == 0) { a.multiply(by, b); } else { b.multiply(by, a); } } } return populateResult(System.currentTimeMillis() - start, loopCount, a.getHomogeneousMatrix(null).toArray(null)); }
/** * * @param position * a random position lying somewhere on this line segment. */ public Vector3 random(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } final double rand = MathUtils.nextRandomDouble(); result.setX(2 * _extent * getOrigin().getX() * (1 - rand) + getDirection().getX() * _extent * (2 * rand - 1)); result.setY(2 * _extent * getOrigin().getY() * (1 - rand) + getDirection().getY() * _extent * (2 * rand - 1)); result.setZ(2 * _extent * getOrigin().getZ() * (1 - rand) + getDirection().getZ() * _extent * (2 * rand - 1)); return result; }
/** * * @param position * a random position lying somewhere on this line segment. */ public Vector3 random(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } final double rand = MathUtils.nextRandomDouble(); result.setX(2 * _extent * getOrigin().getX() * (1 - rand) + getDirection().getX() * _extent * (2 * rand - 1)); result.setY(2 * _extent * getOrigin().getY() * (1 - rand) + getDirection().getY() * _extent * (2 * rand - 1)); result.setZ(2 * _extent * getOrigin().getZ() * (1 - rand) + getDirection().getZ() * _extent * (2 * rand - 1)); return result; }
double b = MathUtils.nextRandomDouble(); double c = MathUtils.nextRandomDouble(); BufferUtils.populateFromBuffer(result, getVertexBuffer(), pntA); BufferUtils.populateFromBuffer(work, getVertexBuffer(), pntB); Vector3.lerp(result, work, MathUtils.nextRandomDouble(), result); Vector3.releaseTempInstance(work); break;
double b = MathUtils.nextRandomDouble(); double c = MathUtils.nextRandomDouble(); BufferUtils.populateFromBuffer(result, getVertexBuffer(), pntA); BufferUtils.populateFromBuffer(work, getVertexBuffer(), pntB); Vector3.lerp(result, work, MathUtils.nextRandomDouble(), result); Vector3.releaseTempInstance(work); break;