The list of methods to do Angle Between are organized into topic(s).
double
angle2DBetween(double[] coord1, double[] coord2) Calculates the angle between two coordinates in degrees.
if (coord1.length != coord2.length && coord1.length != 2)
throw new IllegalArgumentException("Number of dimensions is not valid for the provided coordinates");
double xDiff = coord2[0] - coord1[0];
double yDiff = coord2[1] - coord1[1];
double angle = Math.toDegrees(Math.atan2(yDiff, xDiff)) - 180;
return angle;
double
angle_between(double x1, double y1, double z1, double x2, double y2, double z2) Calculate the angle between two vectors in three dimensions.
double magnitude1 = StrictMath.sqrt((x1 * x1) + (y1 * y1) + (z1 * z1));
double magnitude2 = StrictMath.sqrt((x2 * x2) + (y2 * y2) + (z2 * z2));
double dotProduct = ((x1 * x2) + (y1 * y2) + (z1 * z2));
return (StrictMath.acos(dotProduct / (magnitude1 * magnitude2)));
double
angleBetween(double[] v1, double[] v2) Determine the angle of rotation between two vectors.
double m1 = mag(v1);
double m2 = mag(v2);
double ang = dot(v1, v2) / (m1 * m2);
ang = Math.acos(ang);
return ang;
double
AngleBetweenDegrees(double longitudeFirstBody, double latitudeFirstBody, double longitudeSecondBody, double latitudeSecondBody) Angle Between Degrees
double[] vectorFirst = latLonToVector(longitudeFirstBody, latitudeFirstBody);
double[] vectorSecond = latLonToVector(longitudeSecondBody, latitudeSecondBody);
double dotproduct = vectorDotProduct(vectorFirst[0], vectorFirst[1], vectorFirst[2], vectorSecond[0],
vectorSecond[1], vectorSecond[2]);
double absoluteFirst = vectorAbsoluteValue(vectorFirst[0], vectorFirst[1], vectorFirst[2]);
double absoluteSecond = vectorAbsoluteValue(vectorSecond[0], vectorSecond[1], vectorSecond[2]);
double angleResult = Math.acos(dotproduct / (absoluteFirst * absoluteSecond));
return angleResult;
...
double
AngleBetweenVectors(double X1, double Y1, double Z1, double X2, double Y2, double Z2) Angle Between Vectors
double dotproduct = vectorDotProduct(X1, Y1, Z1, X2, Y2, Z2);
double absoluteFirst = vectorAbsoluteValue(X1, Y1, Z1);
double absoluteSecond = vectorAbsoluteValue(X2, Y2, Z2);
double angleResult = Math.acos(dotproduct / (absoluteFirst * absoluteSecond));
return angleResult;