public void applyTo(final Transform transform) { transform.setIdentity(); transform.setRotation(getRotation()); transform.setScale(getScale()); transform.setTranslation(getTranslation()); }
public void applyTo(final Transform transform) { transform.setIdentity(); transform.setRotation(getRotation()); transform.setScale(getScale()); transform.setTranslation(getTranslation()); }
/** * Copies the given transform values into this transform object. * * @param source * @return this transform for chaining. * @throws NullPointerException * if source is null. */ public Transform set(final ReadOnlyTransform source) { if (source.isIdentity()) { setIdentity(); } else { _matrix.set(source.getMatrix()); _scale.set(source.getScale()); _translation.set(source.getTranslation()); _identity = false; _rotationMatrix = source.isRotationMatrix(); _uniformScale = source.isUniformScale(); } return this; }
/** * Copies the given transform values into this transform object. * * @param source * @return this transform for chaining. * @throws NullPointerException * if source is null. */ public Transform set(final ReadOnlyTransform source) { if (source.isIdentity()) { setIdentity(); } else { _matrix.set(source.getMatrix()); _scale.set(source.getScale()); _translation.set(source.getTranslation()); _identity = false; _rotationMatrix = source.isRotationMatrix(); _uniformScale = source.isUniformScale(); } return this; }
result.setIdentity(); return result;
result.setIdentity(); return result;
@Test public void testInvert() { final Transform trans1 = new Transform(); trans1.setRotation(new Matrix3().applyRotationZ(3 * MathUtils.QUARTER_PI)); final Transform trans2 = trans1.invert(null); assertEquals(Transform.IDENTITY, trans1.multiply(trans2, null)); trans1.setIdentity().invert(trans1); assertEquals(Transform.IDENTITY, trans1); }
assertEquals(trans2, trans); trans.setIdentity(); assertEquals(Transform.IDENTITY, trans); assertEquals(new Vector3(-10, 50, -30), trans.getTranslation()); trans.setIdentity(); trans.setRotation(new Matrix3().fromAngleAxis(a, Vector3.UNIT_Y)); trans.setScale(2, 3, 4); 0, 0, 0, 1), mat4); trans.setIdentity(); trans.setRotation(new Matrix3(0, 1, 2, 3, 4, 5, 6, 7, 8)); trans.setTranslation(10, 11, 12);
trans.setIdentity(); trans.applyForward(vec3); assertEquals(orig, vec3);
t.setIdentity(); t.setTranslation(getWorldTranslation()); t.setScale(getScale());
t.setIdentity(); t.setTranslation(getWorldTranslation()); t.setScale(getScale());
final Transform trans = new Transform(); assertTrue(Transform.isValid(trans)); trans.setIdentity(); trans.setRotation(new Matrix3(Double.NaN, 0, 0, 0, 0, 0, 0, 0, 0)); assertFalse(Transform.isValid(trans)); trans.setIdentity(); trans.setScale(Double.NaN, 0, 0); assertFalse(Transform.isValid(trans)); trans.setScale(Double.NaN); assertFalse(Transform.isValid(trans)); trans.setIdentity(); trans.setTranslation(Double.NaN, 0, 0); assertFalse(Transform.isValid(trans)); trans.setIdentity(); assertTrue(Transform.isValid(trans));