/** {@inheritDoc} */ @Override public RealVector mapAsinToSelf() { for (int i = 0; i < data.length; i++) { data[i] = FastMath.asin(data[i]); } return this; }
/** {@inheritDoc} */ @Override public double value(double d) { return FastMath.asin(d); } };
/** Get the elevation of the vector. * @return elevation (δ) of the vector, between -π/2 and +π/2 * @see #Vector3D(double, double) */ public double getDelta() { return FastMath.asin(z / getNorm()); }
/** Get the angle of the rotation. * @return angle of the rotation (between 0 and π) * @see #Rotation(Vector3D, double) */ public double getAngle() { if ((q0 < -0.1) || (q0 > 0.1)) { return 2 * FastMath.asin(FastMath.sqrt(q1 * q1 + q2 * q2 + q3 * q3)); } else if (q0 < 0) { return 2 * FastMath.acos(-q0); } return 2 * FastMath.acos(q0); }
/** Compute the angular separation between two vectors. * <p>This method computes the angular separation between two * vectors using the dot product for well separated vectors and the * cross product for almost aligned vectors. This allows to have a * good accuracy in all cases, even for vectors very close to each * other.</p> * @param v1 first vector * @param v2 second vector * @return angular separation between v1 and v2 * @exception ArithmeticException if either vector has a null norm */ public static double angle(Vector3D v1, Vector3D v2) { double normProduct = v1.getNorm() * v2.getNorm(); if (normProduct == 0) { throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_NORM); } double dot = dotProduct(v1, v2); double threshold = normProduct * 0.9999; if ((dot < -threshold) || (dot > threshold)) { // the vectors are almost aligned, compute using the sine Vector3D v3 = crossProduct(v1, v2); if (dot >= 0) { return FastMath.asin(v3.getNorm() / normProduct); } return FastMath.PI - FastMath.asin(v3.getNorm() / normProduct); } // the vectors are sufficiently separated to use the cosine return FastMath.acos(dot / normProduct); }
FastMath.asin(v2.getZ()), FastMath.atan2(-(v2.getY()), v2.getX()) }; -FastMath.asin(v2.getY()), FastMath.atan2(v2.getZ(), v2.getX()) }; -FastMath.asin(v2.getZ()), FastMath.atan2(v2.getX(), v2.getY()) }; FastMath.asin(v2.getX()), FastMath.atan2(-(v2.getZ()), v2.getY()) }; FastMath.asin(v2.getY()), FastMath.atan2(-(v2.getX()), v2.getZ()) }; -FastMath.asin(v2.getX()), FastMath.atan2(v2.getY(), v2.getZ()) };