@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; }
@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; }
/** * Move our managed spatial to align with the referenced joint's position in the given pose, modified by our offset. * See class javadoc for more information. */ public void poseUpdated(final SkeletonPose pose) { // only update if we have something attached. if (_attachment != null) { final Transform t = pose.getGlobalJointTransforms()[_jointIndex]; t.multiply(_offset, _store); _attachment.setTransform(_store); } } }
/** * Move our managed spatial to align with the referenced joint's position in the given pose, modified by our offset. * See class javadoc for more information. */ public void poseUpdated(final SkeletonPose pose) { // only update if we have something attached. if (_attachment != null) { final Transform t = pose.getGlobalJointTransforms()[_jointIndex]; t.multiply(_offset, _store); _attachment.setTransform(_store); } } }
/** * Updates the worldTransform. * * @param recurse * usually false when updating the tree. Set to true when you just want to update the world transforms * for a branch without updating the full geometric state. */ public void updateWorldTransform(final boolean recurse) { if (_parent != null) { _parent._worldTransform.multiply(_localTransform, _worldTransform); } else { _worldTransform.set(_localTransform); } clearDirty(DirtyType.Transform); }
/** * Updates the worldTransform. * * @param recurse * usually false when updating the tree. Set to true when you just want to update the world transforms * for a branch without updating geometric state. */ public void updateWorldTransform(final boolean recurse) { if (_parent != null) { _parent._worldTransform.multiply(_localTransform, _worldTransform); } else { _worldTransform.set(_localTransform); } clearDirty(DirtyType.Transform); }
/** * Updates the world material. * * @param recurse * usually false when updating the tree. Set to true when you just want to update the world materials for * a branch without updating the full geometric state. */ public void updateWorldRenderMaterial(final boolean recurse) { if (_parent != null) { _parent._worldTransform.multiply(_localTransform, _worldTransform); } else { _worldTransform.set(_localTransform); } clearDirty(DirtyType.Transform); }
@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)); }
@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); }
@Test public void testMultiply() { final Transform trans1 = new Transform(); final Transform trans2 = new Transform(); assertEquals(Transform.IDENTITY, trans1.multiply(trans2, null)); trans1.setTranslation(1, 2, 3); final Transform trans3 = trans1.multiply(trans2, null); assertEquals(trans1, trans3); trans2.setTranslation(-1, -2, -3); trans1.multiply(trans2, trans3); assertEquals(Transform.IDENTITY, trans3); assertTrue(trans3.isRotationMatrix()); assertTrue(trans3.isIdentity()); assertTrue(trans3.isUniformScale()); trans2.setScale(1, 2, 1); trans1.multiply(trans2, trans3); assertEquals(new Transform().setScale(1, 2, 1), trans3); assertTrue(trans3.isRotationMatrix()); assertFalse(trans3.isIdentity()); assertFalse(trans3.isUniformScale()); trans1.setScale(1, 2, 1); trans1.multiply(trans2, trans3); assertEquals(new Transform().setRotation(new Matrix3(1, 0, 0, 0, 4, 0, 0, 0, 1)).setTranslation(0, -2, 0), trans3); assertFalse(trans3.isRotationMatrix()); assertFalse(trans3.isIdentity()); assertFalse(trans3.isUniformScale()); }
t.multiply(_localTransform, _worldTransform); Transform.releaseTempInstance(t); } else {
t.multiply(_localTransform, _worldTransform); Transform.releaseTempInstance(t); } else {