adding new candidates for calculateDirection method replacement

master
Soper Aylamo 2021-06-19 01:16:54 -04:00
parent a01cc31f37
commit 8b431e1166
Signed by: Soper
GPG Key ID: A27AC885ACC3BEAE
1 changed files with 13 additions and 0 deletions

View File

@ -30,6 +30,19 @@ public class ArtyMath {
return eastVector.angle(vector); return eastVector.angle(vector);
} }
public static double calculateDirectionDOTPRODUCT(Vector vector){
double x = vector.getX();
double z = vector.getZ();
double directionMagnitude = Math.sqrt((x*x)+(z*z));
//dot product is always going to just be the x value
//since the z value for the east vector is 0.
return Math.acos(x/directionMagnitude);
}
public static double calculateDirectionBASICTRIG(Vector vector){
return Math.atan(vector.getZ()/vector.getX());
}
/** /**
* Uses the elevation and direction angles given to return a unit vector corresponding to the angles. * Uses the elevation and direction angles given to return a unit vector corresponding to the angles.
* @param elevation Angle of elevation in radians * @param elevation Angle of elevation in radians