struct

PF2d::Vec4(T)

Inherits Comparable < PF2d::Vec < Struct < Value < Object

Constructors

new(x : T, y : T, z : T, w : T)
Source

Class methods

[](*args)

Creates a new Vec with the given args

PF2d::Vec[1, 2] # => PF2d::Vec2(Int32)(@x=1, @y=2)
Source

Instance methods

%(other : Vec4)

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

Source
%(n : Number)

Applies % to all component of this Vec with n

Source
%(other : Indexable)
Source
*(other : Vec4)

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

Source
*(n : Number)

Applies * to all component of this Vec with n

Source
*(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)
Source
*(other : Indexable)
Source
**(other : Vec4)

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

Source
**(n : Number)

Applies ** to all component of this Vec with n

Source
**(other : Indexable)
Source
+(other : Vec4)

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

Source
+(n : Number)

Applies + to all component of this Vec with n

Source
+(other : Indexable)
Source
-(other : Vec4)

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

Source
-(n : Number)

Applies - to all component of this Vec with n

Source
-(other : Indexable)
Source
-

Calls - on all components of this Vec

Source
/(other : Vec4)

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

Source
/(n : Number)

Applies / to all component of this Vec with n

Source
/(other : Indexable)
Source
//(other : Vec4)

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

Source
//(n : Number)

Applies // to all component of this Vec with n

Source
//(other : Indexable)
Source
<(n : Number)

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

Source
<=(n : Number)

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

Source
<=>(other : Vec4)

Compares each component against other.

Source
>(n : Number)

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

Source
>=(n : Number)

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

Source
abs

Calls abs on all components of this Vec

Source
ceil
Source
cross(other : Vec4)

Calculates the cross product of this Vec and other

Source
det(other : Vec2)

Determinant

Source
distance(other : Vec4)

Returns the distance between this Vec and other

Source
dot(other : Vec4)

Returns the dot product of this Vec and other

Source
floor
Source
magnitude

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

Source
normal(other : Vec4)

Returns normalized value at a normal to the current Vec

Source
normalized

Returns a new normalized unit Vec4

Source
round(precision = 0)
Source
round32(precision = 0)
Source
size

Returns the size of this Vec

PF2d::Vec4.new(...).size => 4
Source
sum

Add all components together

Source
to(type)
Source
to_a

Converts this Vec into a StaticArray(T, 4)

Source
to_f

Convert the components in this Vec to Float64

Source
to_f32

Convert the components in this Vec to Float32

Source
to_f64

Convert the components in this Vec to Float64

Source
to_i

Convert the components in this Vec to Int32

Source
to_i128

Convert the components in this Vec to Int128

Source
to_i16

Convert the components in this Vec to Int16

Source
to_i32

Convert the components in this Vec to Int32

Source
to_i64

Convert the components in this Vec to Int64

Source
to_i8

Convert the components in this Vec to Int8

Source
to_tuple
Source
to_u

Convert the components in this Vec to UInt32

Source
to_u128

Convert the components in this Vec to UInt128

Source
to_u16

Convert the components in this Vec to UInt16

Source
to_u32

Convert the components in this Vec to UInt32

Source
to_u64

Convert the components in this Vec to UInt64

Source
to_u8

Convert the components in this Vec to UInt8

Source
to_vec2
Source
w
w=(w : T)
x
x=(x : T)
y
y=(y : T)
z
z=(z : T)