Table of Contents

Struct Quaternions

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

A unit quaternions that defines rotation in 3D

public struct Quaternions : IEquatable<Quaternions>
Implements
Inherited Members

Constructors

Quaternions(double, double, double, double)

Create a quaternion with the specific values

public Quaternions(double w, double x, double y, double z)

Parameters

w double

The W component of the quaternion: the value for cos(rotation angle / 2)

x double

The X component of the vector: rotation axis * sin(rotation angle / 2)

y double

The Y component of the vector: rotation axis * sin(rotation angle / 2)

z double

The Z component of the vector: rotation axis * sin(rotation angle / 2)

Fields

Empty

Get the quaternions that represent a rotation of 0 degrees.

public static readonly Quaternions Empty

Field Value

Quaternions

Properties

AxisAngle

Get or set the equivalent axis angle representation. (x,y,z) is the rotation axis and |(x,y,z)| is the rotation angle in radians

public MCvPoint3D64f AxisAngle { get; set; }

Property Value

MCvPoint3D64f

RotationAngle

Get the rotation angle in radian

public double RotationAngle { get; }

Property Value

double

RotationAxis

Get the rotation axis of the quaternion

public MCvPoint3D64f RotationAxis { get; }

Property Value

MCvPoint3D64f

W

The W component of the quaternion: the value for cos(rotation angle / 2)

public double W { get; set; }

Property Value

double

X

The X component of the vector: rotation axis * sin(rotation angle / 2)

public double X { get; set; }

Property Value

double

Y

The Y component of the vector: rotation axis * sin(rotation angle / 2)

public double Y { get; set; }

Property Value

double

Z

The Z component of the vector: rotation axis * sin(rotation angle / 2)

public double Z { get; set; }

Property Value

double

Methods

Conjugate()

Compute the conjugate of the quaternions

public void Conjugate()

Equals(Quaternions)

Check if this quaternions equals to other

public bool Equals(Quaternions other)

Parameters

other Quaternions

The quaternions to be compared

Returns

bool

True if two quaternions equals, false otherwise

GetEuler(ref double, ref double, ref double)

Get the equivalent euler angle

public void GetEuler(ref double x, ref double y, ref double z)

Parameters

x double

Rotation around x-axis (roll) in radian

y double

Rotation around y-axis (pitch) in radian

z double

rotation around z-axis (yaw) in radian

GetRotationMatrix(Matrix<double>)

Fill the (3x3) rotation matrix with the value such that it represent the quaternions

public void GetRotationMatrix(Matrix<double> rotation)

Parameters

rotation Matrix<double>

The (3x3) rotation matrix which values will be set to represent this quaternions

Multiply(Quaternions)

Multiply the current Quaternions with quaternionsOther

public Quaternions Multiply(Quaternions quaternionsOther)

Parameters

quaternionsOther Quaternions

The other rotation

Returns

Quaternions

A composition of the two rotations

RotatePoint(MCvPoint3D64f)

Rotate the specific point and return the result

public MCvPoint3D64f RotatePoint(MCvPoint3D64f point)

Parameters

point MCvPoint3D64f

The point to be rotated

Returns

MCvPoint3D64f

The rotated point

RotatePoints(Matrix<double>, Matrix<double>)

Rotate the points in pointsSrc and save the result in pointsDst. In-place operation is supported (pointsSrc == pointsDst).

public void RotatePoints(Matrix<double> pointsSrc, Matrix<double> pointsDst)

Parameters

pointsSrc Matrix<double>

The points to be rotated

pointsDst Matrix<double>

The result of the rotation, should be the same size as pointsSrc, can be pointsSrc as well for inplace rotation

SetEuler(double, double, double)

Set the value of the quaternions using euler angle

public void SetEuler(double x, double y, double z)

Parameters

x double

Rotation around x-axis (roll) in radian

y double

Rotation around y-axis (pitch) in radian

z double

rotation around z-axis (yaw) in radian

Slerp(Quaternions, double)

Perform quaternions linear interpolation

public Quaternions Slerp(Quaternions quaternionsOther, double weightForOther)

Parameters

quaternionsOther Quaternions

The other quaternions to interpolate with

weightForOther double

If 0.0, the result is the same as this quaternions. If 1.0 the result is the same as quaternionsOther

Returns

Quaternions

The linear interpolated quaternions

ToString()

Get the string representation of the Quaternions

public override string ToString()

Returns

string

The string representation

Operators

operator *(Quaternions, Quaternions)

Computes the multiplication of two quaternions

public static Quaternions operator *(Quaternions q1, Quaternions q2)

Parameters

q1 Quaternions

The quaternions to be multiplied

q2 Quaternions

The quaternions to be multiplied

Returns

Quaternions

The multiplication of two quaternions