You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
package network.Utils;
|
|
|
|
/**
|
|
* Created by fwy13 on 28/04/17.
|
|
*/
|
|
public class AC35UnitConverter {
|
|
|
|
public static double convertGPS(int value){
|
|
//converts latitude or longitue to angle
|
|
return (double) value * 180.0 / 2147483648.0;//2^31 = 2147483648
|
|
}
|
|
|
|
public static int convertGPSToInt(double value){
|
|
//converts latitude or longitue to angle
|
|
return (int) (value * 2147483648.0/180.0);//2^31 = 2147483648
|
|
}
|
|
|
|
public static double convertHeading(long value){
|
|
return (double) value * 360.0/65536.0;//2^15
|
|
}
|
|
|
|
public static double convertHeading(int value){
|
|
return (double) value * 360.0/65536.0;//2^15
|
|
}
|
|
|
|
|
|
public static double convertHeading(double value){
|
|
return value * 360.0/65536.0;//2^15
|
|
}
|
|
|
|
public static int encodeHeading(int value){
|
|
return (int) (value / 360.0 * 65536.0);//2^15
|
|
}
|
|
|
|
public static int encodeHeading(double value){
|
|
return (int) (value / 360.0 * 65536.0);//2^15
|
|
}
|
|
|
|
public static double convertTrueWindAngle(long value){
|
|
return (double) value * 180.0/32768.0;//-2^15 to 2^15
|
|
}
|
|
|
|
}
|