Package javajs.util
Class Quat
java.lang.Object
javajs.util.Quat
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(float x) static Quat[]floatget3dProjection(V3 v3d) float[]float[]getNormalDirected(V3 v0) static final QuatgetQuaternionFrame(P3 center, T3 x, T3 xy) returns a quaternion frame based on three points (center, x, and any point in xy plane) or two vectors (vA, vB).static final QuatgetQuaternionFrameV(V3 vA, V3 vB, V3 vC, boolean yBased) Create a quaternion based on a framefloatgetTheta()getThetaDirected(P4 axisAngle) floatgetThetaDirectedV(V3 vector) floatgetVector(int i) getVectorScaled(int i, float scale) inv()leftDifference(Quat q2) mul(float x) negate()static Quatnew4(float q1, float q2, float q3, float q0) Note that q0 is the last parameter herestatic Quatstatic Quatstatic Quatstatic Quatstatic QuatrightDifference(Quat q2) voidvoidvoidvoidq = (cos(theta/2), sin(theta/2) * n)static QuatsphereMean(Quat[] data, float[] retStddev, float criterion) Quaternions are saved as {q1, q2, q3, q0} While this may seem odd, it is so that for any point4 -- planes, axisangles, and quaternions -- we can use the first three coordinates to determine the relavent axis the fourth then gives us offset to {0,0,0} (plane), rotation angle (axisangle), and cos(theta/2) (quaternion).toString()Java axisAngle / plane / Point4f format all have the format {x y z w} so we go with that here as welltransform2(T3 pt, T3 ptNew)
-
Field Details
-
q0
public float q0 -
q1
public float q1 -
q2
public float q2 -
q3
public float q3
-
-
Constructor Details
-
Quat
public Quat()
-
-
Method Details
-
newQ
-
newVA
-
newM
-
newAA
-
newP4
-
new4
Note that q0 is the last parameter here- Parameters:
q1-q2-q3-q0-- Returns:
- {q1 q2 q3 q0}
-
set
-
setTA
q = (cos(theta/2), sin(theta/2) * n)- Parameters:
pt-theta-
-
setAA
-
setRef
-
getQuaternionFrame
returns a quaternion frame based on three points (center, x, and any point in xy plane) or two vectors (vA, vB).- Parameters:
center- (null for vA/vB option)x-xy-- Returns:
- quaternion for frame
-
getQuaternionFrameV
Create a quaternion based on a frame- Parameters:
vA-vB-vC-yBased-- Returns:
- quaternion
-
getMatrix
-
add
-
mul
-
mulQ
-
divLeft
-
dot
-
inv
-
negate
-
getVector
-
getVectorScaled
-
getNormal
- Returns:
- vector such that 0 invalid input: '<'= angle invalid input: '<'= 180
-
getTheta
public float getTheta()- Returns:
- 0 invalid input: '<'= angle invalid input: '<'= 180 in degrees
-
getThetaRadians
public float getThetaRadians() -
getNormalDirected
- Parameters:
v0-- Returns:
- vector option closest to v0
-
get3dProjection
-
getThetaDirected
- Parameters:
axisAngle-- Returns:
- fill in theta of axisAngle such that
-
getThetaDirectedV
- Parameters:
vector- a vector, same as for getNormalDirected- Returns:
- return theta
-
toPoint4f
Quaternions are saved as {q1, q2, q3, q0} While this may seem odd, it is so that for any point4 -- planes, axisangles, and quaternions -- we can use the first three coordinates to determine the relavent axis the fourth then gives us offset to {0,0,0} (plane), rotation angle (axisangle), and cos(theta/2) (quaternion).- Returns:
- {x y z w} (unnormalized)
-
toAxisAngle4f
-
transform2
-
leftDifference
-
rightDifference
-
toString
Java axisAngle / plane / Point4f format all have the format {x y z w} so we go with that here as well -
div
-
arrayDiv
- Parameters:
data1-data2-nMax- > 0 --> limit to this numberisRelative-- Returns:
- pairwise array of data1 / data2 or data1 \ data2
-
sphereMean
-
getEulerZYZ
public float[] getEulerZYZ() -
getEulerZXZ
public float[] getEulerZXZ()
-