Namespaces

Types in MathNet.Spatial.Euclidean

Type Quaternion

Namespace MathNet.Spatial.Euclidean

Parent ValueType

Interfaces IEquatable<Quaternion>, IFormattable, IXmlSerializable

Quaternion Number
http://en.wikipedia.org/wiki/Quaternion http://mathworld.wolfram.com/Quaternion.html http://web.cs.iastate.edu/~cs577/handouts/quaternion.pdf http://www.lce.hut.fi/~ssarkka/pub/quat.pdf

Constructors

Static Functions

Methods

Properties

Fields

Public Constructors

Quaternion(DenseVector v)

Initializes a new instance of the Quaternion struct. Given a Vector (w,x,y,z), transforms it into a Quaternion = w+xi+yj+zk
Parameters
DenseVector v

The vector to transform into a Quaternion

Quaternion(double real, double imagX, double imagY, double imagZ)

Initializes a new instance of the Quaternion struct.
Parameters
double real

The rotation component of the Quaternion

double imagX

The X-value of the vector component of the Quaternion

double imagY

The Y-value of the vector component of the Quaternion

double imagZ

The Z-value of the vector component of the Quaternion

Public Static Functions

double ChybyshevCosPoli(int n, double x)

Returns cos(n*arccos(x)) = 2*Cos((n-1)arccos(x))cos(arccos(x)) - cos((n-2)*arccos(x))
Parameters
int n

an integer

double x

a double

Return
double

the polynomial result

double ChybyshevSinPoli(int n, double x)

Returns sin(n*x)
Parameters
int n

an integer

double x

a double

Return
double

the polynomial result

double Distance(Quaternion a, Quaternion b)

Returns the distance |a-b| of two quaternions, forming a metric space.
Parameters
Quaternion a

The first quaternion

Quaternion b

The second quaternion

Return
double

The distance between two quaternions.

Public Methods

Quaternion Conjugate()

Conjugate this quaternion.
Return
Quaternion

a new conjugated quaternion

bool Equals(object obj)

bool Equals(Quaternion other)

bool Equals(Quaternion other, double tolerance)

Returns a value to indicate if this vector is equivalent to a given unit vector
Parameters
Quaternion other

The unit vector to compare against.

double tolerance

A tolerance (epsilon) to adjust for floating point error

Return
bool

true if the vectors are equal; otherwise false

Quaternion Exp()

Exponential Function.
Return
Quaternion

A new quaternion

int GetHashCode()

Type GetType()

Quaternion Log(double lbase)

Logarithm to a given base.
Parameters
double lbase

A base

Return
Quaternion

A new quaternion

Quaternion Log()

Natural Logarithm to base E.
Return
Quaternion

A new quaternion

Quaternion Log10()

Common Logarithm to base 10.
Return
Quaternion

A new quaternion

Quaternion Negate()

Negate this quaternion.
Return
Quaternion

A new negated quaternion

Quaternion Pow(double power)

Raise the quaternion to a given power.
This algorithm is not very accurate and works only for normalized quaternions
Parameters
double power

a number by which to raise the quaternion to

Return
Quaternion

A new quaternion

Quaternion Pow(Quaternion power)

Raise the quaternion to a given power.
Parameters
Quaternion power

a quaternion to use as the power

Return
Quaternion

The quaternion raised to a power of another quaternion

Quaternion Pow(int power)

Raise the quaternion to a given power.
Parameters
int power

a number by which to raise the quaternion to

Return
Quaternion

A new quaternion

Quaternion RotateRotationQuaternion(Quaternion rotation)

Rotates the provided rotation quaternion with this quaternion
Parameters
Quaternion rotation

The rotation quaternion to rotate

Return
Quaternion

A rotated quaternion

Quaternion RotateUnitQuaternion(Quaternion unitQuaternion)

Rotates the provided unit quaternion with this quaternion
Parameters
Quaternion unitQuaternion

The unit quaternion to rotate

Return
Quaternion

A rotated quaternion

Quaternion Sqrt()

Square root of the Quaternion: q^(1/2).
Return
Quaternion

The square root of the quaternion

EulerAngles ToEulerAngles()

The quaternion expresses a relationship between two coordinate frames, A and B say. This relationship, if expressed using Euler angles, is as follows: 1) Rotate frame A about its z axis by angle gamma; 2) Rotate the resulting frame about its (new) y axis by angle beta; 3) Rotate the resulting frame about its (new) x axis by angle alpha, to arrive at frame B.
Return
EulerAngles

An EulerAngle

string ToString()

returns quaternion as real+ImagXi+ImagYj+ImagZk
Return
string

a string representation of the quaternion

string ToString(string format, IFormatProvider formatProvider)

returns quaternion as real+ImagXi+ImagYj+ImagZk based on format provided
Parameters
string format

A format string to pass to the format provider

IFormatProvider formatProvider

a format provider

Return
string

A string representation of the quaternion

Public Properties

double Arg get;

Gets the argument phi = arg(q) of the quaternion q, such that q = r*(cos(phi) + u*sin(phi)) = r*exp(phi*u) where r is the absolute and u the unit vector of q.

double ImagX get;

Gets the imaginary X part (coefficient of complex I) of the quaternion.

double ImagY get;

Gets the imaginary Y part (coefficient of complex J) of the quaternion.

double ImagZ get;

Gets the imaginary Z part (coefficient of complex K) of the quaternion.

Quaternion Inversed get;

Gets an inverted quaternion. Inversing Zero returns Zero

bool IsInfinity get;

Gets a value indicating whether the quaternion is not a number

bool IsNan get;

Gets a value indicating whether the quaternion is not a number

bool IsUnitQuaternion get;

Gets a value indicating whether the quaternion q has length |q| = 1.
To normalize a quaternion to a length of 1, use the Normalized method. All unit quaternions form a 3-sphere.

double Norm get;

Gets the norm of the quaternion q: square root of the sum of the squares of the four components.

Quaternion Normalized get;

Gets a new normalized Quaternion q with the direction of this quaternion.

Quaternion NormalizedVector get;

Gets a new normalized Quaternion u with the Vector part only, such that ||u|| = 1. Q may then be represented as q = r*(cos(phi) + u*sin(phi)) = r*exp(phi*u) where r is the absolute and phi the argument of q.

double NormSquared get;

Gets the sum of the squares of the four components.

double Real get;

Gets the real part of the quaternion.

Quaternion Scalar get;

Gets a new Quaternion q with the Scalar part only. If you need a Double, use the Real-Field instead.

Quaternion Vector get;

Gets a new Quaternion q with the Vector part only.

Public fields

Quaternion One

Neutral element for multiplication
return Quaternion

Quaternion Zero

Neutral element for sum
return Quaternion