org.ode4j.ode
Class OdeMath

java.lang.Object
  extended by org.ode4j.ode.OdeConstants
      extended by org.ode4j.ode.internal.ErrorHandler
          extended by org.ode4j.ode.internal.Common
              extended by org.ode4j.ode.DMisc
                  extended by org.ode4j.ode.DMatrix
                      extended by org.ode4j.ode.DRotation
                          extended by org.ode4j.ode.OdeMath

public class OdeMath
extends DRotation

ODE math functions.

Author:
Tilmann Zaeschke

Nested Class Summary
static class OdeMath.OP
          Deprecated. 
 
Nested classes/interfaces inherited from class org.ode4j.ode.internal.Common
org.ode4j.ode.internal.Common.DMatrix4
 
Nested classes/interfaces inherited from class org.ode4j.ode.internal.ErrorHandler
org.ode4j.ode.internal.ErrorHandler.dMessageFunction
 
Field Summary
 
Fields inherited from class org.ode4j.ode.internal.Common
d_ERR_IASSERT, d_ERR_LCP, d_ERR_UASSERT, d_ERR_UNKNOWN, d_MEMORY_OK, d_MEMORY_OUT_OF_MEMORY, dATOMICS_ENABLED, DBL_EPSILON, dDOUBLE, dEpsilon, dNODEBUG, dSINGLE, dTLS_ENABLED, dTRIMESH_16BIT_INDICES, dTRIMESH_ENABLED, dTRIMESH_GIMPACT, dTRIMESH_OPCODE, dTRIMESH_OPCODE_USE_OLD_TRIMESH_TRIMESH_COLLIDER, dUSE_MALLOC_FOR_ALLOCA, M_PI, M_SQRT1_2, MAX_FLOAT
 
Fields inherited from class org.ode4j.ode.OdeConstants
CONTACTS_UNIMPORTANT, dAllocateMaskAll, dContactApprox0, dContactApprox1, dContactApprox1_1, dContactApprox1_2, dContactBounce, dContactFDir1, dContactMotion1, dContactMotion2, dContactMotionN, dContactMu2, dContactSlip1, dContactSlip2, dContactSoftCFM, dContactSoftERP, dInfinity
 
Method Summary
static void dAddScaledVectors3(DVector3 res, DVector3C a, DVector3C b, double a_scale, double b_scale)
           
static void dAddVectorCross3(DVector3 a, DVector3C b, DVector3C c)
          Cross product, set a += b x c.
static double dCalcPointsDistance3(DVector3C a, DVector3C b)
          Deprecated.  
static void dCalcVectorCross3(double[] a, int ofs, DVector3C b, DVector3C c)
          Cross product, set a = b x c.
static void dCalcVectorCross3(DVector3 a, DVector3C b, DVector3C c)
          Cross product, set a = b x c.
static void dCalcVectorCross3(DVector3View a, DVector3View b, DVector3View c)
           
static double dCalcVectorDot3_14(double[] a, int o1, double[] b, int o2)
           
static double dCalcVectorDot3_14(DVector3C a, DMatrix3C b, int o2)
           
static double dCalcVectorDot3_14(DVector3C a, double[] b, int o2)
           
static double dCalcVectorDot3_41(DMatrix3C a, int o1, DVector3C b)
           
static double dCalcVectorDot3_44(DMatrix3C a, int o1, DMatrix3C b, int o2)
           
static double dCalcVectorDot3(double[] a, double[] b)
           
static double dCalcVectorDot3(double[] a, int o1, double[] b, int o2)
           
static double dCalcVectorDot3(double[] a, int o1, DVector3C b)
           
static double dCalcVectorDot3(DVector3C a, double[] b, int o2)
           
static double dCalcVectorDot3(DVector3C a, DVector3C b)
          Instead, please use a.dot(b).
static void dCopyNegatedVector3(double[] a, int ofs, DVector3C b)
           
