com.jme3.math
クラス FastMath

java.lang.Object
  上位を拡張 com.jme3.math.FastMath

public final class FastMath
extends java.lang.Object

FastMath provides 'fast' math approximations and float equivalents of Math functions. These are all used as static values and functions.


フィールドの概要
static double DBL_EPSILON
          A "close to zero" double epsilon value for use
static float DEG_TO_RAD
          A value to multiply a degree value by, to convert it to radians.
static float FLT_EPSILON
          A "close to zero" float epsilon value for use
static float HALF_PI
          The value PI/2 as a float. (90 degrees)
static float INV_PI
          The value 1/PI as a float.
static float INV_TWO_PI
          The value 1/(2PI) as a float.
static float ONE_THIRD
           
static float PI
          The value PI as a float. (180 degrees)
static float QUARTER_PI
          The value PI/4 as a float. (45 degrees)
static float RAD_TO_DEG
          A value to multiply a radian value by, to convert it to degrees.
static java.util.Random rand
          A precreated random object for random numbers.
static float TWO_PI
          The value 2PI as a float. (360 degrees)
static float ZERO_TOLERANCE
          A "close to zero" float epsilon value for use
 
メソッドの概要
static float abs(float fValue)
          Returns Absolute value of a float.
static float acos(float fValue)
          Returns the arc cosine of an angle given in radians.
static float asin(float fValue)
          Returns the arc sine of an angle given in radians.
static float atan(float fValue)
          Returns the arc tangent of an angle given in radians.
static float atan2(float fY, float fX)
          A direct call to Math.atan2.
static Vector3f cartesianToSpherical(Vector3f cartCoords, Vector3f store)
          Converts a point from Cartesian coordinates (using positive Y as up) to Spherical and stores the results in the store var.
static Vector3f cartesianZToSpherical(Vector3f cartCoords, Vector3f store)
          Converts a point from Cartesian coordinates (using positive Z as up) to Spherical and stores the results in the store var.
static float ceil(float fValue)
          Rounds a fValue up.
static float clamp(float input, float min, float max)
          Take a float input and clamp it between min and max.
static Vector3f computeNormal(Vector3f v1, Vector3f v2, Vector3f v3)
          A method that computes normal for a triangle defined by three vertices.
static short convertFloatToHalf(float flt)
           
static float convertHalfToFloat(short half)
          Converts a single precision (32 bit) floating point value into half precision (16 bit).
static float copysign(float x, float y)
           
static float cos(float v)
           
static float cos2(float fValue)
          Returns cos of a value.
static int counterClockwise(Vector2f p0, Vector2f p1, Vector2f p2)
          Given 3 points in a 2d plane, this function computes if the points going from A-B-C are moving counter clock wise.
