## Types in MathNet.Spatial.Euclidean

Type Quaternion

Namespace MathNet.Spatial.Euclidean

Parent ValueType

Interfaces IEquatable<Quaternion>, IFormattable

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

### 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

#### doubleChybyshevCosPoli(int n, double x)

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

an integer

a double

##### Return
###### `double`

the polynomial result

#### doubleChybyshevSinPoli(int n, double x)

Returns sin(n*x)

an integer

a double

##### Return
###### `double`

the polynomial result

#### doubleDistance(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

#### QuaternionConjugate()

Conjugate this quaternion.
##### Return
###### `Quaternion`

a new conjugated quaternion

#### boolEquals(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

#### QuaternionExp()

Exponential Function.

A new quaternion

#### QuaternionLog(double lbase)

Logarithm to a given base.

A base

A new quaternion

#### QuaternionLog()

Natural Logarithm to base E.

A new quaternion

#### QuaternionLog10()

Common Logarithm to base 10.

A new quaternion

#### QuaternionNegate()

Negate this quaternion.
##### Return
###### `Quaternion`

A new negated quaternion

#### QuaternionPow(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

A new quaternion

#### QuaternionPow(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

#### QuaternionPow(int power)

Raise the quaternion to a given power.
##### Parameters
###### `int` power

a number by which to raise the quaternion to

A new quaternion

#### QuaternionRotateRotationQuaternion(Quaternion rotation)

Rotates the provided rotation quaternion with this quaternion
##### Parameters
###### `Quaternion` rotation

The rotation quaternion to rotate

##### Return
###### `Quaternion`

A rotated quaternion

#### QuaternionRotateUnitQuaternion(Quaternion unitQuaternion)

Rotates the provided unit quaternion with this quaternion
##### Parameters
###### `Quaternion` unitQuaternion

The unit quaternion to rotate

##### Return
###### `Quaternion`

A rotated quaternion

#### QuaternionSqrt()

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

The square root of the quaternion

#### EulerAnglesToEulerAngles()

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.

An EulerAngle

#### stringToString()

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

a string representation of the quaternion

#### stringToString(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

#### doubleArg 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.

#### doubleImagX get;

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

#### doubleImagY get;

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

#### doubleImagZ get;

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

#### QuaternionInversed get;

Gets an inverted quaternion. Inversing Zero returns Zero

#### boolIsInfinity get;

Gets a value indicating whether the quaternion is not a number

#### boolIsNan get;

Gets a value indicating whether the quaternion is not a number

#### boolIsUnitQuaternion 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.

#### doubleNorm get;

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

#### QuaternionNormalized get;

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

#### QuaternionNormalizedVector 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.

#### doubleNormSquared get;

Gets the sum of the squares of the four components.

#### doubleReal get;

Gets the real part of the quaternion.

#### QuaternionScalar get;

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

#### QuaternionVector 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`