adding new candidates for calculateDirection method replacement
parent
a01cc31f37
commit
8b431e1166
|
@ -30,6 +30,19 @@ public class ArtyMath {
|
|||
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.
|
||||
* @param elevation Angle of elevation in radians
|
||||
|
|
Loading…
Reference in New Issue