|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectus.ihmc.utilities.math.MathTools
public class MathTools
| Method Summary | |
|---|---|
static double |
angleMinusPiToPi(javax.vecmath.Vector2d startVector,
javax.vecmath.Vector2d endVector)
|
static boolean |
arePointsInOrderColinear(javax.vecmath.Point3d startPoint,
javax.vecmath.Point3d middlePoint,
javax.vecmath.Point3d endPoint)
arePointsInOrderColinear: This returns true is: middle point is epsilon close to start or end Otherwise: if the start is EPSILON close to the end, return false if |(start to midle unit vector) dot with (start to end unit vector) - 1| > EPSILON return false else return true |
static double |
averageNumbers(java.util.ArrayList<java.lang.Double> values)
|
static double |
clipToMinMax(double val,
double min,
double max)
Returns max if max greater than given value Returns min if min less than given value Reutrns value if value is between max and min |
static double |
computeAngleAverage(double angleA,
double angleB)
|
static double |
computeAngleDifferenceMinusPiToPi(double angleA,
double angleB)
computeAngleDifferenceMinusPiToPi: returns (angleA - angleB), where the return value is [-pi, pi) |
static double |
computeAngleDifferenceMinusTwoPiToZero(double angleA,
double angleB)
computeAngleDifferenceMinusPiToPi: returns (angleA - angleB), where the return value is [-2.0*pi, 0.0) |
static java.util.ArrayList<FrameVector> |
diff(java.util.ArrayList<FrameVector> array)
|
static double[] |
diff(double[] array)
Subtracts each element of a double array by the previous element in the array, returns the new array |
static java.util.ArrayList<FrameVector> |
diffWithAlphaFilter(java.util.ArrayList<FrameVector> array,
double alpha,
double dt)
|
static double[] |
dotPlus(double[] array,
double addToAllElementsOfA)
Adds parameter 'addToAllElements' to all elements of the double array and returns the new array |
static int[] |
dotPlus(int[] array,
int addToAllElementsOfA)
Adds parameter 'addToAllElements' to all elements of the integer array and returns the new array |
static boolean |
epsilonEquals(double v1,
double v2,
double epsilon)
True if value |(v1-v2)| <= |epsilon| false if not |
static int |
findClosestNinetyDegreeYaw(double yawInRadians)
Finds the closest 90 degree yaw and returns number of 90 degrees (0 = 0; 1 = 90; 2 = 180; 3 = 270). |
static double |
findZeroCrossing(MathFunction mathFunction,
double min,
double max,
double tolerance)
|
static double |
generateRandomAngle(java.util.Random random)
Returns an evenly distributed random number between -2PI and 2PI |
static double |
generateRandomDoubleInRange(java.util.Random random,
double range1,
double range2)
Returns an evenly distributed random number between two bounds. |
static javax.vecmath.Point3d |
generateRandomPoint3d(java.util.Random random,
double[] range1,
double[] range2)
Returns an evenly distributed random point3d. |
static double[] |
getFirstDerivatives(javax.vecmath.Point2d[] points)
|
static void |
getQuaternionFromTransform3D(javax.media.j3d.Transform3D transform3D,
javax.vecmath.Quat4d q1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter. |
static java.util.ArrayList |
getReversedArrayList(java.util.ArrayList arrayList)
Returns the Array in Reverse Order |
static boolean |
isInsideBounds(double val,
double min,
double max)
Checks to see if val is Inside Bounds of max and min |
static javax.media.j3d.Transform3D |
loadTransform(java.io.BufferedReader bufferedReader)
|
static void |
main(java.lang.String[] args)
|
static double |
max(double[] array)
Finds and returns the max value in an array of Doubles |
static double |
mean(java.util.ArrayList<java.lang.Double> array)
|
static double |
mean(double[] array)
|
static double |
min(double[] array)
Finds and returns the min value in an array of doubles |
static void |
saveTransform(javax.media.j3d.Transform3D transform3D,
java.io.PrintWriter printWriter)
|
static double |
shiftAngleToStartOfRange(double angleToShift,
double startOfAngleRange)
This will shift an angle to be in the range [startOfAngleRange, (startOfAngleRange + 2*pi) |
static double |
sign(double argument)
Returns the sign of the argument. |
static java.util.ArrayList<java.util.ArrayList> |
splitArrayIntoEqualishParts(java.util.ArrayList array,
int numberOfParts)
Returns an arraylist of arraylists each with an equalish part of the original array. |
static int |
sumArray1(java.util.ArrayList<java.lang.Integer> array)
Sums the integer values in an array and returns the sum |
static double |
sumArray2(java.util.ArrayList<java.lang.Double> array)
Adds all the Double values in an array and returns the sum |
static boolean |
withinPercentEquals(double v1,
double v2,
double percent)
True if v2 is within given percent of v1 False otherwise |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static double angleMinusPiToPi(javax.vecmath.Vector2d startVector,
javax.vecmath.Vector2d endVector)
public static double computeAngleAverage(double angleA,
double angleB)
public static double sign(double argument)
argument - double
public static int findClosestNinetyDegreeYaw(double yawInRadians)
yawInRadians - double
public static int[] dotPlus(int[] array,
int addToAllElementsOfA)
array - int[]addToAllElementsOfA - int
public static double[] dotPlus(double[] array,
double addToAllElementsOfA)
array - double[]addToAllElementsOfA - double
public static java.util.ArrayList<FrameVector> diff(java.util.ArrayList<FrameVector> array)
array - ArrayList
public static double[] diff(double[] array)
array - double[]
public static java.util.ArrayList<FrameVector> diffWithAlphaFilter(java.util.ArrayList<FrameVector> array,
double alpha,
double dt)
array - ArrayListalpha - doubledt - double
public static double computeAngleDifferenceMinusPiToPi(double angleA,
double angleB)
angleA - doubleangleB - double
public static double computeAngleDifferenceMinusTwoPiToZero(double angleA,
double angleB)
angleA - doubleangleB - double
public static double shiftAngleToStartOfRange(double angleToShift,
double startOfAngleRange)
angleToShift - the angle to shiftstartOfAngleRange - start of the range.
public static double generateRandomAngle(java.util.Random random)
random - Random number generator
public static double generateRandomDoubleInRange(java.util.Random random,
double range1,
double range2)
random - Random number generator.range - One side of the bounds.range2 - Other side of the bounds.
public static double[] getFirstDerivatives(javax.vecmath.Point2d[] points)
public static javax.vecmath.Point3d generateRandomPoint3d(java.util.Random random,
double[] range1,
double[] range2)
random - Random number generator.range1 - One side of the bounds for x, y, z.bounds2 - Other side of the bounds for x, y, z.
public static boolean arePointsInOrderColinear(javax.vecmath.Point3d startPoint,
javax.vecmath.Point3d middlePoint,
javax.vecmath.Point3d endPoint)
startPoint - Point3dmiddlePoint - Point3dendPoint - Point3d
public static void saveTransform(javax.media.j3d.Transform3D transform3D,
java.io.PrintWriter printWriter)
public static javax.media.j3d.Transform3D loadTransform(java.io.BufferedReader bufferedReader)
throws java.io.IOException
java.io.IOException
public static void getQuaternionFromTransform3D(javax.media.j3d.Transform3D transform3D,
javax.vecmath.Quat4d q1)
q1 - the quaternion into which the rotation component is placed
public static boolean epsilonEquals(double v1,
double v2,
double epsilon)
v1 - doublev2 - doubleepsilon - double
public static boolean withinPercentEquals(double v1,
double v2,
double percent)
v1 - doublev2 - doublepercent - double
public static double findZeroCrossing(MathFunction mathFunction,
double min,
double max,
double tolerance)
public static double clipToMinMax(double val,
double min,
double max)
val - doublemin - doublemax - double
public static boolean isInsideBounds(double val,
double min,
double max)
val - doublemin - doublemax - double
public static int sumArray1(java.util.ArrayList<java.lang.Integer> array)
array - ArrayList
public static double sumArray2(java.util.ArrayList<java.lang.Double> array)
array - ArrayList
public static double min(double[] array)
array - double[]
public static double max(double[] array)
array - double[]
public static double mean(double[] array)
array - double[]
public static double mean(java.util.ArrayList<java.lang.Double> array)
array - ArrayList
public static java.util.ArrayList<java.util.ArrayList> splitArrayIntoEqualishParts(java.util.ArrayList array,
int numberOfParts)
array - ArrayListnumberOfParts - int
public static java.util.ArrayList getReversedArrayList(java.util.ArrayList arrayList)
arrayList - ArrayList
public static double averageNumbers(java.util.ArrayList<java.lang.Double> values)
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||