# HQuat

## Content

HQuat | operator*

## Fields

float | `x`
float | `y`
float | `z`
float | `w`

## Functions

HQuat const & | `Normalize`
| `HQuat`
| `HQuat`
| `HQuat`
| `HQuat`
void | `Set`
HQuat | `operator*`
HQuat | `operator*`
HQuat | `operator/`
HQuat | `operator-`
HQuat | `operator+`
void | `ToMatrix`
HQuat | `Qlog`
HQuat | `Qexp`
HQuat | `Qlerp`
HQuat | `Qslerp`
HQuat | `QslerpNoInvert`
HQuat | `QslerpNoInvertExtraSpins`
HQuat | `Qsquad`
HQuat | `Qspline`
HQuat | `MatrixToQuaternion`

## Detailed Description

class `HQuat`

  The HQuat class defines the data type of a Quaternion.

  The HQuat class encapsulates the x,y,x,w values used to define a quaternion as well as various functions to perform algebrahic operations on quaternions

  Public Functions

  HQuat const &`Normalize`()

    normalizes an HQuat

  inline `HQuat`()

    default constructor

  inline `HQuat`(float X, float Y, float Z, float W)

    constructor that accepts three floats

  inline `HQuat`(HQuat const *p)

    constructor that accepts a pointer to an HQuat object

  inline `HQuat`(HQuat const &p)

    constructor that accepts an HQuat reference

  inline void `Set`(float X, float Y, float Z, float W)

    Set packs an HQuat object with coordinate values.

  inline HQuat `operator*`(HQuat const &q2) const

    Multiplies two quaternions

    Parameters: | q2 – Quaternion to multiply with
    Returns: | Result of multiplication

  inline HQuat `operator*`(float v) const

    Multiplies a quaternion with a float value

    Parameters: | v – Value to multiply Quaternion with
    Returns: | Result of multiplication

  inline HQuat `operator/`(float v) const

    Divides a quaternion by a float value

    Parameters: | v – Value to divide Quaternion by
    Returns: | Result of multiplication

  inline HQuat `operator-`(HQuat const &q2) const

    Subtracts one quaternion from another

    Parameters: | q2 – Quaternion to subtract with
    Returns: | Result of subtraction

  inline HQuat `operator+`(HQuat const &q2) const

    Add one quaternion to another

    Parameters: | q2 – Quaternion to add
    Returns: | Result of addition

  void `ToMatrix`(float matrix[16])

    Convert Quaternion to matrix form

    Parameters: | matrix – Returns result matrix

  Public Members

  float `x`

    Quaternion x Coordinate

  float `y`

    Quaternion y Coordinate

  float `z`

    Quaternion z Coordinate

  float `w`

    Quaternion w Coordinate

  Public Static Functions

  static HQuat `Qlog`(HQuat const &q)

    Logarithm of a HQuat, given as: Qlog(q) = v*a where q = [cos(a),v*sin(a)]

    Parameters: | q – Quaternion to perform log on
    Returns: | Result of logarithm

  static HQuat `Qexp`(HQuat const &q)

    Qexp(v*a) = [cos(a),vsin(a)]

    Parameters: | q – Quaternion to perform exp on
    Returns: | Result of Exp

  static HQuat `Qlerp`(HQuat const &q1, HQuat const &q2, float fraction)

    Linear interpolation between two HQuats

    Parameters: | q1 – First Quaternion for Interpolation q2 – Second Quaternion for Interpolation fraction – Interpolation Distance (0 - 1)
    Returns: | Result of interplation

  static HQuat `Qslerp`(HQuat const &q1, HQuat const &q2, float fraction)

    Spherical interpolation between two HQuats

    Parameters: | q1 – First Quaternion for Interpolation q2 – Second Quaternion for Interpolation fraction – Interpolation Distance (0 - 1)
    Returns: | Result of interplation

  static HQuat `QslerpNoInvert`(HQuat const &q1, HQuat const &q2, float fraction)

    Spherical interpolation between two HQuats This version of slerp, used by squad, does not check for theta > 90.

    Parameters: | q1 – First Quaternion for Interpolation q2 – Second Quaternion for Interpolation fraction – Interpolation Distance (0 - 1)
    Returns: | Result of interplation

  static HQuat `QslerpNoInvertExtraSpins`(HQuat const &q1, HQuat const &q2, float fraction, int ExtraSpins)

    Spherical interpolation between two HQuats This version of slerp, used by squad, does not check for theta > 90.

    Parameters: | q1 – First Quaternion for Interpolation q2 – Second Quaternion for Interpolation fraction – Interpolation Distance (0 - 1)
    Returns: | Result of interplation

  static HQuat `Qsquad`(HQuat const &q1, HQuat const &q2, HQuat const &a, HQuat const &b, float fraction)

    Spherical cubic interpolation between two HQuats

    Parameters: | q1 – First Quaternion for Interpolation q2 – Second Quaternion for Interpolation a – First Control Point b – Second Control Point fraction – Interpolation Distance (0 - 1)
    Returns: | Result of interplation

  static HQuat `Qspline`(HQuat const &qnm1, HQuat const &qn, HQuat const &qnp1)

    Given 3 HQuats, qn-1,qn and qn+1, calculate a control point to be used in spline interpolation

    Parameters: | qnm1 – qn-1 control point qn – qn control point qnp1 – qn + 1 control point
    Returns: | Result of interplation

  static HQuat `MatrixToQuaternion`(float matrix[])

    Convert matrix to quaternion

    Returns: | converted quaternion

  Friends

  inline friend HQuat `operator*`(float v, HQuat const &q)

    Multiplies a quaternion with a float value

    Parameters: | v – Value to multiply Quaternion with q – Quaternion to multiply with
    Returns: | Result of multiplication

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your Docs generative AI assistant. Ask me anything about HOOPS Visualize 3DF or choose a sample question below to start a conversation:

What is HOOPS Visualize 3DF?
What are the latest release notes for HOOPS Visualize 3DF?
How do I start evaluating HOOPS Visualize 3DF?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...