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; }
public Vector3 getPositiveEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(_extent); result.addLocal(getOrigin()); return result; }
/** * @return An instance of Vector2 that is intended for temporary use in calculations and so forth. Multiple calls to * the method should return instances of this class that are not currently in use. */ public final static Vector2 fetchTempInstance() { if (MathConstants.useMathPools) { return Vector2.VEC_POOL.fetch(); } else { return new Vector2(); } }
/** * Apply the rotation matrix to a given vector representing a particle velocity. * * @param pSpeed * the velocity vector to be modified. */ protected void rotateVectorSpeed(final Vector3 pSpeed) { final double x = pSpeed.getX(), y = pSpeed.getY(), z = pSpeed.getZ(); pSpeed.setX(-1 * ((_rotMatrix.getM00() * x) + (_rotMatrix.getM10() * y) + (_rotMatrix.getM20() * z))); pSpeed.setY((_rotMatrix.getM01() * x) + (_rotMatrix.getM11() * y) + (_rotMatrix.getM21() * z)); pSpeed.setZ(-1 * ((_rotMatrix.getM02() * x) + (_rotMatrix.getM12() * y) + (_rotMatrix.getM22() * z))); }
/** * @return An instance of Transform that is intended for temporary use in calculations and so forth. Multiple calls * to the method should return instances of this class that are not currently in use. */ public final static Transform fetchTempInstance() { if (MathConstants.useMathPools) { return Transform.TRANS_POOL.fetch(); } else { return new Transform(); } }
@Override public Transform multiply(final ReadOnlyTransform transformBy, final Transform store) { final Transform transform = super.multiply(transformBy, store); if (!Transform.isValid(transform)) { throw new InvalidTransformException("Transform is invalid"); } return transform; }
/** * @return An instance of Quaternion that is intended for temporary use in calculations and so forth. Multiple calls * to the method should return instances of this class that are not currently in use. */ public final static Quaternion fetchTempInstance() { if (MathConstants.useMathPools) { return Quaternion.QUAT_POOL.fetch(); } else { return new Quaternion(); } }
@Override public ValidatingTransform setRotation(final ReadOnlyQuaternion rotation) { super.setRotation(rotation); validate(); return this; }
/** * @return An instance of Rectangle2 that is intended for temporary use in calculations and so forth. Multiple calls * to the method should return instances of this class that are not currently in use. */ public final static Rectangle2 fetchTempInstance() { if (MathConstants.useMathPools) { return Rectangle2.RECTANGLE_POOL.fetch(); } else { return new Rectangle2(); } }
/** * @return An instance of Line3 that is intended for temporary use in calculations and so forth. Multiple calls to * the method should return instances of this class that are not currently in use. */ public final static Line3 fetchTempInstance() { if (MathConstants.useMathPools) { return LINE3_POOL.fetch(); } else { return new Line3(); } }
/** * @return An instance of Rectangle3 that is intended for temporary use in calculations and so forth. Multiple calls * to the method should return instances of this class that are not currently in use. */ public final static Rectangle3 fetchTempInstance() { if (MathConstants.useMathPools) { return Rectangle3.RECTANGLE_POOL.fetch(); } else { return new Rectangle3(); } }
/** * @return An instance of Triangle that is intended for temporary use in calculations and so forth. Multiple calls * to the method should return instances of this class that are not currently in use. */ public final static Triangle fetchTempInstance() { if (MathConstants.useMathPools) { return Triangle.TRI_POOL.fetch(); } else { return new Triangle(); } }
/** * @return the magnitude of this vector, or the distance between the origin (0, 0) and the point described by (x, * y). Basically sqrt(x^2 + y^2) */ @Override public double length() { return MathUtils.sqrt(lengthSquared()); }
/** * @return the magnitude or distance between the origin (0, 0, 0, 0) and the point described by this vector (x, y, * z, w). Effectively the square root of the value returned by {@link #lengthSquared()}. */ @Override public double length() { return MathUtils.sqrt(lengthSquared()); }
/** * @param x * @param y * @return the distance between the point described by this vector and the given x, y point. */ @Override public double distance(final double x, final double y) { return MathUtils.sqrt(distanceSquared(x, y)); }
public Vector3 getNegativeEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(-_extent); result.addLocal(getOrigin()); return result; }
/** * @return An instance of Rectangle3 that is intended for temporary use in calculations and so forth. Multiple calls * to the method should return instances of this class that are not currently in use. */ public final static Rectangle3 fetchTempInstance() { if (MathConstants.useMathPools) { return Rectangle3.RECTANGLE_POOL.fetch(); } else { return new Rectangle3(); } }
/** * @return the magnitude of this vector, or the distance between the origin (0, 0) and the point described by (x, * y). Basically sqrt(x^2 + y^2) */ @Override public double length() { return MathUtils.sqrt(lengthSquared()); }
public Vector3 getNegativeEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(-_extent); result.addLocal(getOrigin()); return result; }