std.geom.Vec2 - nitrologic/monkey2 GitHub Wiki

std::std.geom.Vec2

Struct Vec2

The generic Vec2 type provides support for 2 component vectors.

Unless otherwise noted, methods and operators always return a new vec2 containing the result, without modifying any parameters or 'self'.

This allows you to chain operators together easily just like 'real' expressions.

Fields
x Vector x coordinate.
y Vector y coodinate.
Constructors
New Creates a new vector.
Properties
Length The length of the vector. (read only)
Normal The normal to the vector. (read only)
X The X coordinate of the vector.
Y The Y coordinate of the vector.
Methods
OpMul Multiplies the vector by another vector.
OpAdd Adds another vector to the vector.
OpSub Negates the vector.
OpDiv Divides the vector by another vector.
Blend Blends the vector with another vector.
Distance Computes the distance from this vector to another.
Dot Computes the dot product of the vector with another vector.
Normalize Normalizes the vector.
To Converts the vector to a vector of a different type or a printable string.