/** * Locally adds to the translation of this transform. * * @param vec * @return this transform for chaining. */ public Transform translate(final ReadOnlyVector3 vec) { _translation.addLocal(vec); _identity = _identity && _translation.equals(Vector3.ZERO); return this; }
/** * Locally adds to the translation of this transform. * * @param vec * @return this transform for chaining. */ public Transform translate(final ReadOnlyVector3 vec) { _translation.addLocal(vec); _identity = _identity && _translation.equals(Vector3.ZERO); return this; }
/** * Locally adds to the translation of this transform. * * @param x * @param y * @param z * @return this transform for chaining. */ public Transform translate(final double x, final double y, final double z) { _translation.addLocal(x, y, z); _identity = _identity && _translation.equals(Vector3.ZERO); return this; }
/** * 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; }
/** * 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; }
/** * Increments the values of this vector with the x, y and z values of the given vector. * * @param source * @return this vector for chaining * @throws NullPointerException * if source is null. */ public Vector3 addLocal(final ReadOnlyVector3 source) { return addLocal(source.getX(), source.getY(), source.getZ()); }
@Override public void prepare(final ParticleSystem system) { super.prepare(system); _swarmPoint.set(system.getOriginCenter()).addLocal(_swarmOffset); }
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()); }
@Override public void prepare(final ParticleSystem system) { super.prepare(system); _swarmPoint.set(system.getOriginCenter()).addLocal(_swarmOffset); }
/** * Increments the values of this vector with the x, y and z values of the given vector. * * @param source * @return this vector for chaining * @throws NullPointerException * if source is null. */ public Vector3 addLocal(final ReadOnlyVector3 source) { return addLocal(source.getX(), source.getY(), source.getZ()); }
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; }
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; }
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; }
/** * Constructs a new segment segment using the supplied start and end points * * @param start * @param end */ public LineSegment3(final ReadOnlyVector3 start, final ReadOnlyVector3 end) { this(); _origin.set(start).addLocal(end).multiplyLocal(0.5); _direction.set(end).subtractLocal(start); _extent = 0.5 * _direction.length(); _direction.normalizeLocal(); }
/** * Constructs a new segment segment using the supplied start and end points * * @param start * @param end */ public LineSegment3(final ReadOnlyVector3 start, final ReadOnlyVector3 end) { this(); _origin.set(start).addLocal(end).multiplyLocal(0.5); _direction.set(end).subtractLocal(start); _extent = 0.5 * _direction.length(); _direction.normalizeLocal(); }