public class DualQuaternion
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_DIB_MAX_ITERS |
static double |
DEFAULT_DIB_TOLERANCE |
Constructor and Description |
---|
DualQuaternion()
Constructs the identity Dual Quaternion
|
DualQuaternion(double a,
Vector3d A,
double b,
Vector3d B)
Creates a dual quaternion with the supplied values
|
DualQuaternion(DualQuaternion d)
Creates a dual quaternion by copying an existing one
|
DualQuaternion(Quaternion qReal,
Quaternion qDual)
Creates a dual quaternion from two regular quaternions
|
DualQuaternion(RigidTransform3d A)
Creates a dual quaternion from a rigid transformation
|
Modifier and Type | Method and Description |
---|---|
void |
add(DualQuaternion q)
Adds the supplied dual quaternion to this
|
void |
add(DualQuaternion q1,
DualQuaternion q2)
Adds two dual quaternions and places the result in this
|
DualQuaternion |
clone()
Returns a copy of this dual quaternion
|
void |
conjugate()
Conjugates this
|
void |
conjugate(DualQuaternion q)
Conjugates q and places the result in this (a+A + e*(b+B))^* = a-A +
e*(b-B)
|
double |
dot(DualQuaternion q)
Dot product of this and supplied dual quaternion
|
static double |
dot(DualQuaternion q1,
DualQuaternion q2)
Dot product of the two supplied dual quaternions q1.a*q2.a + q1.A .
|
void |
dualQuaternionIterativeBlending(double[] w,
DualQuaternion[] q,
int numq)
Dual Quaternion Iterative Blending (DIB), which approximates ScLeRP and
applies to multiple inputs.
|
void |
dualQuaternionIterativeBlending(double[] w,
DualQuaternion[] q,
int numq,
double tol,
int maxIters)
Dual Quaternion Iterative Blending (DIB), which approximates ScLeRP and
applies to multiple inputs.
|
void |
dualQuaternionLinearBlending(double[] w,
DualQuaternion[] q,
int numq)
Dual Quaternion Linear Blending (DLB) of many dual quaternions.
|
void |
dualQuaternionLinearBlending(DualQuaternion q1,
double t,
DualQuaternion q2)
Dual Quaternion Linear Blending (DLB) of two dual quaternions q = (1-t)*q1
+ t*q2, with ||q|| = 1.
|
void |
exp(DualQuaternion q)
Performs the exponentiation to dual quaternion q, which must have a zero
scalar part.
|
void |
get(double[] vals)
Fills the 8-element vector of values
|
void |
get(DualQuaternion d)
Copies this dual quaternion to supplied d
|
double |
get(int idx)
Gets the value at the supplied index, 1-4 are real parameters,
5-7 are dual.
|
Quaternion |
getDual()
Gets the dual (translation) quaternion associated with this
|
void |
getDual(Quaternion q)
Gets the dual (translation) quaternion associated with this
|
Quaternion |
getReal()
Gets the real (rotation) quaternion associated with this
|
void |
getReal(Quaternion q)
Gets the real (rotation) quaternion associated with this
|
void |
getRigidTransform3d(RigidTransform3d trans)
Fills trans with the rigid transformation implied
by this dual quaternion
|
double |
getScrewParameters(Vector3d l,
Vector3d m,
double[] angles)
Extracts screw parameters from this dual quaternion
|
static double |
getScrewParameters(Vector3d l,
Vector3d m,
double[] angles,
DualQuaternion q)
Extracts screw parameters from the dual quaternion q
|
void |
inverseTransform(Point3d p)
Performs the inverse of the rigid transformation implied by this dual
quaternion to point p
|
static void |
inverseTransform(Point3d pr,
DualQuaternion q,
Point3d p)
Performs the inverse of the rigid transformation implied by the dual
quaternion q to point p and places the result in pr.
|
void |
inverseTransform(Point3d pr,
Point3d p)
Performs the inverse of the rigid transformation implied by this dual
quaternion to point p and places the result in pr.
|
void |
inverseTransform(Vector3d v)
Performs the inverse of the rotation implied by this dual quaternion to
vector v and places the result in vr.
|
static void |
inverseTransform(Vector3d vr,
DualQuaternion q,
Vector3d v)
Performs the inverse of the rotation implied by the dual quaternion q to
vector v and places the result in vr.
|
void |
inverseTransform(Vector3d vr,
Vector3d v)
Performs the inverse of the rotation implied by this dual quaternion to
vector v and places the result in vr.
|
void |
invert()
Inverts this dual quaternion s.t.
|
void |
invert(DualQuaternion q)
Computes the inverse qinv = q^(-1) s.t.
|
void |
log()
Performs the logarithm of this, which results in a zero scalar part.
|
void |
log(DualQuaternion q)
Performs the logarithm of q, which results in a zero scalar part, and
places the answer in this.
|
static void |
main(java.lang.String[] args) |
void |
mul(DualQuaternion q1,
DualQuaternion q2)
Multiplies two dual quaternions and places the result in this.
|
void |
mulLeft(DualQuaternion q)
Multiplies this on the left by the dual quaternion q
|
void |
mulRight(DualQuaternion q)
Multiplies this on the right by the dual quaternion q
|
DualScalar |
norm()
Computes the norm, which is a dual scalar
|
static DualScalar |
norm(DualQuaternion q)
Computes the norm of the supplied dual quaternion.
|
void |
normalize()
Normalizes this dual quaternion
|
void |
normalize(DualQuaternion q)
Normalizes the supplied dual quaternion and places the result in this
||result|| = 1 + e*0
|
DualScalar |
normSquared()
Computes the squared norm, which is a dual scalar
|
static DualScalar |
normSquared(DualQuaternion q)
Computes the squared norm of the supplied dual quaternion.
|
void |
pow(DualQuaternion q,
double e)
Raises the supplied quaternion to the power e according to euler's formula
and places the result in this.
|
void |
pow(DualQuaternion q,
DualScalar e)
Raises the supplied quaternion to the dual power e according to euler's
formula and places the result in this.
|
void |
scale(double s)
Scales this by the supplied value
|
void |
scale(double s,
DualQuaternion q)
Scales the dual quaternion q by s and places the result in this
|
void |
scale(DualScalar s)
Scales this by the supplied dual scalar
|
void |
scale(DualScalar s,
DualQuaternion q)
Scales q by the dual scalar s and places the result in this
|
void |
scaledAdd(double s,
DualQuaternion q)
Adds s*q1 to this
|
void |
scaledAdd(double s,
DualQuaternion q1,
DualQuaternion q2)
Computes the scaled addition s*q1+q2 and places the result in this
|
void |
scaledAdd(DualScalar s,
DualQuaternion q)
Adds s*q to this
|
void |
scaledAdd(DualScalar s,
DualQuaternion q1,
DualQuaternion q2)
Computes the scaled addition s*q1+q2 and places the result in this
|
void |
screwLinearInterpolate(DualQuaternion q1,
double t,
DualQuaternion q2)
Screw Linear Interpolation ScLERP between two dual quaternions t represent
the normalized distance between the two (t=0.5 is half-way), q =
q1*(q1^-1q2)^t.
|
void |
set(double[] vals)
Sets parameters based on the 8-element array of vals:
|
void |
set(double a,
Vector3d A,
double b,
Vector3d B)
Sets parameters according to supplied values
|
void |
set(DualQuaternion d)
Copies an existing dual quaternion
|
void |
set(int idx,
double val)
Sets the value at the supplied index, 1-4 are real parameters,
5-7 are dual.
|
void |
set(Quaternion qReal,
Quaternion qDual)
Sets values based on real and dual quaternions
|
void |
set(RigidTransform3d trans)
Sets the values of this dual quaternion to represent the supplied rigid
transformation
|
void |
setDual(Quaternion q)
Gets the dual (translational) quaternion associated with this
|
void |
setIdentity()
Sets to the identity dual quaternion 1 + 0e
|
void |
setReal(Quaternion q)
Sets the real (rotation) quaternion associated with this
|
void |
setScrewParameters(Vector3d l,
Vector3d m,
double theta,
double alpha)
Sets this quaternion based on screw parameters
|
void |
setZero()
Sets to the zero quaternion 0 + 0e
|
int |
size()
Number of entries = 8
|
void |
sub(DualQuaternion q)
Subtracts q from this
|
void |
sub(DualQuaternion q1,
DualQuaternion q2)
Computes q1-q2 and places the result in this
|
java.lang.String |
toString()
Converts to a string
|
java.lang.String |
toString(NumberFormat fmt) |
java.lang.String |
toString(java.lang.String fmtStr) |
void |
transform(Point3d p)
Performs the rigid transformation implied by this dual quaternion
|
static void |
transform(Point3d pr,
DualQuaternion q,
Point3d p)
Performs the rigid transformation implied by the dual quaternion q to
point p and places the result in pr.
|
void |
transform(Point3d pr,
Point3d p)
Performs the rigid transformation implied by this dual quaternion to point
p and places the result in pr.
|
void |
transform(Vector3d v)
Performs the rigid transformation implied by this dual quaternion
|
static void |
transform(Vector3d vr,
DualQuaternion q,
Vector3d v)
Performs the rigid transformation implied by q to vector v and places the
result in vr.
|
void |
transform(Vector3d vr,
Vector3d v)
Performs the rigid transformation implied by this dual quaternion to
vector v and places the result in vr.
|
public static double DEFAULT_DIB_TOLERANCE
public static int DEFAULT_DIB_MAX_ITERS
public DualQuaternion()
public DualQuaternion(double a, Vector3d A, double b, Vector3d B)
a
- scalar part of the real portionA
- vector part of the real portionb
- scalar part of the dual portionB
- vector part of the dual portionpublic DualQuaternion(DualQuaternion d)
public DualQuaternion(RigidTransform3d A)
public DualQuaternion(Quaternion qReal, Quaternion qDual)
qReal
- the "real" part, corresponding to the rotationqDual
- the "dual" part, corresponding to translationpublic void setIdentity()
public void setZero()
public void set(double a, Vector3d A, double b, Vector3d B)
a
- real scalarA
- real vectorb
- dual scalarB
- dual vectorpublic void set(double[] vals)
vals
- 0: real scalar 1-3: real vector 4: dual scalar 5-7: dual vectorpublic void get(double[] vals)
vals
- 0: real scalar 1-3: real vector 4: dual scalar 5-7: dual vectorpublic void set(DualQuaternion d)
public void get(DualQuaternion d)
public void set(RigidTransform3d trans)
public void set(Quaternion qReal, Quaternion qDual)
qReal
- the rotation partqDual
- the dual translation partpublic Quaternion getReal()
public Quaternion getDual()
public void getReal(Quaternion q)
public void getDual(Quaternion q)
public void setReal(Quaternion q)
public void setDual(Quaternion q)
public void getRigidTransform3d(RigidTransform3d trans)
public double get(int idx)
public void set(int idx, double val)
public void add(DualQuaternion q1, DualQuaternion q2)
public void add(DualQuaternion q)
public void scaledAdd(double s, DualQuaternion q1, DualQuaternion q2)
public void scaledAdd(double s, DualQuaternion q)
public void scaledAdd(DualScalar s, DualQuaternion q1, DualQuaternion q2)
public void scaledAdd(DualScalar s, DualQuaternion q)
public void sub(DualQuaternion q1, DualQuaternion q2)
public void sub(DualQuaternion q)
public void mul(DualQuaternion q1, DualQuaternion q2)
q1
- the left-hand dual quaternionq2
- the right-hand dual quaternionpublic void mulRight(DualQuaternion q)
public void mulLeft(DualQuaternion q)
public void conjugate(DualQuaternion q)
public void conjugate()
public static DualScalar normSquared(DualQuaternion q)
public static DualScalar norm(DualQuaternion q)
public DualScalar norm()
public DualScalar normSquared()
public void scale(DualScalar s, DualQuaternion q)
public void scale(double s, DualQuaternion q)
public void scale(DualScalar s)
public void scale(double s)
public void normalize(DualQuaternion q)
public void normalize()
public void invert(DualQuaternion q)
public void invert()
public static void transform(Vector3d vr, DualQuaternion q, Vector3d v)
vr
- resultq
- transformv
- inputpublic void transform(Vector3d vr, Vector3d v)
vr
- resultv
- inputpublic void transform(Vector3d v)
v
- vector to transformpublic static void transform(Point3d pr, DualQuaternion q, Point3d p)
pr
- resultq
- transformp
- inputpublic void transform(Point3d pr, Point3d p)
pr
- resultp
- inputpublic void transform(Point3d p)
p
- transformed vectorpublic static void inverseTransform(Point3d pr, DualQuaternion q, Point3d p)
pr
- resultq
- transform to invertp
- inputpublic void inverseTransform(Point3d pr, Point3d p)
pr
- resultp
- inputpublic void inverseTransform(Point3d p)
p
- inputpublic static void inverseTransform(Vector3d vr, DualQuaternion q, Vector3d v)
vr
- resultq
- transform to invertv
- inputpublic void inverseTransform(Vector3d vr, Vector3d v)
vr
- resultv
- inputpublic void inverseTransform(Vector3d v)
v
- input and resultpublic void pow(DualQuaternion q, double e)
public void pow(DualQuaternion q, DualScalar e)
public static double getScrewParameters(Vector3d l, Vector3d m, double[] angles, DualQuaternion q)
l
- the screw axism
- the moment vectorangles
- the dual angle angles[0] + e*angles[1]q
- input>
0 for
screw parameters to be reliablepublic double getScrewParameters(Vector3d l, Vector3d m, double[] angles)
l
- the screw axism
- the moment vectorangles
- the dual angle angles[0] + e*angles[1]>
0 for screw
parameters to be reliablepublic void setScrewParameters(Vector3d l, Vector3d m, double theta, double alpha)
l
- the screw axism
- the moment vectortheta
- the real part of the screw anglealpha
- the dual part of the screw angle (pitch)public void dualQuaternionLinearBlending(DualQuaternion q1, double t, DualQuaternion q2)
(q1.q2 > 0)
public void dualQuaternionLinearBlending(double[] w, DualQuaternion[] q, int numq)
w
- vector of weightsq
- vector of dual quaternionsnumq
- number of dual quaternionspublic void log(DualQuaternion q)
public void log()
public void exp(DualQuaternion q)
public void dualQuaternionIterativeBlending(double[] w, DualQuaternion[] q, int numq, double tol, int maxIters)
w
- array of weightsq
- quaternionsnumq
- number of quaternionstol
- convergence tolerancemaxIters
- max iterations (should be small, ~3)public void dualQuaternionIterativeBlending(double[] w, DualQuaternion[] q, int numq)
w
- array of weightsq
- quaternionsnumq
- number of quaternionspublic double dot(DualQuaternion q)
public static double dot(DualQuaternion q1, DualQuaternion q2)
public void screwLinearInterpolate(DualQuaternion q1, double t, DualQuaternion q2)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(NumberFormat fmt)
public java.lang.String toString(java.lang.String fmtStr)
public int size()
public DualQuaternion clone()
clone
in class java.lang.Object
public static void main(java.lang.String[] args)