Package com.jme3.math

Class MathUtils

java.lang.Object
com.jme3.math.MathUtils

public class MathUtils extends Object
Created by Nehon on 23/04/2017.
  • Method Details

    • log

      public static Quaternion log(Quaternion q, Quaternion store)
      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

      public static Quaternion exp(Quaternion q, Quaternion store)
      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

      public static Quaternion slerpNoInvert(Quaternion q1, Quaternion q2, float t, Quaternion store)
    • slerp

      public static Quaternion slerp(Quaternion q1, Quaternion q2, float t, Quaternion store)
      Interpolate between 2 quaternions using Slerp.
      Parameters:
      q1 - the desired value for t=0
      q2 - the desired value for t=1
      t - 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 ray
      segStart - The start position of the segment in world space
      segEnd - The end position of the segment in world space
      camera - 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.