struct PF2d::Vec3(T)

Defined in:

pf2d/vec.cr

Constructors

Instance Method Summary

Instance methods inherited from struct PF2d::Vec

initialize initialize

Constructor methods inherited from struct PF2d::Vec

new new

Class methods inherited from struct PF2d::Vec

from_angle(degrees : Number) from_angle, from_radians(radians : Float64) from_radians

Macros inherited from struct PF2d::Vec

[](*args) []

Constructor Detail

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

[View source]

Instance Method Detail

def %(other : Vec3) #

Applies % to all component of this Vec with the corresponding component of other


[View source]
def %(n : Number) #

Applies % to all component of this Vec with n


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

Applies #* to all component of this Vec with the corresponding component of other


[View source]
def *(n : Number) #

Applies #* to all component of this Vec with n


[View source]
def *(matrix : Matrix) #

Multiply this Vec by a matrix

v = PF2d::Vec[1, 2, 3]
m = PF::Matrix[
  1, 0, 0,
  0, 2, 0,
  0, 0, 1,
]
# => PF2d::Vec3(Int32)(@x=1, @y=4, @z=3)

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

Applies #** to all component of this Vec with the corresponding component of other


[View source]
def **(n : Number) #

Applies #** to all component of this Vec with n


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

Applies #+ to all component of this Vec with the corresponding component of other


[View source]
def +(n : Number) #

Applies #+ to all component of this Vec with n


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

Applies #- to all component of this Vec with the corresponding component of other


[View source]
def -(n : Number) #

Applies #- to all component of this Vec with n


[View source]
def - #

Calls #- on all components of this Vec


[View source]
def /(other : Vec3) #

Applies #/ to all component of this Vec with the corresponding component of other


[View source]
def /(n : Number) #

Applies #/ to all component of this Vec with n


[View source]
def //(other : Vec3) #

Applies #// to all component of this Vec with the corresponding component of other


[View source]
def //(n : Number) #

Applies #// to all component of this Vec with n


[View source]
def <(other : Vec3) #

Tests if all components of each Vec meet the < condition


[View source]
def <(n : Number) #

Tests if all components of this Vec meet the < condition with the given n


[View source]
def <=(other : Vec3) #

Tests if all components of each Vec meet the <= condition


[View source]
def <=(n : Number) #

Tests if all components of this Vec meet the <= condition with the given n


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

Tests if all components of each Vec meet the #== condition


[View source]
def ==(n : Number) #

Tests if all components of this Vec meet the #== condition with the given n


[View source]
def >(other : Vec3) #

Tests if all components of each Vec meet the > condition


[View source]
def >(n : Number) #

Tests if all components of this Vec meet the > condition with the given n


[View source]
def >=(other : Vec3) #

Tests if all components of each Vec meet the >= condition


[View source]
def >=(n : Number) #

Tests if all components of this Vec meet the >= condition with the given n


[View source]
def abs #

Calls #abs on all components of this Vec


[View source]
def cross(other : Vec3) #

Calculates the cross product of this Vec and other


[View source]
def distance(other : Vec3) #

Returns the distance between this Vec and other


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

Returns the dot product of this Vec and other


[View source]
def magnitude #

The length or magnitude of the Vec calculated by the Pythagorean theorem


[View source]
def map(&) #

[View source]
def normal(other : Vec3) #

Returns normalized value at a normal to the current Vec


[View source]
def normalized #

Returns a new normalized unit Vec3


[View source]
def size #

Returns the size of this Vec

PF2d::Vec3.new(...).size => 3

[View source]
def sum #

Add all components together


[View source]
def to_a #

Converts this Vec into a StaticArray(T, 3)


[View source]
def to_f #

Convert the components in this Vec to Float64


[View source]
def to_f32 #

Convert the components in this Vec to Float32


[View source]
def to_f64 #

Convert the components in this Vec to Float64


[View source]
def to_i #

Convert the components in this Vec to Int32


[View source]
def to_i128 #

Convert the components in this Vec to Int128


[View source]
def to_i16 #

Convert the components in this Vec to Int16


[View source]
def to_i32 #

Convert the components in this Vec to Int32


[View source]
def to_i64 #

Convert the components in this Vec to Int64


[View source]
def to_i8 #

Convert the components in this Vec to Int8


[View source]
def to_u #

Convert the components in this Vec to UInt32


[View source]
def to_u128 #

Convert the components in this Vec to UInt128


[View source]
def to_u16 #

Convert the components in this Vec to UInt16


[View source]
def to_u32 #

Convert the components in this Vec to UInt32


[View source]
def to_u64 #

Convert the components in this Vec to UInt64


[View source]
def to_u8 #

Convert the components in this Vec to UInt8


[View source]
def to_vec2 #

[View source]
def x : T #

def x=(x : T) #

def y : T #

def y=(y : T) #

def z : T #

def z=(z : T) #