VisimBox 1.0 VisimBox 3d simulation and visualisation ToolBox

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties
VisiMath.Quaternion Struct Reference

Quaternion structure used for storing rotation data in 3D. More...

List of all members.

## Public Member Functions
| Quaternion (float x, float y, float z, float w)
| Quaternion (Vector3 xv, Vector3 yv, Vector3 zv)
| Quaternion (Matrix3 mat)
void | GetAxisAngle (out Vector3 axis, out float angle)
| Converts Quaternion to Axis and angle representation.
Matrix3 | GetRotationMatrix ()
| Returns rotational matrix3x3 (expects normalized quaternion)
Matrix4 | GetMatrix ()
| Returns transformation matrix.
Vector3 | GetRPY ()
| Converts quaternion to rotation in Roll-Pitch-Yaw format.
void | Normalize ()
| Normalizes quaternion;.
void | Multiply (ref Quaternion right)
Vector3 | Multiply (ref Vector3 right)
void | AddVector (ref Vector3 vec, float scale=1.0f)
| Rotates quaternion by scaled vector.
Quaternion | ClosestX ()
| Constraints rotation, returns closest quaternion for rotation limited around the x axis.
Quaternion | ClosestY ()
| Constraints rotation, returns closest quaternion for rotation limited around the Y axis.
Quaternion | ClosestZ ()
| Constraints rotation, returns closest quaternion for rotation limited around the Z axis.
Quaternion | ClosestSingleAxis (int axis)
| Constraints rotation, returns closest quaternion for rotation limited around single axis (0 =x, 1= y...)
Quaternion | ClosestXY ()
| Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then x axis.
Quaternion | ClosestYX ()
| Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Y axis.
Quaternion | ClosestXZ ()
| Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then X axis.
Quaternion | ClosestZX ()
| Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Z axis.
Quaternion | ClosestYZ ()
| Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then Y axis.
Quaternion | ClosestZY ()
| Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then Z axis.
override int | GetHashCode ()
override string | ToString ()
override bool | Equals (object obj)
bool | Equals (Quaternion other)
System.Xml.Schema.XmlSchema | GetSchema ()
| Reqired by IXMLserializable.
void | ReadXml (System.Xml.XmlReader reader)
| Deserializes object from XML.
void | WriteXml (System.Xml.XmlWriter writer)
| Serializes object to XML.
void | WriteXml (System.Xml.XmlWriter writer, string rootname)
| Serializes object to XML.
## Static Public Member Functions
static Quaternion | ClosestXY (Quaternion q)
| Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then x axis.
static Quaternion | ClosestYX (Quaternion q)
| Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Y axis.
static Quaternion | ClosestZX (Quaternion q)
| Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then X axis.
static Quaternion | ClosestXZ (Quaternion q)
| Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Z axis.
static Quaternion | ClosestYZ (Quaternion q)
| Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then Y axis.
static Quaternion | ClosestZY (Quaternion q)
| Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then Z axis.
static Quaternion | CreateFromMatrix (float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
| Creates quaternion from the rotational matrix. Note: may fail if rotational part contains scale / shearing etc.
static Quaternion | CreateFromMatrix (ref Matrix3 matrix)
| Creates quaternion from the rotational matrix. Note: may fail if rotational part contains scale / shearing etc.
static Quaternion | CreateFromMatrix (ref Matrix4 matrix)
| Creates quaternion from the rotational part of the matrix. Note: may fail if rotational part contains scale / shearing etc.
static Quaternion | CreateFromAxisAngle (ref Vector3 axis, float angle)
| Creates quaternion from the rotation around the axis.
static Quaternion | CreateFromAxisAngle (Vector3 axis, float angle)
| Creates quaternion from the rotation around the axis.
static Quaternion | CreateFromRPY (ref Vector3 rpy)
| Creates new Quaternion from the rotation in Roll Pitch Yaw format.
static Quaternion | LookAt (Vector3 dir, Vector3 up)
static Quaternion | CreateFromRPY (float roll, float pitch, float yaw)
static Quaternion | operator+ (Quaternion left, Quaternion right)
static Quaternion | operator- (Quaternion left, Quaternion right)
static Quaternion | operator* (Quaternion left, Quaternion right)
static Quaternion | operator* (Quaternion left, float scale)
static Quaternion | operator* (float scale, Quaternion left)
static Vector3 | operator* (Quaternion left, Vector3 right)
static bool | operator== (Quaternion left, Quaternion right)
static bool | operator!= (Quaternion left, Quaternion right)
## Public Attributes
Vector4 | vec
## Static Public Attributes
static Quaternion | Identity = new Quaternion(0, 0, 0, 1)
| Identity quaternion.
## Properties
float | X`[get, set]`
| Complex value 1.
float | Y`[get, set]`
| Complex value 2.
float | Z`[get, set]`
| Complex value 3.
float | W`[get, set]`
| Real value.
float | Length`[get]`
float | LengthSquared`[get]`

## Detailed Description

Quaternion structure used for storing rotation data in 3D.

## Constructor & Destructor Documentation

VisiMath.Quaternion.Quaternion | ( | float | x,
|  | float | y,
|  | float | z,
|  | float | w
| ) |  |

VisiMath.Quaternion.Quaternion | ( | Vector3 | xv,
|  | Vector3 | yv,
|  | Vector3 | zv
| ) |  |

VisiMath.Quaternion.Quaternion | ( | Matrix3 | mat | ) |

## Member Function Documentation

void VisiMath.Quaternion.AddVector | ( | ref Vector3 | vec,
|  | float | scale = `1.0f`
| ) |  |

Rotates quaternion by scaled vector.

Parameters:

  vec | Vector rotation
  scale | Scale

Quaternion VisiMath.Quaternion.ClosestSingleAxis | ( | int | axis | ) |

Constraints rotation, returns closest quaternion for rotation limited around single axis (0 =x, 1= y...)

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestX | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the x axis.

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.ClosestXY | ( | Quaternion | q | ) | `[static]`

Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then x axis.

Parameters:

  q | Original quaternion

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestXY | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then x axis.

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.ClosestXZ | ( | Quaternion | q | ) | `[static]`

Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Z axis.

Parameters:

  q | Original quaternion

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestXZ | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then X axis.

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestY | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the Y axis.

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.ClosestYX | ( | Quaternion | q | ) | `[static]`

Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Y axis.

Parameters:

  q | Original quaternion

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestYX | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Y axis.

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestYZ | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then Y axis.

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.ClosestYZ | ( | Quaternion | q | ) | `[static]`

Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then Y axis.

Parameters:

  q | Original quaternion

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestZ | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the Z axis.

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestZX | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the X axis and then Z axis.

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.ClosestZX | ( | Quaternion | q | ) | `[static]`

Constraints rotation, returns closest quaternion for rotation limited around the Z axis and then X axis.

Parameters:

  q | Original quaternion

Returns:
  Constrained quaternion

Quaternion VisiMath.Quaternion.ClosestZY | ( |  | ) |

Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then Z axis.

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.ClosestZY | ( | Quaternion | q | ) | `[static]`

Constraints rotation, returns closest quaternion for rotation limited around the Y axis and then Z axis.

Parameters:

  q | Original quaternion

Returns:
  Constrained quaternion

static Quaternion VisiMath.Quaternion.CreateFromAxisAngle | ( | ref Vector3 | axis,
|  | float | angle
| ) |  | `[static]`

Creates quaternion from the rotation around the axis.

Parameters:

  axis | Axis of rotation
  angle | Angle in radians

Returns:
  New quaternion

static Quaternion VisiMath.Quaternion.CreateFromAxisAngle | ( | Vector3 | axis,
|  | float | angle
| ) |  | `[static]`

Creates quaternion from the rotation around the axis.

Parameters:

  axis | Axis of rotation
  angle | Angle in radians

Returns:
  New quaternion

static Quaternion VisiMath.Quaternion.CreateFromMatrix | ( | float | m00,
|  | float | m01,
|  | float | m02,
|  | float | m10,
|  | float | m11,
|  | float | m12,
|  | float | m20,
|  | float | m21,
|  | float | m22
| ) |  | `[static]`

Creates quaternion from the rotational matrix. Note: may fail if rotational part contains scale / shearing etc.

Returns:
  new quaternion

static Quaternion VisiMath.Quaternion.CreateFromMatrix | ( | ref Matrix3 | matrix | ) | `[static]`

Creates quaternion from the rotational matrix. Note: may fail if rotational part contains scale / shearing etc.

Parameters:

  mat | source matrix

Returns:
  new quaternion

static Quaternion VisiMath.Quaternion.CreateFromMatrix | ( | ref Matrix4 | matrix | ) | `[static]`

Creates quaternion from the rotational part of the matrix. Note: may fail if rotational part contains scale / shearing etc.

Parameters:

  mat | source matrix

Returns:
  new quaternion

static Quaternion VisiMath.Quaternion.CreateFromRPY | ( | float | roll,
|  | float | pitch,
|  | float | yaw
| ) |  | `[static]`

static Quaternion VisiMath.Quaternion.CreateFromRPY | ( | ref Vector3 | rpy | ) | `[static]`

Creates new Quaternion from the rotation in Roll Pitch Yaw format.

Parameters:

  rpy | Rotation Vector x = roll, y = pitch, z = yaw

Returns:
  New quaternion

bool VisiMath.Quaternion.Equals | ( | Quaternion | other | ) |

override bool VisiMath.Quaternion.Equals | ( | object | obj | ) |

void VisiMath.Quaternion.GetAxisAngle | ( | out Vector3 | axis,
|  | out float | angle
| ) |  |

Converts Quaternion to Axis and angle representation.

Parameters:

  axis | Vector to store axis
  angle | float to store angle

override int VisiMath.Quaternion.GetHashCode | ( |  | ) |

Matrix4 VisiMath.Quaternion.GetMatrix | ( |  | ) |

Returns transformation matrix.

Returns:
  Rotational matrix

Matrix3 VisiMath.Quaternion.GetRotationMatrix | ( |  | ) |

Returns rotational matrix3x3 (expects normalized quaternion)

Returns:

Vector3 VisiMath.Quaternion.GetRPY | ( |  | ) |

Converts quaternion to rotation in Roll-Pitch-Yaw format.

Returns:
  RYP rotation

System.Xml.Schema.XmlSchema VisiMath.Quaternion.GetSchema | ( |  | ) |

Reqired by IXMLserializable.

Returns:
  Null

static Quaternion VisiMath.Quaternion.LookAt | ( | Vector3 | dir,
|  | Vector3 | up
| ) |  | `[static]`

void VisiMath.Quaternion.Multiply | ( | ref Quaternion | right | ) |

Vector3 VisiMath.Quaternion.Multiply | ( | ref Vector3 | right | ) |

void VisiMath.Quaternion.Normalize | ( |  | ) |

Normalizes quaternion;.

static bool VisiMath.Quaternion.operator!= | ( | Quaternion | left,
|  | Quaternion | right
| ) |  | `[static]`

static Vector3 VisiMath.Quaternion.operator* | ( | Quaternion | left,
|  | Vector3 | right
| ) |  | `[static]`

static Quaternion VisiMath.Quaternion.operator* | ( | Quaternion | left,
|  | Quaternion | right
| ) |  | `[static]`

static Quaternion VisiMath.Quaternion.operator* | ( | float | scale,
|  | Quaternion | left
| ) |  | `[static]`

static Quaternion VisiMath.Quaternion.operator* | ( | Quaternion | left,
|  | float | scale
| ) |  | `[static]`

static Quaternion VisiMath.Quaternion.operator+ | ( | Quaternion | left,
|  | Quaternion | right
| ) |  | `[static]`

static Quaternion VisiMath.Quaternion.operator- | ( | Quaternion | left,
|  | Quaternion | right
| ) |  | `[static]`

static bool VisiMath.Quaternion.operator== | ( | Quaternion | left,
|  | Quaternion | right
| ) |  | `[static]`

void VisiMath.Quaternion.ReadXml | ( | System.Xml.XmlReader | reader | ) |

Deserializes object from XML.

Parameters:

  reader | XML reader

override string VisiMath.Quaternion.ToString | ( |  | ) |

void VisiMath.Quaternion.WriteXml | ( | System.Xml.XmlWriter | writer,
|  | string | rootname
| ) |  |

Serializes object to XML.

Parameters:

  writer | XML writer to save values
  rootname | Node to save value

void VisiMath.Quaternion.WriteXml | ( | System.Xml.XmlWriter | writer | ) |

Serializes object to XML.

Parameters:

  writer | XML writer to save values

## Member Data Documentation

Quaternion VisiMath.Quaternion.Identity = new Quaternion(0, 0, 0, 1)`[static]`

Identity quaternion.

Vector4 VisiMath.Quaternion.vec

## Property Documentation

float VisiMath.Quaternion.Length`[get]`

float VisiMath.Quaternion.LengthSquared`[get]`

float VisiMath.Quaternion.W`[get, set]`

Real value.

float VisiMath.Quaternion.X`[get, set]`

Complex value 1.

float VisiMath.Quaternion.Y`[get, set]`

Complex value 2.

float VisiMath.Quaternion.Z`[get, set]`

Complex value 3.

The documentation for this struct was generated from the following file:

- Quaternion.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events