Skip to content

Std geom vec2

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
Operator * Multiplies the vector by another vector.
Operator + Adds another vector to the vector.
Operator - Negates the vector.
Operator / 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.
Operator To Converts the vector to a vector of a different type or a printable string.