Package com.marginallyclever.ro3.physics
Class ODE4JHelper
java.lang.Object
com.marginallyclever.ro3.physics.ODE4JHelper
Shared methods for working with ODE4J physics.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic javax.vecmath.Matrix4d
convertODEtoMatrix
(org.ode4j.math.DVector3C translation, org.ode4j.math.DMatrix3C rotation) Convert an ODE4J translation/rotation pair to a Java3D matrix.static org.ode4j.math.DMatrix3C
convertRotationToODE
(javax.vecmath.Matrix4d mat) receive a 4x4 matrix.static javax.vecmath.Vector3d
jsonToVector3
(org.json.JSONObject vector) static org.json.JSONObject
vector3ToJSON
(javax.vecmath.Vector3d vector) static double
volumeBox
(double x, double y, double z) static double
volumeCapsule
(double radius, double length) static double
volumeCylinder
(double radius, double length) static double
volumeSphere
(double radius)
-
Constructor Details
-
ODE4JHelper
public ODE4JHelper()
-
-
Method Details
-
convertODEtoMatrix
public static javax.vecmath.Matrix4d convertODEtoMatrix(org.ode4j.math.DVector3C translation, org.ode4j.math.DMatrix3C rotation) Convert an ODE4J translation/rotation pair to a Java3D matrix.- Parameters:
translation
- the translation component.rotation
- the rotation matrix- Returns:
- the Java3D matrix.
-
convertRotationToODE
public static org.ode4j.math.DMatrix3C convertRotationToODE(javax.vecmath.Matrix4d mat) receive a 4x4 matrix. extract the rotation component and store it in a DMatrix3C.- Parameters:
mat
- the 4x4 matrix.- Returns:
- the rotation component as a 3x3 matrix.
-
volumeCylinder
public static double volumeCylinder(double radius, double length) -
volumeCapsule
public static double volumeCapsule(double radius, double length) -
volumeBox
public static double volumeBox(double x, double y, double z) -
volumeSphere
public static double volumeSphere(double radius) -
vector3ToJSON
public static org.json.JSONObject vector3ToJSON(javax.vecmath.Vector3d vector) -
jsonToVector3
public static javax.vecmath.Vector3d jsonToVector3(org.json.JSONObject vector)
-