static float determinant(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
          Returns the determinant of a 4x4 matrix.
static float exp(float fValue)
          Returns E^fValue
static float extrapolateLinear(float scale, float startValue, float endValue)
          Linear extrapolation from startValue to endValue by the given scale.
static Vector3f extrapolateLinear(float scale, Vector3f startValue, Vector3f endValue)
          Linear extrapolation from startValue to endValue by the given scale.
static Vector3f extrapolateLinear(float scale, Vector3f startValue, Vector3f endValue, Vector3f store)
          Linear extrapolation from startValue to endValue by the given scale.
static float fastInvSqrt(float x)
           
static float floor(float fValue)
          Returns a number rounded down.
static float getBezierP1toP2Length(Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3)
          Compute the lenght on a bezier spline between control point 1 and 2
static float getCatmullRomP1toP2Length(Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3, float startRange, float endRange, float curveTension)
          Compute the lenght on a catmull rom spline between control point 1 and 2
static float interpolateBezier(float u, float p0, float p1, float p2, float p3)
          Interpolate a spline between at least 4 control points following the Bezier equation.
static Vector3f interpolateBezier(float u, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3)
          Interpolate a spline between at least 4 control points following the Bezier equation.
static Vector3f interpolateBezier(float u, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3, Vector3f store)
          Interpolate a spline between at least 4 control points following the Bezier equation.
static float interpolateCatmullRom(float u, float T, float p0, float p1, float p2, float p3)
          Interpolate a spline between at least 4 control points following the Catmull-Rom equation.
static Vector3f interpolateCatmullRom(float u, float T, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3)
          Interpolate a spline between at least 4 control points following the Catmull-Rom equation.
static Vector3f interpolateCatmullRom(float u, float T, Vector3f p0, Vector3f p1, Vector3f p2, Vector3f p3, Vector3f store)
          Interpolate a spline between at least 4 control points following the Catmull-Rom equation.
static float interpolateLinear(float scale, float startValue, float endValue)
          Linear interpolation from startValue to endValue by the given percent.
static Vector3f interpolateLinear(float scale, Vector3f startValue, Vector3f endValue)
          Linear interpolation from startValue to endValue by the given percent.
static Vector3f interpolateLinear(float scale, Vector3f startValue, Vector3f endValue, Vector3f store)
          Linear interpolation from startValue to endValue by the given percent.
static float invSqrt(float fValue)
          Returns 1/sqrt(fValue)
static boolean isPowerOfTwo(int number)
          Returns true if the number is a power of 2 (2,4,8,16...)
static float log(float fValue)
          Returns the log base E of a value.
static float log(float value, float base)
          Returns the logarithm of value with given base, calculated as log(value)/log(base), so that pow(base, return)==value (contributed by vear)
static int nearestPowerOfTwo(int number)
           
static float nextRandomFloat()
          Returns a random float between 0 and 1.
static int nextRandomInt()
           
static int nextRandomInt(int min, int max)
          Returns a random float between min and max.
static float normalize(float val, float min, float max)
          Takes an value and expresses it in terms of min to max.
static int pointInsideTriangle(Vector2f t0, Vector2f t1, Vector2f t2, Vector2f p)
          Test if a point is inside a triangle. 1 if the point is on the ccw side, -1 if the point is on the cw side, and 0 if it is on neither.
static float pow(float fBase, float fExponent)
          Returns a number raised to an exponent power.
static float reduceSinAngle(float radians)
          Fast Trig functions for x86.
static float saturate(float input)
          Clamps the given float to be between 0 and 1.
static float sign(float fValue)
          Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise
static int sign(int iValue)
          Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise
static float sin(float v)
           
static float sin2(float fValue)
          Returns sine of a value.
static Vector3f sphericalToCartesian(Vector3f sphereCoords, Vector3f store)
          Converts a point from Spherical coordinates to Cartesian (using positive Y as up) and stores the results in the store var.
static Vector3f sphericalToCartesianZ(Vector3f sphereCoords, Vector3f store)
          Converts a point from Spherical coordinates to Cartesian (using positive Z as up) and stores the results in the store var.
static float sqr(float fValue)
          Returns the value squared.
static float sqrt(float fValue)
          Returns the square root of a given value.
static float tan(float fValue)
          Returns the tangent of a value.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

DBL_EPSILON

public static final double DBL_EPSILON
A "close to zero" double epsilon value for use

関連項目:
定数フィールド値

FLT_EPSILON

public static final float FLT_EPSILON
A "close to zero" float epsilon value for use

関連項目:
定数フィールド値

ZERO_TOLERANCE

public static final float ZERO_TOLERANCE
A "close to zero" float epsilon value for use

関連項目:
定数フィールド値

ONE_THIRD

public static final float ONE_THIRD
関連項目:
定数フィールド値

PI

public static final float PI
The value PI as a float. (180 degrees)

関連項目:
定数フィールド値

TWO_PI

public static final float TWO_PI
The value 2PI as a float. (360 degrees)

関連項目:
定数フィールド値

HALF_PI

public static final float HALF_PI
The value PI/2 as a float. (90 degrees)

関連項目:
定数フィールド値

QUARTER_PI

public static final float QUARTER_PI
The value PI/4 as a float. (45 degrees)

関連項目:
定数フィールド値

INV_PI

public static final float INV_PI
The value 1/PI as a float.

関連項目:
定数フィールド値

INV_TWO_PI

public static final float INV_TWO_PI
The value 1/(2PI) as a float.

関連項目:
定数フィールド値

DEG_TO_RAD

public static final float DEG_TO_RAD
A value to multiply a degree value by, to convert it to radians.

関連項目:
定数フィールド値

RAD_TO_DEG

public static final float RAD_TO_DEG
A value to multiply a radian value by, to convert it to degrees.

関連項目:
定数フィールド値

rand

public static final java.util.Random rand
A precreated random object for random numbers.

メソッドの詳細

isPowerOfTwo

public static boolean isPowerOfTwo(int number)
Returns true if the number is a power of 2 (2,4,8,16...) A good implementation found on the Java boards. note: a number is a power of two if and only if it is the smallest number with that number of significant bits. Therefore, if you subtract 1, you know that the new number will have fewer bits, so ANDing the original number with anything less than it will give 0.

パラメータ:
number - The number to test.
戻り値:
True if it is a power of two.

nearestPowerOfTwo

public static int nearestPowerOfTwo(int number)

interpolateLinear

public static float interpolateLinear(float scale,
                                      float startValue,
                                      float endValue)
Linear interpolation from startValue to endValue by the given percent. Basically: ((1 - percent) * startValue) + (percent * endValue)

パラメータ:
scale - scale value to use. if 1, use endValue, if 0, use startValue.
startValue - Begining value. 0% of f
endValue - ending value. 100% of f
戻り値:
The interpolated value between startValue and endValue.

interpolateLinear

public static Vector3f interpolateLinear(float scale,
                                         Vector3f startValue,
                                         Vector3f endValue,
                                         Vector3f store)
Linear interpolation from startValue to endValue by the given percent. Basically: ((1 - percent) * startValue) + (percent * endValue)

パラメータ:
scale - scale value to use. if 1, use endValue, if 0, use startValue.
startValue - Begining value. 0% of f
endValue - ending value. 100% of f
store - a vector3f to store the result
戻り値:
The interpolated value between startValue and endValue.

interpolateLinear

public static Vector3f interpolateLinear(float scale,
                                         Vector3f startValue,
                                         Vector3f endValue)
Linear interpolation from startValue to endValue by the given percent. Basically: ((1 - percent) * startValue) + (percent * endValue)

パラメータ:
scale - scale value to use. if 1, use endValue, if 0, use startValue.
startValue - Begining value. 0% of f
endValue - ending value. 100% of f
戻り値:
The interpolated value between startValue and endValue.

extrapolateLinear

public static float extrapolateLinear(float scale,
                                      float startValue,
                                      float endValue)
Linear extrapolation from startValue to endValue by the given scale. if scale is between 0 and 1 this method returns the same result as interpolateLinear if the scale is over 1 the value is linearly extrapolated. Note that the end value is the value for a scale of 1.

パラメータ:
scale - the scale for extrapolation
startValue - the starting value (scale = 0)
endValue - the end value (scale = 1)
戻り値:
an extrapolation for the given parameters

extrapolateLinear

public static Vector3f extrapolateLinear(float scale,
                                         Vector3f startValue,
                                         Vector3f endValue,
                                         Vector3f store)
Linear extrapolation from startValue to endValue by the given scale. if scale is between 0 and 1 this method returns the same result as interpolateLinear if the scale is over 1 the value is linearly extrapolated. Note that the end value is the value for a scale of 1.

パラメータ:
scale - the scale for extrapolation
startValue - the starting value (scale = 0)
endValue - the end value (scale = 1)
store - an initialized vector to store the return value
戻り値:
an extrapolation for the given parameters

extrapolateLinear

public static Vector3f extrapolateLinear(float scale,
                                         Vector3f startValue,
                                         Vector3f endValue)
Linear extrapolation from startValue to endValue by the given scale. if scale is between 0 and 1 this method returns the same result as interpolateLinear if the scale is over 1 the value is linearly extrapolated. Note that the end value is the value for a scale of 1.

パラメータ:
scale - the scale for extrapolation
startValue - the starting value (scale = 0)
endValue - the end value (scale = 1)
戻り値:
an extrapolation for the given parameters

interpolateCatmullRom

public static float interpolateCatmullRom(float u,
                                          float T,
                                          float p0,
                                          float p1,
                                          float p2,
                                          float p3)
Interpolate a spline between at least 4 control points following the Catmull-Rom equation. here is the interpolation matrix m = [ 0.0 1.0 0.0 0.0 ] [-T 0.0 T 0.0 ] [ 2T T-3 3-2T -T ] [-T 2-T T-2 T ] where T is the curve tension the result is a value between p1 and p2, t=0 for p1, t=1 for p2

パラメータ:
u - value from 0 to 1
T - The tension of the curve
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
戻り値:
catmull-Rom interpolation

interpolateCatmullRom

public static Vector3f interpolateCatmullRom(float u,
                                             float T,
                                             Vector3f p0,
                                             Vector3f p1,
                                             Vector3f p2,
                                             Vector3f p3,
                                             Vector3f store)
Interpolate a spline between at least 4 control points following the Catmull-Rom equation. here is the interpolation matrix m = [ 0.0 1.0 0.0 0.0 ] [-T 0.0 T 0.0 ] [ 2T T-3 3-2T -T ] [-T 2-T T-2 T ] where T is the tension of the curve the result is a value between p1 and p2, t=0 for p1, t=1 for p2

パラメータ:
u - value from 0 to 1
T - The tension of the curve
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
store - a Vector3f to store the result
戻り値:
catmull-Rom interpolation

interpolateCatmullRom

public static Vector3f interpolateCatmullRom(float u,
                                             float T,
                                             Vector3f p0,
                                             Vector3f p1,
                                             Vector3f p2,
                                             Vector3f p3)
Interpolate a spline between at least 4 control points following the Catmull-Rom equation. here is the interpolation matrix m = [ 0.0 1.0 0.0 0.0 ] [-T 0.0 T 0.0 ] [ 2T T-3 3-2T -T ] [-T 2-T T-2 T ] where T is the tension of the curve the result is a value between p1 and p2, t=0 for p1, t=1 for p2

パラメータ:
u - value from 0 to 1
T - The tension of the curve
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
戻り値:
catmull-Rom interpolation

interpolateBezier

public static float interpolateBezier(float u,
                                      float p0,
                                      float p1,
                                      float p2,
                                      float p3)
Interpolate a spline between at least 4 control points following the Bezier equation. here is the interpolation matrix m = [ -1.0 3.0 -3.0 1.0 ] [ 3.0 -6.0 3.0 0.0 ] [ -3.0 3.0 0.0 0.0 ] [ 1.0 0.0 0.0 0.0 ] where T is the curve tension the result is a value between p1 and p3, t=0 for p1, t=1 for p3

パラメータ:
u - value from 0 to 1
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
戻り値:
Bezier interpolation

interpolateBezier

public static Vector3f interpolateBezier(float u,
                                         Vector3f p0,
                                         Vector3f p1,
                                         Vector3f p2,
                                         Vector3f p3,
                                         Vector3f store)
Interpolate a spline between at least 4 control points following the Bezier equation. here is the interpolation matrix m = [ -1.0 3.0 -3.0 1.0 ] [ 3.0 -6.0 3.0 0.0 ] [ -3.0 3.0 0.0 0.0 ] [ 1.0 0.0 0.0 0.0 ] where T is the tension of the curve the result is a value between p1 and p3, t=0 for p1, t=1 for p3

パラメータ:
u - value from 0 to 1
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
store - a Vector3f to store the result
戻り値:
Bezier interpolation

interpolateBezier

public static Vector3f interpolateBezier(float u,
                                         Vector3f p0,
                                         Vector3f p1,
                                         Vector3f p2,
                                         Vector3f p3)
Interpolate a spline between at least 4 control points following the Bezier equation. here is the interpolation matrix m = [ -1.0 3.0 -3.0 1.0 ] [ 3.0 -6.0 3.0 0.0 ] [ -3.0 3.0 0.0 0.0 ] [ 1.0 0.0 0.0 0.0 ] where T is the tension of the curve the result is a value between p1 and p3, t=0 for p1, t=1 for p3

パラメータ:
u - value from 0 to 1
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
戻り値:
Bezier interpolation

getCatmullRomP1toP2Length

public static float getCatmullRomP1toP2Length(Vector3f p0,
                                              Vector3f p1,
                                              Vector3f p2,
                                              Vector3f p3,
                                              float startRange,
                                              float endRange,
                                              float curveTension)
Compute the lenght on a catmull rom spline between control point 1 and 2

パラメータ:
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
startRange - the starting range on the segment (use 0)
endRange - the end range on the segment (use 1)
curveTension - the curve tension
戻り値:
the length of the segment

getBezierP1toP2Length

public static float getBezierP1toP2Length(Vector3f p0,
                                          Vector3f p1,
                                          Vector3f p2,
                                          Vector3f p3)
Compute the lenght on a bezier spline between control point 1 and 2

パラメータ:
p0 - control point 0
p1 - control point 1
p2 - control point 2
p3 - control point 3
戻り値:
the length of the segment

acos

public static float acos(float fValue)
Returns the arc cosine of an angle given in radians.
Special cases:

パラメータ:
fValue - The angle, in radians.
戻り値:
fValue's acos
関連項目:
Math.acos(double)

asin

public static float asin(float fValue)
Returns the arc sine of an angle given in radians.
Special cases:

パラメータ:
fValue - The angle, in radians.
戻り値:
fValue's asin
関連項目:
Math.asin(double)

atan

public static float atan(float fValue)
Returns the arc tangent of an angle given in radians.

パラメータ:
fValue - The angle, in radians.
戻り値:
fValue's atan
関連項目:
Math.atan(double)

atan2

public static float atan2(float fY,
                          float fX)
A direct call to Math.atan2.

パラメータ:
fY -
fX -
戻り値:
Math.atan2(fY,fX)
関連項目:
Math.atan2(double, double)

ceil

public static float ceil(float fValue)
Rounds a fValue up. A call to Math.ceil

パラメータ:
fValue - The value.
戻り値:
The fValue rounded up
関連項目:
Math.ceil(double)

reduceSinAngle

public static float reduceSinAngle(float radians)
Fast Trig functions for x86. This forces the trig functiosn to stay within the safe area on the x86 processor (-45 degrees to +45 degrees) The results may be very slightly off from what the Math and StrictMath trig functions give due to rounding in the angle reduction but it will be very very close. note: code from wiki posting on java.net by jeffpk


sin2

public static float sin2(float fValue)
Returns sine of a value. note: code from wiki posting on java.net by jeffpk

パラメータ:
fValue - The value to sine, in radians.
戻り値:
The sine of fValue.
関連項目:
Math.sin(double)

cos2

public static float cos2(float fValue)
Returns cos of a value.

パラメータ:
fValue - The value to cosine, in radians.
戻り値:
The cosine of fValue.
関連項目:
Math.cos(double)

cos

public static float cos(float v)

sin

public static float sin(float v)

exp

public static float exp(float fValue)
Returns E^fValue

パラメータ:
fValue - Value to raise to a power.
戻り値:
The value E^fValue
関連項目:
Math.exp(double)

abs

public static float abs(float fValue)
Returns Absolute value of a float.

パラメータ:
fValue - The value to abs.
戻り値:
The abs of the value.
関連項目:
Math.abs(float)

floor

public static float floor(float fValue)
Returns a number rounded down.

パラメータ:
fValue - The value to round
戻り値:
The given number rounded down
関連項目:
Math.floor(double)

invSqrt

public static float invSqrt(float fValue)
Returns 1/sqrt(fValue)

パラメータ:
fValue - The value to process.
戻り値:
1/sqrt(fValue)
関連項目:
Math.sqrt(double)

fastInvSqrt

public static float fastInvSqrt(float x)

log

public static float log(float fValue)
Returns the log base E of a value.

パラメータ:
fValue - The value to log.
戻り値:
The log of fValue base E
関連項目:
Math.log(double)

log

public static float log(float value,
                        float base)
Returns the logarithm of value with given base, calculated as log(value)/log(base), so that pow(base, return)==value (contributed by vear)

パラメータ:
value - The value to log.
base - Base of logarithm.
戻り値:
The logarithm of value with given base

pow

public static float pow(float fBase,
                        float fExponent)
Returns a number raised to an exponent power. fBase^fExponent

パラメータ:
fBase - The base value (IE 2)
fExponent - The exponent value (IE 3)
戻り値:
base raised to exponent (IE 8)
関連項目:
Math.pow(double, double)

sqr

public static float sqr(float fValue)
Returns the value squared. fValue ^ 2

パラメータ:
fValue - The vaule to square.
戻り値:
The square of the given value.

sqrt

public static float sqrt(float fValue)
Returns the square root of a given value.

パラメータ:
fValue - The value to sqrt.
戻り値:
The square root of the given value.
関連項目:
Math.sqrt(double)

tan

public static float tan(float fValue)
Returns the tangent of a value. If USE_FAST_TRIG is enabled, an approximate value is returned. Otherwise, a direct value is used.

パラメータ:
fValue - The value to tangent, in radians.
戻り値:
The tangent of fValue.
関連項目:
Math.tan(double)

sign

public static int sign(int iValue)
Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise

パラメータ:
iValue - The integer to examine.
戻り値:
The integer's sign.

sign

public static float sign(float fValue)
Returns 1 if the number is positive, -1 if the number is negative, and 0 otherwise

パラメータ:
fValue - The float to examine.
戻り値:
The float's sign.

counterClockwise

public static int counterClockwise(Vector2f p0,
                                   Vector2f p1,
                                   Vector2f p2)
Given 3 points in a 2d plane, this function computes if the points going from A-B-C are moving counter clock wise.

パラメータ:
p0 - Point 0.
p1 - Point 1.
p2 - Point 2.
戻り値:
1 If they are CCW, -1 if they are not CCW, 0 if p2 is between p0 and p1.

pointInsideTriangle

public static int pointInsideTriangle(Vector2f t0,
                                      Vector2f t1,
                                      Vector2f t2,
                                      Vector2f p)
Test if a point is inside a triangle. 1 if the point is on the ccw side, -1 if the point is on the cw side, and 0 if it is on neither.

パラメータ:
t0 - First point of the triangle.
t1 - Second point of the triangle.
t2 - Third point of the triangle.
p - The point to test.
戻り値:
Value 1 or -1 if inside triangle, 0 otherwise.

computeNormal

public static Vector3f computeNormal(Vector3f v1,
                                     Vector3f v2,
                                     Vector3f v3)
A method that computes normal for a triangle defined by three vertices.

パラメータ:
v1 - first vertex
v2 - second vertex
v3 - third vertex
戻り値:
a normal for the face

determinant

public static float determinant(double m00,
                                double m01,
                                double m02,
                                double m03,
                                double m10,
                                double m11,
                                double m12,
                                double m13,
                                double m20,
                                double m21,
                                double m22,
                                double m23,
                                double m30,
                                double m31,
                                double m32,
                                double m33)
Returns the determinant of a 4x4 matrix.


nextRandomFloat

public static float nextRandomFloat()
Returns a random float between 0 and 1.

戻り値:
A random float between 0.0f (inclusive) to 1.0f (exclusive).

nextRandomInt

public static int nextRandomInt(int min,
                                int max)
Returns a random float between min and max.

戻り値:
A random int between min (inclusive) to max (inclusive).

nextRandomInt

public static int nextRandomInt()

sphericalToCartesian

public static Vector3f sphericalToCartesian(Vector3f sphereCoords,
                                            Vector3f store)
Converts a point from Spherical coordinates to Cartesian (using positive Y as up) and stores the results in the store var.


cartesianToSpherical

public static Vector3f cartesianToSpherical(Vector3f cartCoords,
                                            Vector3f store)
Converts a point from Cartesian coordinates (using positive Y as up) to Spherical and stores the results in the store var. (Radius, Azimuth, Polar)


sphericalToCartesianZ

public static Vector3f sphericalToCartesianZ(Vector3f sphereCoords,
                                             Vector3f store)
Converts a point from Spherical coordinates to Cartesian (using positive Z as up) and stores the results in the store var.


cartesianZToSpherical

public static Vector3f cartesianZToSpherical(Vector3f cartCoords,
                                             Vector3f store)
Converts a point from Cartesian coordinates (using positive Z as up) to Spherical and stores the results in the store var. (Radius, Azimuth, Polar)


normalize

public static float normalize(float val,
                              float min,
                              float max)
Takes an value and expresses it in terms of min to max.

パラメータ:
val - - the angle to normalize (in radians)
戻り値:
the normalized angle (also in radians)

copysign

public static float copysign(float x,
                             float y)
パラメータ:
x - the value whose sign is to be adjusted.
y - the value whose sign is to be used.
戻り値:
x with its sign changed to match the sign of y.

clamp

public static float clamp(float input,
                          float min,
                          float max)
Take a float input and clamp it between min and max.

パラメータ:
input -
min -
max -
戻り値:
clamped input

saturate

public static float saturate(float input)
Clamps the given float to be between 0 and 1.

パラメータ:
input -
戻り値:
input clamped between 0 and 1.

convertHalfToFloat

public static float convertHalfToFloat(short half)
Converts a single precision (32 bit) floating point value into half precision (16 bit). Source: http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf

パラメータ:
half - The half floating point value as a short.
戻り値:
floating point value of the half.

convertFloatToHalf

public static short convertFloatToHalf(float flt)