public class Quaternion
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private Matrix3f |
mat |
float |
q0 |
float |
q1 |
float |
q2 |
float |
q3 |
private static P4 |
qZero |
private static double |
RAD_PER_DEG |
Constructor and Description |
---|
Quaternion() |
Modifier and Type | Method and Description |
---|---|
Quaternion |
add(float x) |
Quaternion |
div(Quaternion p) |
static Quaternion[] |
div(Quaternion[] data1,
Quaternion[] data2,
int nMax,
boolean isRelative) |
Quaternion |
divLeft(Quaternion p) |
float |
dot(Quaternion q) |
java.lang.String |
draw(java.lang.String prefix,
java.lang.String id,
P3 ptCenter,
float scale) |
V3 |
get3dProjection(V3 v3d) |
float[] |
getEulerZXZ() |
float[] |
getEulerZYZ() |
private float |
getFixFactor()
ensures
1) q0 > 0
or
2) q0 = 0 and q1 > 0
or
3) q0 = 0 and q1 = 0 and q2 > 0
or
4) q0 = 0 and q1 = 0 and q2 = 0 and q3 > 0
|
java.lang.String |
getInfo() |
Matrix3f |
getMatrix() |
V3 |
getNormal() |
V3 |
getNormalDirected(V3 v0) |
static Quaternion |
getQuaternionFrame(P3 center,
Tuple3f x,
Tuple3f xy)
returns a quaternion frame based on three points (center, x, and any point in xy plane)
or two vectors (vA, vB).
|
static Quaternion |
getQuaternionFrameV(V3 vA,
V3 vB,
V3 vC,
boolean yBased) |
private static V3 |
getRawNormal(Quaternion q) |
float |
getTheta() |
P4 |
getThetaDirected(P4 axisAngle) |
float |
getThetaDirectedV(V3 vector) |
float |
getThetaRadians() |
V3 |
getVector(int i) |
private V3 |
getVectorS(int i,
float scale) |
Quaternion |
inv() |
Quaternion |
leftDifference(Quaternion q2) |
Quaternion |
mul(float x) |
Quaternion |
mulQ(Quaternion p) |
Quaternion |
negate() |
static Quaternion |
new4(float q0,
float q1,
float q2,
float q3) |
static Quaternion |
newAA(AxisAngle4f a) |
static Quaternion |
newM(Matrix3f mat) |
private static Quaternion |
newMean(Quaternion[] data,
Quaternion mean) |
static Quaternion |
newP4(P4 pt) |
static Quaternion |
newQ(Quaternion q) |
static Quaternion |
newVA(Tuple3f pt,
float theta) |
Quaternion |
rightDifference(Quaternion q2) |
void |
set(Quaternion q) |
void |
setAA(AxisAngle4f a) |
void |
setM(Matrix3f mat) |
private void |
setMatrix() |
private void |
setP4(P4 pt)
{x y z w} --> {q1 q2 q3 q0} and factored
|
void |
setRef(Quaternion qref) |
void |
setTA(Tuple3f pt,
float theta)
q = (cos(theta/2), sin(theta/2) * n)
|
private static Quaternion |
simpleAverage(Quaternion[] ndata)
Just a starting point.
|
static Quaternion |
sphereMean(Quaternion[] data,
float[] retStddev,
float criterion) |
private static float |
stdDev(Quaternion[] data,
Quaternion mean) |
AxisAngle4f |
toAxisAngle4f() |
P4 |
toPoint4f() |
java.lang.String |
toString()
Java axisAngle / plane / Point4f format
all have the format {x y z w}
so we go with that here as well
|
V3 |
transform(V3 v) |
void |
transformP2(Tuple3f pt,
Tuple3f ptNew) |
P3 |
transformPt(P3 pt) |
public float q0
public float q1
public float q2
public float q3
private Matrix3f mat
private static final P4 qZero
private static final double RAD_PER_DEG
public static Quaternion newQ(Quaternion q)
public static Quaternion newVA(Tuple3f pt, float theta)
public static Quaternion newM(Matrix3f mat)
public static Quaternion newAA(AxisAngle4f a)
public static Quaternion newP4(P4 pt)
public static Quaternion new4(float q0, float q1, float q2, float q3)
public void set(Quaternion q)
private void setP4(P4 pt)
pt
- public void setTA(Tuple3f pt, float theta)
pt
- theta
- public void setAA(AxisAngle4f a)
public void setM(Matrix3f mat)
public void setRef(Quaternion qref)
public static final Quaternion getQuaternionFrame(P3 center, Tuple3f x, Tuple3f xy)
center
- (null for vA/vB option)x
- xy
- public static final Quaternion getQuaternionFrameV(V3 vA, V3 vB, V3 vC, boolean yBased)
public Matrix3f getMatrix()
private void setMatrix()
public Quaternion add(float x)
public Quaternion mul(float x)
public Quaternion mulQ(Quaternion p)
public Quaternion div(Quaternion p)
public Quaternion divLeft(Quaternion p)
public float dot(Quaternion q)
public Quaternion inv()
public Quaternion negate()
private float getFixFactor()
public V3 getVector(int i)
private V3 getVectorS(int i, float scale)
public V3 getNormal()
private static V3 getRawNormal(Quaternion q)
public float getTheta()
public float getThetaRadians()
public V3 getNormalDirected(V3 v0)
v0
- public P4 getThetaDirected(P4 axisAngle)
axisAngle
- public float getThetaDirectedV(V3 vector)
vector
- a vector, same as for getNormalDirectedpublic P4 toPoint4f()
public AxisAngle4f toAxisAngle4f()
public Quaternion leftDifference(Quaternion q2)
public Quaternion rightDifference(Quaternion q2)
public java.lang.String getInfo()
public java.lang.String draw(java.lang.String prefix, java.lang.String id, P3 ptCenter, float scale)
public java.lang.String toString()
toString
in class java.lang.Object
public static Quaternion[] div(Quaternion[] data1, Quaternion[] data2, int nMax, boolean isRelative)
data1
- data2
- nMax
- > 0 --> limit to this numberisRelative
- public static Quaternion sphereMean(Quaternion[] data, float[] retStddev, float criterion)
private static Quaternion simpleAverage(Quaternion[] ndata)
ndata
- private static Quaternion newMean(Quaternion[] data, Quaternion mean)
private static float stdDev(Quaternion[] data, Quaternion mean)
data
- mean
- public float[] getEulerZYZ()
public float[] getEulerZXZ()