public boolean isDoneSlipping() { boolean translationalSlipDone = slipAmount.lengthSquared() < 0.0001 * 0.0001; Vector3D eulerAngles = new Vector3D(); slipRotation.getEulerAngles(eulerAngles); boolean rotationalSlipDone = eulerAngles.lengthSquared() < 0.001 * 0.001; return translationalSlipDone & rotationalSlipDone; }
@Test public void testGetDiagonalLengthSquared() throws Exception { Random random = new Random(324234L); for (int i = 0; i < ITERATIONS; i++) { Point3D center = EuclidCoreRandomTools.nextPoint3D(random, 10.0); Vector3D halfSize = EuclidCoreRandomTools.nextVector3D(random, 0.0, 10.0); BoundingBox3D boundingBox3D = new BoundingBox3D(); boundingBox3D.set(center, halfSize); assertEquals(4.0 * halfSize.lengthSquared(), boundingBox3D.getDiagonalLengthSquared(), EPSILON); } }
@Override public void perturb(Vector3D direction) { Vector3D ballVelocity = new Vector3D(direction); if (ballVelocity.lengthSquared() > 0.0) { ballVelocity.normalize(); ballVelocity.scale(ballVelocityMagnitude); collidable.handleCollision(ballVelocity, getBallMass(), coefficientOfRestitution); } }
@Override public void perturb(Vector3D direction) { Vector3D force = new Vector3D(direction); if (direction.lengthSquared() > 0.0) { force.normalize(); force.scale(disturbanceMagnitude.getDoubleValue()); forcePerturbable.setForcePerturbance(force, disturbanceDuration.getDoubleValue()); } }
closestTriangleToOrigin = triangleEntryToExpand; if (closestPointToOrigin.lengthSquared() < 1e-6) double lengthSquared = closestPointToOrigin.lengthSquared(); mu = Math.min(mu, vDotW * vDotW / lengthSquared); closeEnough = (mu <= (1.0 + epsilonRelative) * (1.0 + epsilonRelative) * lengthSquared); listener.createdNewEntry(newEntry); double newEntryClosestDistanceSquared = newEntry.getClosestPointToOrigin().lengthSquared(); if ((newEntry.closestIsInternal()) && (closestPointToOrigin.lengthSquared() <= newEntryClosestDistanceSquared) && (newEntryClosestDistanceSquared <= mu)) || (triangleEntryQueue.peek().getClosestPointToOrigin().lengthSquared() > mu))
double lengthSquared = tempVectorForSupportingVertex.lengthSquared();
if (delta.lengthSquared() > 1.0e-10)
point4Vector.sub(point4, point1); double oneToTwoSqaured = point2Vector.lengthSquared();