struct CG2d::Vec(T)

Defined in:

cg2d/vec.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

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

[View source]

Macro Detail

macro [](*args) #

[View source]

Instance Method Detail

def %(other : Vec) #

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


[View source]
def %(n : Int | Float) #

Applies % to all component of this vector with n


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

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


[View source]
def *(n : Int | Float) #

Applies #* to all component of this vector with n


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

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


[View source]
def **(n : Int | Float) #

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


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

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


[View source]
def +(n : Int | Float) #

Applies #+ to all component of this vector with n


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

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


[View source]
def -(n : Int | Float) #

Applies #- to all component of this vector with n


[View source]
def - #

Calls #- on all components of this vector


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

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


[View source]
def /(n : Int | Float) #

Applies #/ to all component of this vector with n


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

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


[View source]
def //(n : Int | Float) #

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


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

Tests if all components of each vector meet the < condition


[View source]
def <(n : Int | Float) #

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


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

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


[View source]
def <=(n : Int | Float) #

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


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

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


[View source]
def ==(n : Int | Float) #

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


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

Tests if all components of each vector meet the > condition


[View source]
def >(n : Int | Float) #

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


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

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


[View source]
def >=(n : Int | Float) #

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


[View source]
def abs #

Calls #abs on all components of this vector


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

Calculates the cross product of this vector and other


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

Returns the distance between this vector and other


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

Returns the dot product of this vector and other


[View source]
def magnitude #

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


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

Returns normalized value at a normal to the current vector


[View source]
def normalized #

Returns a new normalized unit Vector{{i}}


[View source]
def rotated(theta) #

Return a new Vec(T) rotated by theta in radians


[View source]
def round(n = 0) #

[View source]
def sum #

Add all components together


[View source]
def to_f #

Convert the components in this vector to Float64


[View source]
def to_f32 #

Convert the components in this vector to Float32


[View source]
def to_f64 #

Convert the components in this vector to Float64


[View source]
def to_i #

Convert the components in this vector to Int32


[View source]
def to_i128 #

Convert the components in this vector to Int128


[View source]
def to_i16 #

Convert the components in this vector to Int16


[View source]
def to_i32 #

Convert the components in this vector to Int32


[View source]
def to_i64 #

Convert the components in this vector to Int64


[View source]
def to_i8 #

Convert the components in this vector to Int8


[View source]
def to_u #

Convert the components in this vector to UInt32


[View source]
def to_u128 #

Convert the components in this vector to UInt128


[View source]
def to_u16 #

Convert the components in this vector to UInt16


[View source]
def to_u32 #

Convert the components in this vector to UInt32


[View source]
def to_u64 #

Convert the components in this vector to UInt64


[View source]
def to_u8 #

Convert the components in this vector to UInt8


[View source]
def x : T #

[View source]
def x=(x : T) #

[View source]
def y : T #

[View source]
def y=(y : T) #

[View source]