public class MyMath extends Object implements MathConstants
Modifier and Type | Method and Description |
---|---|
static double |
cleanPositiveAngle(double pAngle) |
static double |
computeAngle(long pX1,
long pY1,
long pX2,
long pY2) |
static void |
computeCirclePoint(long pCenterX,
long pCenterY,
double pRadius,
double pAngle,
PointL pOutput) |
static int |
floorToInt(double pValue) |
static long |
floorToLong(double pValue)
Casting a _negative_ double into a long has a counter-intuitive result.
|
static double |
getAngleDifference(double pStart,
double pEnd,
Boolean pClockwise) |
static int |
getNextSquareNumberAbove(float factor) |
static double |
gudermann(double y) |
static double |
gudermannInverse(double aLatitude) |
static int |
mod(int number,
int modulus) |
public static double gudermannInverse(double aLatitude)
public static double gudermann(double y)
public static int mod(int number, int modulus)
public static long floorToLong(double pValue)
public static int floorToInt(double pValue)
public static int getNextSquareNumberAbove(float factor)
factor
.
Assert.assertEquals(1, getNextSquareNumberAbove(1.1f)); Assert.assertEquals(2,
getNextSquareNumberAbove(2.1f)); Assert.assertEquals(2, getNextSquareNumberAbove(3.9f));
Assert.assertEquals(3, getNextSquareNumberAbove(4.1f)); Assert.assertEquals(3,
getNextSquareNumberAbove(7.9f)); Assert.assertEquals(4, getNextSquareNumberAbove(8.1f));
Assert.assertEquals(5, getNextSquareNumberAbove(16.1f));
Assert.assertEquals(-1, - getNextSquareNumberAbove(1 / 0.4f) + 1); Assert.assertEquals(-2, -
getNextSquareNumberAbove(1 / 0.24f) + 1);public static double getAngleDifference(double pStart, double pEnd, Boolean pClockwise)
pStart
- start anglepEnd
- end anglepClockwise
- if null, get the smallest difference (in absolute value)
if true, go clockwise
if false, go anticlockwisepublic static double cleanPositiveAngle(double pAngle)
pAngle
- angle in degreepublic static double computeAngle(long pX1, long pY1, long pX2, long pY2)
public static void computeCirclePoint(long pCenterX, long pCenterY, double pRadius, double pAngle, PointL pOutput)