/** * Gets the world rotation matrix. * * @return the world rotation */ public ReadOnlyMatrix3 getWorldRotation() { return _worldTransform.getMatrix(); }
/** * Gets the local rotation matrix. * * @return the rotation */ public ReadOnlyMatrix3 getRotation() { return _localTransform.getMatrix(); }
/** * Gets the local rotation matrix. * * @return the rotation */ public ReadOnlyMatrix3 getRotation() { return _localTransform.getMatrix(); }
/** * Gets the world rotation matrix. * * @return the world rotation */ public ReadOnlyMatrix3 getWorldRotation() { return _worldTransform.getMatrix(); }
g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z g2d.scale(trans.getScale().getX(), trans.getScale().getY());
g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z g2d.scale(trans.getScale().getX(), trans.getScale().getY());
@Override public void drawTo(final BufferedImage image, final ReadOnlyTransform localTransform, final int clipmapLevel) { // apply the two transforms together and then use result to scale/translate and rotate image final Transform trans = new Transform(); localTransform.multiply(getTransform(), trans); // grab a copy of the graphics so we don't bleed state to next image final Graphics2D g2d = (Graphics2D) image.getGraphics().create(); // apply hints for (final RenderingHints.Key key : hints.keySet()) { g2d.setRenderingHint(key, hints.get(key)); } // set transform g2d.translate(trans.getTranslation().getX(), trans.getTranslation().getY()); g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z g2d.scale(trans.getScale().getX(), trans.getScale().getY()); // set composite if (_compositeOverride != null) { g2d.setComposite(_compositeOverride); } // draw the image g2d.drawImage(_image, 0, 0, null); } }
@Override public void drawTo(final BufferedImage image, final ReadOnlyTransform localTransform, final int clipmapLevel) { // apply the two transforms together and then use result to scale/translate and rotate image final Transform trans = new Transform(); localTransform.multiply(getTransform(), trans); // grab a copy of the graphics so we don't bleed state to next image final Graphics2D g2d = (Graphics2D) image.getGraphics().create(); // apply hints for (final RenderingHints.Key key : hints.keySet()) { g2d.setRenderingHint(key, hints.get(key)); } // set transform g2d.translate(trans.getTranslation().getX(), trans.getTranslation().getY()); g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z g2d.scale(trans.getScale().getX(), trans.getScale().getY()); // set composite if (_compositeOverride != null) { g2d.setComposite(_compositeOverride); } // draw the image g2d.drawImage(_image, 0, 0, null); } }
/** * Draw a single Joint using the given world-space joint transform. * * @param jntTransform * our joint transform * @param scene * @param renderer * the Renderer to draw with. */ private static void drawJoint(final Transform jntTransform, final Spatial scene, final Renderer renderer) { final BoundingVolume vol = scene.getWorldBound(); double size = 1.0; if (vol != null) { SkeletalDebugger.measureSphere.setCenter(vol.getCenter()); SkeletalDebugger.measureSphere.setRadius(0); SkeletalDebugger.measureSphere.mergeLocal(vol); size = SkeletalDebugger.BONE_RATIO * SkeletalDebugger.measureSphere.getRadius(); } scene.getWorldTransform().multiply(jntTransform, SkeletalDebugger.spTransform); SkeletalDebugger.spTransform.getMatrix().scale(new Vector3(size, size, size), SkeletalDebugger.spMatrix); SkeletalDebugger.spTransform.setRotation(SkeletalDebugger.spMatrix); SkeletalDebugger.joint.setWorldTransform(SkeletalDebugger.spTransform); SkeletalDebugger.joint.draw(renderer); }
/** * Draw a single Joint using the given world-space joint transform. * * @param jntTransform * our joint transform * @param scene * @param renderer * the Renderer to draw with. */ private static void drawJoint(final Transform jntTransform, final Spatial scene, final Renderer renderer) { final BoundingVolume vol = scene.getWorldBound(); double size = 1.0; if (vol != null) { SkeletalDebugger.measureSphere.setCenter(vol.getCenter()); SkeletalDebugger.measureSphere.setRadius(0); SkeletalDebugger.measureSphere.mergeLocal(vol); size = SkeletalDebugger.BONE_RATIO * SkeletalDebugger.measureSphere.getRadius(); } scene.getWorldTransform().multiply(jntTransform, SkeletalDebugger.spTransform); SkeletalDebugger.spTransform.getMatrix().scale(new Vector3(size, size, size), SkeletalDebugger.spMatrix); SkeletalDebugger.spTransform.setRotation(SkeletalDebugger.spMatrix); SkeletalDebugger.joint.setWorldTransform(SkeletalDebugger.spTransform); SkeletalDebugger.joint.draw(renderer); }
@Override public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed, final InteractManager manager) { final Camera camera = source.getCanvasRenderer().getCamera(); final MouseState current = inputStates.getCurrent().getMouseState(); final MouseState previous = inputStates.getPrevious().getMouseState(); // first process mouse over state checkMouseOver(source, current, manager); if (current.getButtonsReleasedSince(previous).contains(_dragButton)) { _rotateStore.setIdentity(); if (_interactMatrix != InteractMatrix.Local) { setRingRotations(Matrix3.IDENTITY); } } // Now check drag status if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) { return; } // act on drag if (_lastDragSpatial instanceof InteractRing) { _lastRing = (InteractRing) _lastDragSpatial; final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY()); final ReadOnlyQuaternion rot = getNewAxisRotation(_lastRing, oldMouse, current, camera, manager); final Transform transform = manager.getSpatialState().getTransform(); rot.toRotationMatrix(_calcMat3).multiply(transform.getMatrix(), _calcMat3); transform.setRotation(_calcMat3); // apply our filters, if any, now that we've made updates. applyFilters(manager); } }
assertTrue(true == immutable.isRotationMatrix()); assertTrue(true == immutable.isUniformScale()); assertEquals(new Matrix3().applyRotationX(MathUtils.QUARTER_PI), immutable.getMatrix()); assertEquals(new Vector3(0, -1, -2), immutable.getScale()); assertEquals(new Vector3(1, 2, 3), immutable.getTranslation()); Math.cos(a), 0, Math.sin(a), // 0, 1, 0, // -Math.sin(a), 0, Math.cos(a)), trans.getMatrix()); assertEquals(trans.getMatrix(), trans2.getMatrix());
final Matrix3 mat = Matrix3.fetchTempInstance().set(_worldTransform.getMatrix()).multiplyLocal(_orient); _worldTransform.setRotation(mat); Matrix3.releaseTempInstance(mat);
final Matrix3 worldMatrix = Matrix3.fetchTempInstance().set(_worldTransform.getMatrix());
final Matrix3 worldMatrix = Matrix3.fetchTempInstance().set(_worldTransform.getMatrix());