public class UnitQuaternions extends Object
Quat4d Class from
vecmath to represent the unit quaternions, and it also implements some of the
basic methods that the library is missing.
A Unit Quaternion is a four-dimensional vector used to describe a three-dimensional attitude representation (axis and angle of rotation). By definition, unit quaternions are always normalized, so their length is always 1.
| Modifier and Type | Method and Description |
|---|---|
static double |
dotProduct(javax.vecmath.Quat4d q1,
javax.vecmath.Quat4d q2)
Compute the dot (inner) product of two quaternions.
|
static javax.vecmath.Quat4d |
orientation(javax.vecmath.Point3d[] points)
The orientation represents the rotation of the principal axes with
respect to the axes of the coordinate system (unit vectors [1,0,0],
[0,1,0] and [0,0,1]).
|
static double |
orientationMetric(javax.vecmath.Point3d[] a,
javax.vecmath.Point3d[] b)
The orientation metric is obtained by comparing the quaternion
orientations of two sets of points in 3D.
|
static double |
orientationMetric(javax.vecmath.Quat4d q1,
javax.vecmath.Quat4d q2)
The orientation metric is obtained by comparing two unit quaternion
orientations.
|
static javax.vecmath.Quat4d |
relativeOrientation(javax.vecmath.Point3d[] a,
javax.vecmath.Point3d[] b)
Calculate the relative quaternion orientation of two arrays of points.
|
public static double orientationMetric(javax.vecmath.Point3d[] a,
javax.vecmath.Point3d[] b)
First, the quaternion orientation of each set of points is calculated
using their principal axes with orientation(Point3d[]). Then,
the two quaternions are compared using the method
orientationMetric(Quat4d, Quat4d).
a - array of Point3db - array of Point3dpublic static double orientationMetric(javax.vecmath.Quat4d q1,
javax.vecmath.Quat4d q2)
The two quaternions are compared using the formula: d(q1,q2) = arccos(|q1*q2|). The range of the metric is [0, Pi/2], where 0 means the same orientation and Pi/2 means the opposite orientation.
The formula is taken from: Huynh, D. Q. (2009). Metrics for 3D rotations: comparison and analysis. Journal of Mathematical Imaging and Vision, 35(2), 155–164. http://doi.org/10.1007/s10851-009-0161-2
q1 - quaternion as Quat4d objectq2 - quaternion as Quat4d objectpublic static javax.vecmath.Quat4d orientation(javax.vecmath.Point3d[] points)
The orientation can be expressed as a unit quaternion.
points - array of Point3dpublic static javax.vecmath.Quat4d relativeOrientation(javax.vecmath.Point3d[] a,
javax.vecmath.Point3d[] b)
a - point arrayb - point arraypublic static double dotProduct(javax.vecmath.Quat4d q1,
javax.vecmath.Quat4d q2)
q1 - quaternion as Quat4d objectq2 - quaternion as Quat4d objectCopyright © 2000–2016 BioJava. All rights reserved.