struct CrystalEdge::Vector2

Overview

Representation of 2D vector

Defined in:

crystaledge/vector2.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

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

Initializes vector with #x and #y


[View source]

Class Method Detail

def self.zero #

Zero vector


[View source]

Instance Method Detail

def !=(other : Vector2) #

[View source]
def %(other : Vector2) #

Alias for cross product


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

Performs component multiplication (for dot product see #dot)


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

Performs multiplication


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

Alias for dot product


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

Performs component addition


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

Performs component addition


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

Performs component subtraction


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

Performs component subtraction


[View source]
def - #

Returns negated vector


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

Performs component division


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

Performs division


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

[View source]
def angle(other : Vector2) #

Returns angle between two vectors


[View source]
def angle #

Returns direction of a vector


[View source]
def clone #

Clones this vector and passes it into a block if given


[View source]
def clone(&b) #

ditto


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

Returns cross product of two vectors


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

Finds distance between two vectors


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

Returns dot product of two vectors


[View source]
def find_normal_axis(other : Vector2) #

Finds normal axis between two vectors


[View source]
def heading #

ditto


[View source]
def magnitude #

Returns magnitude of this vector


[View source]
def normalize #

Non-aggressive version of #normalize!


[View source]
def normalize! #

Normalizes current vector


[View source]
def to_s #

Formats vector


[View source]
def values #

Converts vector to a tuple of values


[View source]
def x : Float64 #

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

[View source]
def y : Float64 #

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

[View source]
def zero! #

Fills current vector with zero


[View source]