/** * computes angle(in radian) between two vectors * * @return angle in radians */ public static final double calculateAngle(Vector3D v1, Vector3D v2) { return Math.acos(Vector3D.dotProduct(v1.getUnitVector(), v2.getUnitVector())); }
/** @return Component of this vector parallel to given vector */ public Vector3D Get_Parallel_Component(Vector3D dirVector3D) { return dirVector3D.scale(this.DotProduct(dirVector3D.getUnitVector())); }
/** * test if the two vectors are orthogonal * * @return true if the vectors are orthogonal */ public static final boolean checkOrthogonal(Vector3D v1, Vector3D v2) { return Vector3D.dotProduct(v1.getUnitVector(), v2.getUnitVector()) < EPSILON; }