org.ode4j.ode
Class DMisc

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
Direct Known Subclasses:
DMatrix

public class DMisc
extends org.ode4j.ode.internal.Common

Port of misc.h from ODE API.

Author:
Tilmann Zaeschke

Nested Class Summary
 
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
 
Constructor Summary
DMisc()
           
 
Method Summary
static void dClearUpperTriangle(DMatrix3 A)
          Clear the upper triangle of a square matrix.
static void dClearUpperTriangle(double[] A, int n)
          Clear the upper triangle of a square matrix.
static void dMakeRandomMatrix(DMatrix3 A, double range)
          Make a random matrix with entries between +/- range.
static void dMakeRandomMatrix(double[] A, int n, int m, double range)
          Make a random matrix with entries between +/- range.
static void dMakeRandomVector(double[] A, int n, double range)
          Make a random vector with entries between +/- range.
static void dMakeRandomVector(DQuaternion A, double range)
          Make a random vector with entries between +/- range.
static void dMakeRandomVector(DVector3 A, double range)
          Make a random vector with entries between +/- range.
static double dMaxDifference(DMatrix3C A, DMatrix3C B)
           
static double dMaxDifference(double[] A, double[] B, int n, int m)
           
static double dMaxDifference(DQuaternionC A, DQuaternionC B, int n, int m)
           
static double dMaxDifference(DVector3C A, DVector3C B)
           
static double dMaxDifferenceLowerTriangle(double[] A, double[] B, int n)
           
static java.lang.String dPrintMatrix(DMatrix3C A)
          Print out a matrix.
static long dRand()
           
static long dRandGetSeed()
          Get and set the current random number seed.
static int dRandInt(int n)
           
static double dRandReal()
           
static void dRandSetSeed(long s)
           
static boolean 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
 

Constructor Detail

DMisc

public DMisc()
Method Detail

dTestRand

public static boolean dTestRand()
Returns:
'true' if the random number generator is working.

dRand

public static long dRand()
Returns:
next 32 bit random number. this uses a not-very-random linear congruential method.

dRandGetSeed

public static long dRandGetSeed()
Get and set the current random number seed.


dRandSetSeed

public static void dRandSetSeed(long s)

dRandInt

public static int dRandInt(int n)
Returns:
a random integer between 0..n-1. the distribution will get worse as n approaches 2^32.

dRandReal

public static double dRandReal()
Returns:
a random real number between 0..1

dPrintMatrix

public static java.lang.String dPrintMatrix(DMatrix3C A)
Print out a matrix.


dMakeRandomVector

public static void dMakeRandomVector(DVector3 A,
                                     double range)
Make a random vector with entries between +/- range. A has n elements.


dMakeRandomVector

public static void dMakeRandomVector(DQuaternion A,
                                     double range)
Make a random vector with entries between +/- range. A has n elements.


dMakeRandomVector

public static void dMakeRandomVector(double[] A,
                                     int n,
                                     double range)
Make a random vector with entries between +/- range. A has n elements.


dMakeRandomMatrix

public static void dMakeRandomMatrix(DMatrix3 A,
                                     double range)
Make a random matrix with entries between +/- range. A has size n*m.


dMakeRandomMatrix

public static void dMakeRandomMatrix(double[] A,
                                     int n,
                                     int m,
                                     double range)
Make a random matrix with entries between +/- range. A has size n*m.


dClearUpperTriangle

public static void dClearUpperTriangle(DMatrix3 A)
Clear the upper triangle of a square matrix.


dClearUpperTriangle

public static void dClearUpperTriangle(double[] A,
                                       int n)
Clear the upper triangle of a square matrix.


dMaxDifference

public static double dMaxDifference(DMatrix3C A,
                                    DMatrix3C B)
Returns:
the maximum element difference between the two n*m matrices

dMaxDifference

public static double dMaxDifference(DVector3C A,
                                    DVector3C B)
Returns:
the maximum element difference between the two n*m matrices

dMaxDifference

public static double dMaxDifference(DQuaternionC A,
                                    DQuaternionC B,
                                    int n,
                                    int m)
Returns:
the maximum element difference between the two n*m matrices

dMaxDifference

public static double dMaxDifference(double[] A,
                                    double[] B,
                                    int n,
                                    int m)
Returns:
the maximum element difference between the two n*m matrices

dMaxDifferenceLowerTriangle

public static double dMaxDifferenceLowerTriangle(double[] A,
                                                 double[] B,
                                                 int n)
Returns:
the maximum element difference between the lower triangle of two n*n matrices