static void dCopyVector3(double[] a, int ofs, DVector3C b)
           
static void dCopyVector3(float[] a, int ofs, DVector3C b)
           
static void dCROSS(DVector3 a, OdeMath.OP op, DVector3C b, DVector3C c)
          Deprecated. Use dCalcVetorCross3, dAddVectorCross3 or dSubtractVectorCross3.
static void dCROSSMAT(DMatrix3 A, DVector3C a, int skip, int plus, int minus)
          Deprecated.  
static void dCROSSMAT(double[] A, int ofs, DVector3C a, int skip, int plus, int minus)
          Deprecated.  
static double dDISTANCE(DVector3C a, DVector3C b)
          Deprecated. 
static double dDOT(DVector3C a, DVector3C b)
          Deprecated. 
static void dMultiply0_133(double[] A, int a, double[] B, int b, double[] C, int c)
           
static void dMULTIPLY0_133(double[] A, int a, double[] B, int b, double[] C, int c)
          Deprecated. 
static void dMultiply0_133(DVector3 A, DVector3C B, DMatrix3C C)
           
static void dMULTIPLY0_133(DVector3 A, DVector3C B, DMatrix3C C)
          Deprecated. 
static void dMultiply0_331(DMatrix3 A, DMatrix3C B, DVector3C C)
           
static void dMULTIPLY0_331(DMatrix3 A, DMatrix3C B, DVector3C C)
          Deprecated. 
static void dMultiply0_331(double[] A, int a, double[] B, int b, double[] C, int c)
           
static void dMULTIPLY0_331(double[] A, int a, double[] B, int b, double[] C, int c)
          Deprecated. 
static void dMultiply0_331(double[] A, int a, double[] B, int b, DVector3C C)
           
static void dMULTIPLY0_331(double[] A, int a, double[] B, int b, DVector3C C)
          Deprecated. 
static void dMultiply0_331(DVector3 A, DMatrix3C B, double[] C, int c)
           
static void dMULTIPLY0_331(DVector3 A, DMatrix3C B, double[] C, int c)
          Deprecated. 
static void dMultiply0_331(DVector3 A, DMatrix3C B, DVector3C C)
           
static void dMULTIPLY0_331(DVector3 A, DMatrix3C B, DVector3C C)
          Deprecated. 
static void dMultiply0_333(DMatrix3 A, DMatrix3C B, DMatrix3C C)
           
static void dMULTIPLY0_333(DMatrix3 A, DMatrix3C B, DMatrix3C C)
          Deprecated. 
static void dMultiply0_333(double[] A, int a, DMatrix3C B, DMatrix3C C)
           
static void dMULTIPLY0_333(double[] A, int a, DMatrix3C B, DMatrix3C C)
          Deprecated. 
static void dMultiply1_331(DVector3 A, DMatrix3C B, DVector3C C)
           
static void dMULTIPLY1_331(DVector3 A, DMatrix3C B, DVector3C C)
          Deprecated. 
static void dMultiply1_333(DMatrix3 A, DMatrix3C B, DMatrix3C C)
           
static void dMULTIPLY1_333(DMatrix3 A, DMatrix3C B, DMatrix3C C)
          Deprecated. 
static void dMultiply2_333(DMatrix3 A, DMatrix3C B, DMatrix3C C)
           
static void dMULTIPLY2_333(DMatrix3 A, DMatrix3C B, DMatrix3C C)
          Deprecated. 
static void dMultiplyAdd0_331(DVector3 A, double[] B, int b, double[] C, int c)
           
static void dMULTIPLYADD0_331(DVector3 A, double[] B, int b, double[] C, int c)
          Deprecated. 
static void dMultiplyAdd0_331(DVector3 A, double[] B, int b, DVector3C C)
           
static void dMULTIPLYADD0_331(DVector3 A, double[] B, int b, DVector3C C)
          Deprecated. 
