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 : Vector2f) : Vector2f #

Multiplies two vectors


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

Multiplies the vector with a scalar


[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 : Vector2f) : Vector2f #

Divides two vectors


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

Divides the vector by a scalar


[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 nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]
def x : Float32 #

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

[View source]
def y : Float32 #

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

[View source]