struct Prism::Maths::Quaternion

Defined in:

prism/maths/quanternion.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(x : Float64, y : Float64, z : Float64, w : Float64) #

[View source]
def self.new(axis : Vector3f, angle : Float32) #

[View source]
def self.new(rot : Matrix4f) #

[View source]

Class Method Detail

def self.from_euler(euler : Vector3f) #

Converts euler angles to Quaternion Angles are in radians!


[View source]
def self.lerp(qstart, qend : Quaternion, percent : Float64) #

[View source]
def self.nlerp(qstart, qend : Quaternion, percent : Float64) #

[View source]
def self.slerp(qstart, qend : Quaternion, percent : Float64) #

[View source]
def self.zero #

Zero vector


[View source]

Instance Method Detail

def !=(other : Quaternion) #

[View source]
def *(r : Quaternion) #

[View source]
def *(other : Vector3f) #

[View source]
def *(other : Float64) #

[View source]
def **(other : Quaternion) #

[View source]
def +(other : Quaternion) #

[View source]
def -(other : Quaternion) #

[View source]
def - #

[View source]
def ==(other : self) #

[View source]
def ==(r : Quaternion) : Bool #

[View source]
def angle : Float64 #

[View source]
def angle=(v : Float64) #

[View source]
def axis #

[View source]
def axis=(v : Vector3f) #

[View source]
def back #

[View source]
def clone #

[View source]
def conjugate #

[View source]
def dot(other : Quaternion) #

Dot product


[View source]
def down #

[View source]
def forward #

[View source]
def inverse #

[View source]
def left #

[View source]
def length : Float32 #

[View source]
def magnitude #

[View source]
def nlerp(dest : Quaternion, lerp_factor : Float64, shortest : Bool) : Quaternion #

Normalized linear interpolation.

This is technically cheaper than #slerp however it's usually negligable. For the most part you can choose whichever one looks best


[View source]
def norm #

[View source]
def normalize #

[View source]
def normalize! #

[View source]
def pure? #

[View source]
def right #

[View source]
def set(x : Float64, y : Float64, z : Float64, w : Float64) #

[View source]
def set(r : Quaternion) #

[View source]
def slerp(dest : Quaternion, lerp_factor : Float64, shortest : Bool) : Quaternion #

Spherical linear interpolation.

This gives a guaranteed linear movement whereas #nlerp does not. This is technically more expensive than #nlerp however it's usually negligable. For the most part you can choose whichever one looks best


[View source]
def to_euler #

[View source]
def to_rotation_matrix #

[View source]
def to_s #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]
def unit? #

[View source]
def up #

[View source]
def values #

[View source]
def w : Float64 #

[View source]
def x : Float64 #

[View source]
def y : Float64 #

[View source]
def z : Float64 #

[View source]