static void dNegateVector3(double[] a, int ofs)
           
static void dNormalize3(DVector3 a)
          normalize 3x1 vectors (i.e.
static void dNormalize4(DQuaternion a)
          Potentially asserts on zero vec.
static void dNormalize4(DVector4 a)
          Potentially asserts on zero vec.
static void dOrthogonalizeR(DMatrix3 m)
          This takes what is supposed to be a rotation matrix, and make sure it is correct.
static void dPlaneSpace(DVector3C n, DVector3 p, DVector3 q)
          Given a unit length "normal" vector n, generate vectors p and q vectors that are an orthonormal basis for the plane space perpendicular to n.
static boolean dSafeNormalize3(DVector3 a)
          Normalize 3x1 vectors (i.e.
static boolean dSafeNormalize3(DVector3View a)
          Normalize 3x1 vectors (i.e.
static boolean dSafeNormalize4(DVector4 a)
           
static void dSetCrossMatrixMinus(DMatrix3 A, DVector3C a)
          Set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
static void dSetCrossMatrixMinus(double[] A, int ofs, DVector3C a, int skip)
          Set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
static void dSetCrossMatrixPlus(DMatrix3 A, DVector3C a)
          Set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
static void dSetCrossMatrixPlus(double[] A, int ofs, DVector3C a, int skip)
          set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
static void dSubtractVectorCross3(DVector3 a, DVector3C b, DMatrix3C c)
           
static void dSubtractVectorCross3(DVector3 a, DVector3C b, DVector3C c)
          Cross product, set a -= b x c.
 
Methods inherited from class org.ode4j.ode.DRotation
dQFromAxisAndAngle, dQfromR, dQMultiply0, dQMultiply1, dQMultiply2, dQMultiply3, dRFromAxisAndAngle, dRFromAxisAndAngle, dRFromEulerAngles, dRfromQ, dRFromZAxis, dRSetIdentity
 
Methods inherited from class org.ode4j.ode.DMatrix
dFactorCholesky, dFactorCholesky, dFactorLDLT, dInvertPDMatrix, dInvertPDMatrix, dIsPositiveDefinite, dIsPositiveDefinite, dLDLTAddTL, dLDLTRemove, dMultiply0, dMultiply0, dMultiply0, dMultiply0, dMultiply1, dMultiply1, dMultiply1, dMultiply2, dMultiply2, dMultiply2, dRemoveRowCol, dSetValue, dSetZero, dSolveCholesky, dSolveCholesky, dSolveLDLT, dVectorScale
 
Methods inherited from class org.ode4j.ode.DMisc
dClearUpperTriangle, dClearUpperTriangle, dMakeRandomMatrix, dMakeRandomMatrix, dMakeRandomVector, dMakeRandomVector, dMakeRandomVector, dMaxDifference, dMaxDifference, dMaxDifference, dMaxDifference, dMaxDifferenceLowerTriangle, dPrintMatrix, dRand, dRandGetSeed, dRandInt, dRandReal, dRandSetSeed, dTestRand
 
Methods inherited from class org.ode4j.ode.internal.Common
dAASSERT, dAASSERT, dAtan2, dCeil, dCopysign, dCopySign, dCos, dDEBUGMSG, dFabs, dFloor, dFMod, dIASSERT, dIsNan, dIVERIFY, dNextAfter, dPAD, dRecip, dRecipSqrt, dSin, dSqrt, dUASSERT
 
Methods inherited from class org.ode4j.ode.internal.ErrorHandler
dDebug, dError, dGetDebugHandler, dGetErrorHandler, dGetMessageHandler, dMessage, dSetDebugHandler, dSetErrorHandler, dSetMessageHandler
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dAddScaledVectors3

public static void dAddScaledVectors3(DVector3 res,
                                      DVector3C a,
                                      DVector3C b,
                                      double a_scale,
                                      double b_scale)

dNegateVector3

public static void dNegateVector3(double[] a,
                                  int ofs)

dCopyVector3

public static void dCopyVector3(double[] a,
                                int ofs,
                                DVector3C b)

dCopyVector3

public static void dCopyVector3(float[] a,
                                int ofs,
                                DVector3C b)

dCopyNegatedVector3

public static void dCopyNegatedVector3(double[] a,
                                       int ofs,
                                       DVector3C b)

dDOT

@Deprecated
public static double dDOT(DVector3C a,
                                     DVector3C b)
Deprecated. 


dCalcVectorDot3

public static double dCalcVectorDot3(DVector3C a,
                                     DVector3C b)
Instead, please use a.dot(b).

Parameters:
a -
b -
Returns:
dot product

dCalcVectorDot3

public static double dCalcVectorDot3(double[] a,
                                     int o1,
                                     DVector3C b)

dCalcVectorDot3

public static double dCalcVectorDot3(DVector3C a,
                                     double[] b,
                                     int o2)

dCalcVectorDot3

public static double dCalcVectorDot3(double[] a,
                                     double[] b)

dCalcVectorDot3

public static double dCalcVectorDot3(double[] a,
                                     int o1,
                                     double[] b,
                                     int o2)

dCalcVectorDot3_14

public static double dCalcVectorDot3_14(DVector3C a,
                                        DMatrix3C b,
                                        int o2)

dCalcVectorDot3_41

public static double dCalcVectorDot3_41(DMatrix3C a,
                                        int o1,
                                        DVector3C b)

dCalcVectorDot3_44

public static double dCalcVectorDot3_44(DMatrix3C a,
                                        int o1,
                                        DMatrix3C b,
                                        int o2)

dCalcVectorDot3_14

public static double dCalcVectorDot3_14(double[] a,
                                        int o1,
                                        double[] b,
                                        int o2)

dCalcVectorDot3_14

public static double dCalcVectorDot3_14(DVector3C a,
                                        double[] b,
                                        int o2)

dCROSS

public static void dCROSS(DVector3 a,
                          OdeMath.OP op,
                          DVector3C b,
                          DVector3C c)
Deprecated. Use dCalcVetorCross3, dAddVectorCross3 or dSubtractVectorCross3.


dCalcVectorCross3

public static void dCalcVectorCross3(DVector3 a,
                                     DVector3C b,
                                     DVector3C c)
Cross product, set a = b x c.


dAddVectorCross3

public static void dAddVectorCross3(DVector3 a,
                                    DVector3C b,
                                    DVector3C c)
Cross product, set a += b x c.


dSubtractVectorCross3

public static void dSubtractVectorCross3(DVector3 a,
                                         DVector3C b,
                                         DVector3C c)
Cross product, set a -= b x c.


dCalcVectorCross3

public static void dCalcVectorCross3(double[] a,
                                     int ofs,
                                     DVector3C b,
                                     DVector3C c)
Cross product, set a = b x c.


dCalcVectorCross3

public static void dCalcVectorCross3(DVector3View a,
                                     DVector3View b,
                                     DVector3View c)

dSubtractVectorCross3

public static void dSubtractVectorCross3(DVector3 a,
                                         DVector3C b,
                                         DMatrix3C c)

dSetCrossMatrixPlus

public static void dSetCrossMatrixPlus(DMatrix3 A,
                                       DVector3C a)
Set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b. The matrix is assumed to be already zero, so this does not write zero elements! A positive version will be written.


dSetCrossMatrixMinus

public static void dSetCrossMatrixMinus(DMatrix3 A,
                                        DVector3C a)
Set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b. The matrix is assumed to be already zero, so this does not write zero elements! A negative version will be written.


dSetCrossMatrixPlus

public static void dSetCrossMatrixPlus(double[] A,
                                       int ofs,
                                       DVector3C a,
                                       int skip)
set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b. A is stored by rows, and has `skip' elements per row. the matrix is assumed to be already zero, so this does not write zero elements! A positive version will be written.


dSetCrossMatrixMinus

public static void dSetCrossMatrixMinus(double[] A,
                                        int ofs,
                                        DVector3C a,
                                        int skip)
Set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b. A is stored by rows, and has `skip' elements per row. the matrix is assumed to be already zero, so this does not write zero elements! A negative version will be written.


dCROSSMAT

public static void dCROSSMAT(DMatrix3 A,
                             DVector3C a,
                             int skip,
                             int plus,
                             int minus)
Deprecated. 

For +1/-1 use dSetCrossMatrixPlus(), for -1/+1 use dSetCrossMatrixMinus().


dCROSSMAT

public static void dCROSSMAT(double[] A,
                             int ofs,
                             DVector3C a,
                             int skip,
                             int plus,
                             int minus)
Deprecated. 

For +1/-1 use dSetCrossMatrixPlus(), for -1/+1 use dSetCrossMatrixMinus().


dCalcPointsDistance3

public static double dCalcPointsDistance3(DVector3C a,
                                          DVector3C b)
Deprecated. 

Compute the distance between two 3D-vectors. Please use a.distance(b) instead.

Parameters:
a -
b -
Returns:
distance

dDISTANCE

@Deprecated
public static double dDISTANCE(DVector3C a,
                                          DVector3C b)
Deprecated. 

Compute the distance between two 3D-vectors.

Parameters:
a -
b -
Returns:
distance

dMultiply0_331

public static void dMultiply0_331(DVector3 A,
                                  DMatrix3C B,
                                  DVector3C C)

dMultiply0_331

public static void dMultiply0_331(DMatrix3 A,
                                  DMatrix3C B,
                                  DVector3C C)

dMultiply0_331

public static void dMultiply0_331(DVector3 A,
                                  DMatrix3C B,
                                  double[] C,
                                  int c)

dMultiply0_331

public static void dMultiply0_331(double[] A,
                                  int a,
                                  double[] B,
                                  int b,
                                  DVector3C C)

dMultiply0_331

public static void dMultiply0_331(double[] A,
                                  int a,
                                  double[] B,
                                  int b,
                                  double[] C,
                                  int c)

dMULTIPLY0_331

@Deprecated
public static void dMULTIPLY0_331(DVector3 A,
                                             DMatrix3C B,
                                             DVector3C C)
Deprecated. 


dMULTIPLY0_331

@Deprecated
public static void dMULTIPLY0_331(DMatrix3 A,
                                             DMatrix3C B,
                                             DVector3C C)
Deprecated. 


dMULTIPLY0_331

@Deprecated
public static void dMULTIPLY0_331(DVector3 A,
                                             DMatrix3C B,
                                             double[] C,
                                             int c)
Deprecated. 


dMULTIPLY0_331

@Deprecated
public static void dMULTIPLY0_331(double[] A,
                                             int a,
                                             double[] B,
                                             int b,
                                             DVector3C C)
Deprecated. 


dMULTIPLY0_331

@Deprecated
public static void dMULTIPLY0_331(double[] A,
                                             int a,
                                             double[] B,
                                             int b,
                                             double[] C,
                                             int c)
Deprecated. 


dMultiply1_331

public static void dMultiply1_331(DVector3 A,
                                  DMatrix3C B,
                                  DVector3C C)

dMultiply0_133

public static void dMultiply0_133(DVector3 A,
                                  DVector3C B,
                                  DMatrix3C C)

dMultiply0_133

public static void dMultiply0_133(double[] A,
                                  int a,
                                  double[] B,
                                  int b,
                                  double[] C,
                                  int c)

dMultiply0_333

public static void dMultiply0_333(DMatrix3 A,
                                  DMatrix3C B,
                                  DMatrix3C C)

dMultiply0_333

public static void dMultiply0_333(double[] A,
                                  int a,
                                  DMatrix3C B,
                                  DMatrix3C C)

dMULTIPLY1_331

@Deprecated
public static void dMULTIPLY1_331(DVector3 A,
                                             DMatrix3C B,
                                             DVector3C C)
Deprecated. 


dMULTIPLY0_133

@Deprecated
public static void dMULTIPLY0_133(DVector3 A,
                                             DVector3C B,
                                             DMatrix3C C)
Deprecated. 


dMULTIPLY0_133

@Deprecated
public static void dMULTIPLY0_133(double[] A,
                                             int a,
                                             double[] B,
                                             int b,
                                             double[] C,
                                             int c)
Deprecated. 


dMULTIPLY0_333

@Deprecated
public static void dMULTIPLY0_333(DMatrix3 A,
                                             DMatrix3C B,
                                             DMatrix3C C)
Deprecated. 


dMULTIPLY0_333

@Deprecated
public static void dMULTIPLY0_333(double[] A,
                                             int a,
                                             DMatrix3C B,
                                             DMatrix3C C)
Deprecated. 


dMultiply1_333

public static void dMultiply1_333(DMatrix3 A,
                                  DMatrix3C B,
                                  DMatrix3C C)

dMultiply2_333

public static void dMultiply2_333(DMatrix3 A,
                                  DMatrix3C B,
                                  DMatrix3C C)

dMULTIPLY1_333

@Deprecated
public static void dMULTIPLY1_333(DMatrix3 A,
                                             DMatrix3C B,
                                             DMatrix3C C)
Deprecated. 


dMULTIPLY2_333

@Deprecated
public static void dMULTIPLY2_333(DMatrix3 A,
                                             DMatrix3C B,
                                             DMatrix3C C)
Deprecated. 


dMultiplyAdd0_331

public static void dMultiplyAdd0_331(DVector3 A,
                                     double[] B,
                                     int b,
                                     DVector3C C)

dMultiplyAdd0_331

public static void dMultiplyAdd0_331(DVector3 A,
                                     double[] B,
                                     int b,
                                     double[] C,
                                     int c)

dMULTIPLYADD0_331

@Deprecated
public static void dMULTIPLYADD0_331(DVector3 A,
                                                double[] B,
                                                int b,
                                                DVector3C C)
Deprecated. 


dMULTIPLYADD0_331

@Deprecated
public static void dMULTIPLYADD0_331(DVector3 A,
                                                double[] B,
                                                int b,
                                                double[] C,
                                                int c)
Deprecated. 


dSafeNormalize3

public static boolean dSafeNormalize3(DVector3 a)
Normalize 3x1 vectors (i.e. scale them to unit length).


dSafeNormalize3

public static boolean dSafeNormalize3(DVector3View a)
Normalize 3x1 vectors (i.e. scale them to unit length).


dNormalize3

public static void dNormalize3(DVector3 a)
normalize 3x1 vectors (i.e. scale them to unit length). Potentially asserts on zero vec.


dSafeNormalize4

public static boolean dSafeNormalize4(DVector4 a)

dNormalize4

public static void dNormalize4(DVector4 a)
Potentially asserts on zero vec.


dNormalize4

public static void dNormalize4(DQuaternion a)
Potentially asserts on zero vec.


dPlaneSpace

public static void dPlaneSpace(DVector3C n,
                               DVector3 p,
                               DVector3 q)
Given a unit length "normal" vector n, generate vectors p and q vectors that are an orthonormal basis for the plane space perpendicular to n. i.e. this makes p,q such that n,p,q are all perpendicular to each other. q will equal n x p. if n is not unit length then p will be unit length but q wont be.


dOrthogonalizeR

public static void dOrthogonalizeR(DMatrix3 m)
This takes what is supposed to be a rotation matrix, and make sure it is correct. Note: this operates on rows, not columns, because for rotations both ways give equivalent results.