protected void determineIfCrossPartIsZero() { double epsilon = 1e-11; crossPartZero = (crossPart.lengthSquared() < epsilon); }
public void normalize() { double norm = Math.sqrt(linearPart.lengthSquared() + angularPart.lengthSquared()); double scalar = 1.0 / norm; scaleLinearPart(scalar); scaleAngularPart(scalar); }
public double getVectorDistanceKMSq(final EarthVector loc) { final Vector3d delta = getVector(loc); return delta.lengthSquared(); }
/** * <p> * Check that the row and column vectors are unit vectors and are orthogonal. * </p> * * @param row * the row direction cosines * @param column * the column direction cosines * @throws IllegalArgumentException * thrown if not */ public static void validateDirectionCosines(Vector3d row, Vector3d column) { if (Math.abs(row.lengthSquared() - 1) > 0.001) { throw new IllegalArgumentException("Row not a unit vector"); //$NON-NLS-1$ } if (Math.abs(column.lengthSquared() - 1) > 0.001) { throw new IllegalArgumentException("Column not a unit vector"); //$NON-NLS-1$ } if (row.dot(column) > 0.005) { // dot product should be cos(90)=0 if orthogonal throw new IllegalArgumentException("Row and column vectors are not orthogonal"); //$NON-NLS-1$ } }
public void limitAngularPartMagnitude(double maximumMagnitude) { if (maximumMagnitude < 1e-7) angularPart.set(0.0, 0.0, 0.0); if (angularPart.lengthSquared() > maximumMagnitude * maximumMagnitude) { angularPart.scale(maximumMagnitude/angularPart.length()); } }
/** * Projects the Vector 'vector' onto the Vector 'onto'. * * @param onto the Vector to be projected on. * @param vector the Vector to be projected. * @return the projection of 'vector' on 'onto' */ protected static final Vector3d getProjection(final Vector3d onto, final Vector3d vector) { Vector3d projection = new Vector3d(onto); projection.scale(projection.dot(vector) / onto.lengthSquared()); return projection; }
public void limitLinearPartMagnitude(double maximumMagnitude) { if (maximumMagnitude < 1e-7) linearPart.set(0.0, 0.0, 0.0); if (linearPart.lengthSquared() > maximumMagnitude * maximumMagnitude) { linearPart.scale(maximumMagnitude/linearPart.length()); } }
if (axis.lengthSquared() < 1.0E-6) { axisAngle.x = 0; axisAngle.y = 0;
final Vector3d normal = new Vector3d(); normal.cross(vecteurs[i], vecteurs[(i + 1) % 5]); if (normal.lengthSquared() > 0) { normal.normalize(); final Vector3d normal = new Vector3d(); normal.cross(vecteurs[i], vecteurs[(i + 1) % 5]); if (normal.lengthSquared() > 0) { normal.normalize(); final Vector3d normal = new Vector3d(); normal.cross(vecteurs[i], vecteurs[(i + 1) % 5]); if (normal.lengthSquared() > 0) { normal.normalize(); final Vector3d normal = new Vector3d(); normal.cross(vecteurs[i], vecteurs[(i + 1) % 5]); if (normal.lengthSquared() > 0) { normal.normalize();
if (!MathTools.epsilonEquals(1.0, axisOfRotation.lengthSquared(), epsilon)) throw new RuntimeException("axis of rotation must be of unit magnitude. axisOfRotation: " + axisOfRotation);
if (axis.lengthSquared() < 1.0E-6) { axisAngle.x = 0; axisAngle.y = 0;
if (axis.lengthSquared() < 1.0E-6) { axisAngle.x = 0; axisAngle.y = 0;
double det = intersectionDirectionToPack.lengthSquared();
if (tempAngularVelocity.lengthSquared() > 1.0e-10)
final Vector3d normal = new Vector3d(); normal.cross(_vecteurs[i], _vecteurs[(i + 1) % 5]); if (normal.lengthSquared() > 0) { normal.normalize();
point4Vector.sub(point4.getPoint(), point1.getPoint()); double oneToTwoSqaured = point2Vector.lengthSquared();