quat32

package
v0.0.0-...-e56f4fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2014 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package quat32 operates on float32 quaternions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Quaternion

type Quaternion [4]float32

A Quaternion holds a four-dimensional quaternion. The values are stored in {X, Y, Z, W} order.

func AxisAngle

func AxisAngle(axis vec32.Vector, angle float32) Quaternion

AxisAngle builds a new quaternion from a vector (which will be normalized) and an angle in radians.

func Mul

func Mul(q1, q2 Quaternion) Quaternion

Mul calculates the product of q1 and q2. The result corresponds to the rotation q2 followed by the rotation q1.

func (Quaternion) Conjugate

func (q Quaternion) Conjugate() Quaternion

Conjugate returns q's conjugate.

func (Quaternion) Length

func (q Quaternion) Length() float32

Length returns the norm of q.

func (Quaternion) LengthSqr

func (q Quaternion) LengthSqr() float32

LengthSqr returns the norm squared of q. This is cheaper to compute than Length.

func (Quaternion) Negate

func (q Quaternion) Negate() Quaternion

Negate returns a new quaternion that applies an opposite rotation.

func (Quaternion) Transform

func (q Quaternion) Transform(v vec32.Vector) vec32.Vector

Transform computes the rotation q for point v. Mathematically, this is the product of q, v, and q's conjugate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL