struct

LA::AVector2

Inherits Struct < Value < Object

Constants

COMPONENTS = [:x, :y]

Constructors

new(x : Float64, y : Float64)
new(default : Float64 = 0.0)

Class methods

one
x

Generate some utility constants like Vector3::Y => Vector3(0.0, 1.0, 0.0)

y
zero

Instance methods

*(other : Float64)
+(other : self)
-(other : self)
-
/(other : Float64)
dot(other : self)
length
normalize

If the vector has just one component precalculating the inverse would not improve the performance TODO: validate if precalculating is faster for 2 components

squared_length
x
x=(x : Float64)
y
y=(y : Float64)