struct

CrystalEdge::Vector2

Inherits Struct < Value < Object

Representation of 2D vector

Constructors

new(x : Float64, y : Float64)

Initializes vector with x and y

Source

Class methods

zero

Zero vector

Source

Instance methods

!=(other : Vector2)
Source
%(other : Vector2)

Alias for cross product

Source
*(other : Vector2)

Performs component multiplication (for dot product see #dot)

Source
*(other : Float64)

Performs multiplication

Source
**(other : Vector2)

Alias for dot product

Source
+(other : Vector2)

Performs component addition

Source
+(other : Float64)

Performs component addition

Source
-(other : Vector2)

Performs component subtraction

Source
-(other : Float64)

Performs component subtraction

Source
-

Returns negated vector

Source
/(other : Vector2)

Performs component division

Source
/(other : Float64)

Performs division

Source
==(other : Vector2)
Source
angle(other : Vector2)

Returns angle between two vectors

Source
angle

Returns direction of a vector

Source
clone

Clones this vector and passes it into a block if given

Source
clone

ditto

Source
cross(other : Vector2)

Returns cross product of two vectors

Source
distance(other : Vector2)

Finds distance between two vectors

Source
dot(other : Vector2)

Returns dot product of two vectors

Source
find_normal_axis(other : Vector2)

Finds normal axis between two vectors

Source
heading

ditto

Source
magnitude

Returns magnitude of this vector

Source
normalize

Non-aggressive version of #normalize!

Source
normalize!

Normalizes current vector

Source
to_s

Formats vector

Source
values

Converts vector to a tuple of values

Source
x=(x : Float64)
Source
y=(y : Float64)
Source
zero!

Fills current vector with zero

Source