/** * Sets the world translation vector. * * @param translation * the new world translation */ public void setWorldTranslation(final ReadOnlyVector3 translation) { _worldTransform.setTranslation(translation); }
/** * Sets the world translation vector. * * @param translation * the new world translation */ public void setWorldTranslation(final ReadOnlyVector3 translation) { _worldTransform.setTranslation(translation); }
/** * Sets the world translation. * * @param x * the x coordinate * @param y * the y coordinate * @param z * the z coordinate */ public void setWorldTranslation(final double x, final double y, final double z) { _worldTransform.setTranslation(x, y, z); }
/** * Sets the world translation. * * @param x * the x coordinate * @param y * the y coordinate * @param z * the z coordinate */ public void setWorldTranslation(final double x, final double y, final double z) { _worldTransform.setTranslation(x, y, z); }
@Override public ValidatingTransform setTranslation(final ReadOnlyVector3 translation) { super.setTranslation(translation); validate(); return this; }
@Override public ValidatingTransform setTranslation(final double x, final double y, final double z) { super.setTranslation(x, y, z); validate(); return this; }
/** * <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform. * * @param translation * the new translation of this spatial */ public void setTranslation(final ReadOnlyVector3 translation) { _localTransform.setTranslation(translation); markDirty(DirtyType.Transform); }
/** * <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform. * * @param translation * the new translation of this spatial */ public void setTranslation(final ReadOnlyVector3 translation) { _localTransform.setTranslation(translation); markDirty(DirtyType.Transform); }
@Override public ValidatingTransform setTranslation(final double x, final double y, final double z) { super.setTranslation(x, y, z); validate(); return this; }
@Override public ValidatingTransform setTranslation(final ReadOnlyVector3 translation) { super.setTranslation(translation); validate(); return this; }
/** * sets the translation of this spatial. This marks the spatial as DirtyType.Transform. * * @param x * the x coordinate * @param y * the y coordinate * @param z * the z coordinate */ public void setTranslation(final double x, final double y, final double z) { _localTransform.setTranslation(x, y, z); markDirty(DirtyType.Transform); }
/** * sets the translation of this spatial. This marks the spatial as DirtyType.Transform. * * @param x * the x coordinate * @param y * the y coordinate * @param z * the z coordinate */ public void setTranslation(final double x, final double y, final double z) { _localTransform.setTranslation(x, y, z); markDirty(DirtyType.Transform); }
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()); }
@Test public void testSimpleHash() { // Just a simple sanity check. final Transform trans1 = new Transform().setTranslation(1, 2, 3); final Transform trans2 = new Transform().setTranslation(1, 2, 3); final Transform trans3 = new Transform().setTranslation(1, 2, 0); assertTrue(trans1.hashCode() == trans2.hashCode()); assertTrue(trans1.hashCode() != trans3.hashCode()); }
public ReadOnlyTransform getValue() { final Transform t = new Transform(); t.setTranslation(_translationX.getDoubleValue(), _translationY.getDoubleValue(), 0); final double val = _rotation.getDoubleValue() * MathUtils.DEG_TO_RAD; final Matrix3 mat = Matrix3.fetchTempInstance().fromAngles(0, 0, val); t.setRotation(mat); Matrix3.releaseTempInstance(mat); t.setScale(_scale.getDoubleValue()); return t; }
@Override public void applyFilter(final InteractManager manager) { final SpatialState state = manager.getSpatialState(); _calcVectorA.set(state.getTransform().getTranslation()); for (final ReadOnlyPlane plane : _planes) { final double distance = plane.pseudoDistance(_calcVectorA); if (distance < 0) { // push us back to the plane. _calcVectorB.set(plane.getNormal()).multiplyLocal(-distance); _calcVectorA.addLocal(_calcVectorB); } } state.getTransform().setTranslation(_calcVectorA); }
public ReadOnlyTransform getValue() { final Transform t = new Transform(); t.setTranslation(_translation.getValue()); final Vector3 val = _rotation.getValue().multiplyLocal(MathUtils.DEG_TO_RAD); final Matrix3 mat = Matrix3.fetchTempInstance().fromAngles(val.getX(), val.getY(), val.getZ()); t.setRotation(mat); Matrix3.releaseTempInstance(mat); t.setScale(_scale.getValue()); return t; }
@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); // Now check drag status if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) { return; } // act on drag final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY()); final Vector3 loc = getNewOffset(oldMouse, current, camera, manager); final Transform transform = manager.getSpatialState().getTransform(); transform.setTranslation(loc.addLocal(transform.getTranslation())); // apply our filters, if any, now that we've made updates. applyFilters(manager); }
@Test public void testRaySphereIntersection() throws Exception { final BoundingSphere bs = new BoundingSphere(); bs.setCenter(Vector3.ZERO); bs.setRadius(1); final Ray3 ray = new Ray3(new Vector3(2, -3, 0), Vector3.UNIT_Y); assertFalse(bs.intersects(ray)); IntersectionRecord record = bs.intersectsWhere(ray); assertEquals(null, record); final Transform transform = new Transform(); transform.setTranslation(2, 0, .5); bs.transform(transform, bs); assertTrue(bs.intersects(ray)); record = bs.intersectsWhere(ray); assertEquals(2, record.getNumberOfIntersections()); } }