class Prism::Maths::Vector2f

Defined in:

prism/maths/vector2f.cr

Constructors

Instance Method Summary

Constructor Detail

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

[View source]

Instance Method Detail

def *(r : Float32) : Vector2f #

Multiplies the vector with a scalar


[View source]
def *(r : Vector2f) : Vector2f #

Multiplies two vectors


[View source]
def +(r : Vector2f) : Vector2f #

Adds two vectors


[View source]
def +(r : Float32) : Vector2f #

Adds a scalar value to the vector


[View source]
def -(r : Vector2f) : Vector2f #

Subtracts two vectors


[View source]
def -(r : Float32) : Vector2f #

Subtracts a scalar value from the vector


[View source]
def /(r : Float32) : Vector2f #

Divides the vector by a scalar


[View source]
def /(r : Vector2f) : Vector2f #

Divides two vectors


[View source]
def ==(r : Vector2f) : Bool #

[View source]
def abs : Vector2f #

[View source]
def cross(r : Vector2f) : Float32 #

[View source]
def dot(r : Vectorf2) : Float32 #

Returns the dot product of the vectors


[View source]
def length : Float32 #

Returns the length the vector (pythagorean theorem)


[View source]
def lerp(dest : Vector2f, lerp_factor : Float32) : Vector2f #

[View source]
def max #

Returns the maximum component size


[View source]
def rotate(angle : Float32) : Vector2f #

Rotates the vector by some angle in radians


[View source]
def set(x : Float32, y : Float32) #

[View source]
def set(r : Vector2f) #

[View source]
def to_normalized : Vector2f #

Normalizes this vector to a length of 1


[View source]
def to_s #
Description copied from class Object

Returns a string representation of this object.

Descendants must usually not override this method. Instead, they must override to_s(io), which must append to the given IO object.


[View source]
def x : Float32 #

[View source]
def x=(x) #

[View source]
def y : Float32 #

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

[View source]