/** * @return same as multiplyLocal(-1) */ public Vector3 negateLocal() { return multiplyLocal(-1); }
/** * @return same as multiplyLocal(-1) */ public Vector3 negateLocal() { return multiplyLocal(-1); }
private void addVert(final Md2GlCommand cmd, final Md2Frame frame, final int vertIndex, final FloatBufferData verts) { final int index = cmd.vertIndices[vertIndex]; final byte[] vertData = frame.vertData; calcVert.set(vertData[index * 4 + 0] & 0xFF, vertData[index * 4 + 1] & 0xFF, vertData[index * 4 + 2] & 0xFF); calcVert.multiplyLocal(frame.scale).addLocal(frame.translate); verts.getBuffer().put(calcVert.getXf()).put(calcVert.getYf()).put(calcVert.getZf()); }
/** * Recalculates the center point of this triangle by averaging the triangle's three points. */ protected void calculateCenter() { if (_center == null) { _center = _pointA.clone(); } else { _center.set(_pointA); } _center.addLocal(_pointB).addLocal(_pointC).multiplyLocal(MathUtils.ONE_THIRD); _dirtyCenter = false; }
@Override public void resetParticleVelocity(final int i) { if (_particleType == ParticleSystem.ParticleType.GeomMesh && _useTriangleNormalEmit) { _particles[i].getVelocity().set(_particles[i].getTriangleModel().getNormal()); _particles[i].getVelocity().multiplyLocal(_emissionDirection); _particles[i].getVelocity().multiplyLocal(getInitialVelocity()); } else { super.resetParticleVelocity(i); } }
/** * Recalculates the center point of this triangle by averaging the triangle's three points. */ protected void calculateCenter() { if (_center == null) { _center = _pointA.clone(); } else { _center.set(_pointA); } _center.addLocal(_pointB).addLocal(_pointC).multiplyLocal(MathUtils.ONE_THIRD); _dirtyCenter = false; }
@Override public void resetParticleVelocity(final int i) { if (_particleType == ParticleSystem.ParticleType.GeomMesh && _useTriangleNormalEmit) { _particles[i].getVelocity().set(_particles[i].getTriangleModel().getNormal()); _particles[i].getVelocity().multiplyLocal(_emissionDirection); _particles[i].getVelocity().multiplyLocal(getInitialVelocity()); } else { super.resetParticleVelocity(i); } }
public Vector3 getPositiveEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(_extent); result.addLocal(getOrigin()); return result; }
public Vector3 getPositiveEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(_extent); result.addLocal(getOrigin()); return result; }
public Vector3 getNegativeEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(-_extent); result.addLocal(getOrigin()); return result; }
@Override public void apply(final double dt, final Particle p, final int index) { // viscous drag velocity.set(p.getVelocity()); p.getVelocity().addLocal(velocity.multiplyLocal(-dragCoefficient * dt * p.getInvMass())); }
@Override public void apply(final double dt, final Particle p, final int index) { // viscous drag velocity.set(p.getVelocity()); p.getVelocity().addLocal(velocity.multiplyLocal(-dragCoefficient * dt * p.getInvMass())); }
public Vector3 getNegativeEnd(final Vector3 store) { Vector3 result = store; if (result == null) { result = new Vector3(); } result.set(getDirection()).multiplyLocal(-_extent); result.addLocal(getOrigin()); return result; }
private boolean getWorldIntersection(final double planeHeight, final Vector3 source, final Vector3 destination, final Vector3 store, final Vector3 tmpStorage) { final Vector3 origin = store.set(source); final Vector3 direction = tmpStorage.set(destination).subtractLocal(origin); final double t = (planeHeight - origin.getY()) / (direction.getY()); direction.multiplyLocal(t); origin.addLocal(direction); return t >= 0.0 && t <= 1.0; }
private boolean getWorldIntersection(final double planeHeight, final Vector3 source, final Vector3 destination, final Vector3 store, final Vector3 tmpStorage) { final Vector3 origin = store.set(source); final Vector3 direction = tmpStorage.set(destination).subtractLocal(origin); final double t = (planeHeight - origin.getY()) / (direction.getY()); direction.multiplyLocal(t); origin.addLocal(direction); return t >= 0.0 && t <= 1.0; }
public void setValue(final ReadOnlyTransform value) { _translation.setValue(value.getTranslation()); final double[] angles = value.getMatrix().toAngles(null); _rotation.setValue(new Vector3(angles[0], angles[1], angles[2]).multiplyLocal(MathUtils.RAD_TO_DEG)); _scale.setValue(value.getScale()); }
public void stateChanged(final ChangeEvent e) { final Vector3 val = _rotationPanel.getValue().multiplyLocal(MathUtils.DEG_TO_RAD); final Matrix3 mat = Matrix3.fetchTempInstance().fromAngles(val.getX(), val.getY(), val.getZ()); getEdittedParticles().setRotation(mat); Matrix3.releaseTempInstance(mat); } });
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; }
public void updateLeftRightCameraFrames() { // update camera frame final Vector3 rightDir = Vector3.fetchTempInstance(); final Vector3 work = Vector3.fetchTempInstance(); rightDir.set(getDirection()).crossLocal(getUp()).multiplyLocal(_eyeSeparation / 2.0); _leftCamera.setFrame(getLocation().subtract(rightDir, work), getLeft(), getUp(), getDirection()); _rightCamera.setFrame(getLocation().add(rightDir, work), getLeft(), getUp(), getDirection()); Vector3.releaseTempInstance(work); Vector3.releaseTempInstance(rightDir); }
public void updateLeftRightCameraFrames() { // update camera frame final Vector3 rightDir = Vector3.fetchTempInstance(); final Vector3 work = Vector3.fetchTempInstance(); rightDir.set(getDirection()).crossLocal(getUp()).multiplyLocal(_eyeSeparation / 2.0); _leftCamera.setFrame(getLocation().subtract(rightDir, work), getLeft(), getUp(), getDirection()); _rightCamera.setFrame(getLocation().add(rightDir, work), getLeft(), getUp(), getDirection()); Vector3.releaseTempInstance(work); Vector3.releaseTempInstance(rightDir); }