Link Search Menu Expand Document

quaternion overview

A quaternion is a 4-component analog to complex numbers. Useful in a handful of cases like the effecient and safe rotation of a 3-dimensional vector

Added in v1.0.0


Table of contents


Aliases

add

Signature

export declare const add: (x: Quaternion, y: Quaternion) => Quaternion

Added in v1.0.0

div

Signature

export declare const div: (x: Quaternion, y: Quaternion) => Quaternion

Added in v1.0.0

mul

Signature

export declare const mul: (x: Quaternion, y: Quaternion) => Quaternion

Added in v1.0.0

sub

Signature

export declare const sub: (x: Quaternion, y: Quaternion) => Quaternion

Added in v1.0.0

Constructors

fromVector3

Signature

export declare const fromVector3: (v: V.Vec<3, number>) => Quaternion

Added in v1.0.0

fromVector4

Signature

export declare const fromVector4: (v: V.Vec<4, number>) => Quaternion

Added in v1.0.0

i

Signature

export declare const i: Quaternion

Added in v1.0.0

j

Signature

export declare const j: Quaternion

Added in v1.0.0

k

Signature

export declare const k: Quaternion

Added in v1.0.0

of

Signature

export declare const of: (a: number, b: number, c: number, d: number) => Quaternion

Added in v1.0.0

one

Signature

export declare const one: Quaternion

Added in v1.0.0

randQuaternion

Signature

export declare const randQuaternion: (min: number, max: number) => IO.IO<Quaternion>

Added in v1.0.0

scalar

Signature

export declare const scalar: (a: number) => Quaternion

Added in v1.0.0

zero

Signature

export declare const zero: Quaternion

Added in v1.0.0

Destructors

IsoVector4

Signature

export declare const IsoVector4: Iso.Iso<Quaternion, V.Vec<4, number>>

Added in v1.0.0

norm

Signature

export declare const norm: (q: Quaternion) => number

Added in v1.0.0

toVector3

Note: Disregards the real part of a quaternion

Signature

export declare const toVector3: (q: Quaternion) => V.Vec<3, number>

Added in v1.0.0

toVector4

Signature

export declare const toVector4: (q: Quaternion) => V.Vec<4, number>

Added in v1.0.0

Infix

$_

Signature

export declare const $_: (s: Inf.DivisionRingSymbol, x: Quaternion, y: Quaternion) => Quaternion

Added in v1.0.0

_

Signature

export declare const _: (a: Quaternion, s: Inf.DivisionRingSymbol, b: Quaternion) => Quaternion

Added in v1.0.0

_$

Signature

export declare const _$: (a: Quaternion, b: Quaternion, s: Inf.DivisionRingSymbol) => Quaternion

Added in v1.0.0

Instance Operations

recip

Signature

export declare const recip: (q: Quaternion) => Quaternion

Added in v1.0.0

rotateVector

Signature

export declare const rotateVector: (axis: V.Vec<3, number>, theta: number) => (v: V.Vec<3, number>) => V.Vec<3, number>

Added in v1.0.0

Instances

AdditiveAbelianGroup

Signature

export declare const AdditiveAbelianGroup: TC.AbelianGroup<Quaternion>

Added in v1.0.0

Bimodule

Signature

export declare const Bimodule: TC.Bimodule<Quaternion, number, number>

Added in v1.0.0

DivisionRing

Signature

export declare const DivisionRing: TC.DivisionRing<Quaternion>

Added in v1.0.0

Eq

Signature

export declare const Eq: Eq_.Eq<Quaternion>

Added in v1.0.0

MagmaSub

Signature

export declare const MagmaSub: Mg.Magma<Quaternion>

Added in v1.0.0

MonoidProduct

Signature

export declare const MonoidProduct: Mn.Monoid<Quaternion>

Added in v1.0.0

MonoidSum

Signature

export declare const MonoidSum: Mn.Monoid<Quaternion>

Added in v1.0.0

SemigroupProduct

Signature

export declare const SemigroupProduct: Sg.Semigroup<Quaternion>

Added in v1.0.0

SemigroupSum

Signature

export declare const SemigroupSum: Sg.Semigroup<Quaternion>

Added in v1.0.0

Show

Signature

export declare const Show: Sh.Show<Quaternion>

Added in v1.0.0

getRotationAutomorphism

Signature

export declare const getRotationAutomorphism: (
  axis: V.Vec<3, number>,
  theta: number
) => Auto.Automorphism<V.Vec<3, number>>

Added in v1.0.0

Model

Quaternion (interface)

Signature

export interface Quaternion {
  a: number
  b: number
  c: number
  d: number
}

Added in v1.0.0

Quaternion Ops

asUnit

Signature

export declare const asUnit: (q: Quaternion) => Quaternion

Added in v1.0.0

conj

Signature

export declare const conj: (q: Quaternion) => Quaternion

Added in v1.0.0

getRotationQuaternion

Signature

export declare const getRotationQuaternion: (axis: V.Vec<3, number>) => (theta: number) => Quaternion

Added in v1.0.0