/** * Constructs a new, mutable matrix using the values from the given matrix * * @param source */ public Matrix3(final ReadOnlyMatrix3 source) { set(source); }
/** * Same as set(IDENTITY) * * @return this matrix for chaining */ public Matrix3 setIdentity() { return set(Matrix3.IDENTITY); }
/** * Constructs a new, mutable matrix using the values from the given matrix * * @param source */ public Matrix3(final ReadOnlyMatrix3 source) { set(source); }
/** * Same as set(IDENTITY) * * @return this matrix for chaining */ public Matrix3 setIdentity() { return set(Matrix3.IDENTITY); }
public void setRotMatrix(final ReadOnlyMatrix3 rotMatrix) { _rotMatrix.set(rotMatrix); }
public void setRotMatrix(final ReadOnlyMatrix3 rotMatrix) { _rotMatrix.set(rotMatrix); }
/** * Sets the matrix portion of this transform to the rotational value of the given Quaternion. Calling this allows * scale to be set and used. * * @param rotation * @return this transform for chaining. * @throws NullPointerException * if rotation is null. */ public Transform setRotation(final ReadOnlyQuaternion rotation) { _matrix.set(rotation); updateFlags(true); return this; }
/** * Sets the matrix portion of this transform to the rotational value of the given Quaternion. Calling this allows * scale to be set and used. * * @param rotation * @return this transform for chaining. * @throws NullPointerException * if rotation is null. */ public Transform setRotation(final ReadOnlyQuaternion rotation) { _matrix.set(rotation); updateFlags(true); return this; }
/** * Resets this transform to identity and resets all flags. * * @return this Transform for chaining. */ public Transform setIdentity() { _matrix.set(Matrix3.IDENTITY); _scale.set(Vector3.ONE); _translation.set(Vector3.ZERO); _identity = true; _rotationMatrix = true; _uniformScale = true; return this; }
/** * Resets this transform to identity and resets all flags. * * @return this Transform for chaining. */ public Transform setIdentity() { _matrix.set(Matrix3.IDENTITY); _scale.set(Vector3.ONE); _translation.set(Vector3.ZERO); _identity = true; _rotationMatrix = true; _uniformScale = true; return this; }
private void rotateNone() { if(_localRot != null) { _orient.set(getRotation()); _orient.multiplyLocal(_localRot); _worldTransform.setRotation(_orient); } }
@Test public void testSetRotation() { final Matrix3 mat3A = new Matrix3(); // rotate identity 90 degrees around Y final double a = MathUtils.HALF_PI; final Quaternion quaternion = new Quaternion(); quaternion.fromAngleAxis(a, Vector3.UNIT_Y); mat3A.set(quaternion); assertEquals(new Matrix3( // Math.cos(a), 0, Math.sin(a), // 0, 1, 0, // -Math.sin(a), 0, Math.cos(a)), mat3A); }
/** * Constructs a new Transform object from the information stored in the given source Transform. * * @param source * @throws NullPointerException * if source is null. */ public Transform(final ReadOnlyTransform source) { _matrix.set(source.getMatrix()); _scale.set(source.getScale()); _translation.set(source.getTranslation()); _identity = source.isIdentity(); _rotationMatrix = source.isRotationMatrix(); _uniformScale = source.isUniformScale(); }
/** * Constructs a new Transform object from the information stored in the given source Transform. * * @param source * @throws NullPointerException * if source is null. */ public Transform(final ReadOnlyTransform source) { _matrix.set(source.getMatrix()); _scale.set(source.getScale()); _translation.set(source.getTranslation()); _identity = source.isIdentity(); _rotationMatrix = source.isRotationMatrix(); _uniformScale = source.isUniformScale(); }
@Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); _orient.set((Matrix3) capsule.readSavable("orient", new Matrix3(Matrix3.IDENTITY))); _look.set((Vector3) capsule.readSavable("look", new Vector3(Vector3.ZERO))); _left.set((Vector3) capsule.readSavable("left", new Vector3(Vector3.ZERO))); _alignment = capsule.readEnum("alignment", BillboardAlignment.class, BillboardAlignment.ScreenAligned); } }
@Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); _orient.set((Matrix3) capsule.readSavable("orient", new Matrix3(Matrix3.IDENTITY))); _look.set((Vector3) capsule.readSavable("look", new Vector3(Vector3.ZERO))); _left.set((Vector3) capsule.readSavable("left", new Vector3(Vector3.ZERO))); _alignment = capsule.readEnum("alignment", BillboardAlignment.class, BillboardAlignment.ScreenAligned); _updateBounds = capsule.readBoolean("updateBounds", true); } }
@Override public void read(final InputCapsule capsule) throws IOException { _matrix.set((Matrix3) capsule.readSavable("rotation", new Matrix3(Matrix3.IDENTITY))); _scale.set((Vector3) capsule.readSavable("scale", new Vector3(Vector3.ONE))); _translation.set((Vector3) capsule.readSavable("translation", new Vector3(Vector3.ZERO))); _identity = capsule.readBoolean("identity", true); _rotationMatrix = capsule.readBoolean("rotationMatrix", true); _uniformScale = capsule.readBoolean("uniformScale", true); }
@Override public void read(final InputCapsule capsule) throws IOException { _matrix.set((Matrix3) capsule.readSavable("rotation", new Matrix3(Matrix3.IDENTITY))); _scale.set((Vector3) capsule.readSavable("scale", new Vector3(Vector3.ONE))); _translation.set((Vector3) capsule.readSavable("translation", new Vector3(Vector3.ZERO))); _identity = capsule.readBoolean("identity", true); _rotationMatrix = capsule.readBoolean("rotationMatrix", true); _uniformScale = capsule.readBoolean("uniformScale", true); }
/** * Reads in a 4x4 matrix as a 3x3 matrix and translation. * * @param matrix * @return this matrix for chaining. * @throws NullPointerException * if matrix is null. */ public Transform fromHomogeneousMatrix(final ReadOnlyMatrix4 matrix) { _matrix.set(matrix.getM00(), matrix.getM01(), matrix.getM02(), matrix.getM10(), matrix.getM11(), matrix.getM12(), matrix.getM20(), matrix.getM21(), matrix.getM22()); _translation.set(matrix.getM03(), matrix.getM13(), matrix.getM23()); updateFlags(false); return this; }
/** * Reads in a 4x4 matrix as a 3x3 matrix and translation. * * @param matrix * @return this matrix for chaining. * @throws NullPointerException * if matrix is null. */ public Transform fromHomogeneousMatrix(final ReadOnlyMatrix4 matrix) { _matrix.set(matrix.getM00(), matrix.getM01(), matrix.getM02(), matrix.getM10(), matrix.getM11(), matrix.getM12(), matrix.getM20(), matrix.getM21(), matrix.getM22()); _translation.set(matrix.getM03(), matrix.getM13(), matrix.getM23()); updateFlags(false); return this; }