Package com.jme3.math
Class MathUtils
java.lang.Object
com.jme3.math.MathUtils
Created by Nehon on 23/04/2017.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Quaternion
exp
(Quaternion q, Quaternion store) Calculate the exponential of a pure quaternion.static Quaternion
log
(Quaternion q, Quaternion store) Calculate the natural logarithm of a unit quaternion.static float
raySegmentShortestDistance
(Ray ray, Vector3f segStart, Vector3f segEnd, Camera camera) Returns the shortest distance between a Ray and a segment.static Quaternion
slerp
(Quaternion q1, Quaternion q2, float t, Quaternion store) Interpolate between 2 quaternions using Slerp.static Quaternion
slerpNoInvert
(Quaternion q1, Quaternion q2, float t, Quaternion store) static Quaternion
squad
(Quaternion q0, Quaternion q1, Quaternion q2, Quaternion q3, Quaternion a, Quaternion b, float t, Quaternion store)
-
Method Details
-
log
Calculate the natural logarithm of a unit quaternion.- Parameters:
q
- the input Quaternion (not null, normalized, unaffected)store
- storage for the result (not null, modified)- Returns:
- the logarithm (store)
-
exp
Calculate the exponential of a pure quaternion.- Parameters:
q
- the input Quaternion (not null, w=0, unaffected)store
- storage for the result (not null, modified)- Returns:
- the exponential (store)
-
slerpNoInvert
-
slerp
Interpolate between 2 quaternions using Slerp.- Parameters:
q1
- the desired value for t=0q2
- the desired value for t=1t
- the fractional parameter (≥0, ≤1)store
- storage for the result (not null, modified)- Returns:
- the interpolated Quaternion (store)
-
squad
public static Quaternion squad(Quaternion q0, Quaternion q1, Quaternion q2, Quaternion q3, Quaternion a, Quaternion b, float t, Quaternion store) -
raySegmentShortestDistance
public static float raySegmentShortestDistance(Ray ray, Vector3f segStart, Vector3f segEnd, Camera camera) Returns the shortest distance between a Ray and a segment. The segment is defined by a start position and an end position in world space The distance returned will be in world space (world units). If the camera parameter is not null the distance will be returned in screen space (pixels)- Parameters:
ray
- The raysegStart
- The start position of the segment in world spacesegEnd
- The end position of the segment in world spacecamera
- The renderer camera if the distance is required in screen space. Null if the distance is required in world space- Returns:
- the shortest distance between the ray and the segment or -1 if no solution is found.
-