View on GitHub



A module containing a numeric 3D vector type.

struct Vector3(T) if (isNumeric!T);
Utility template struct for manipulating 3-dimensional vectors

Vector3 is a simple class that defines a mathematical vector with three coordinates (x, y and z).

It can be used to represent anything that has three dimensions: a size, a point, a velocity, etc.

The template parameter T is the type of the coordinates. It can be any type that supports arithmetic operations (+, -, /, *) and comparisons (==, !=), for example int or float.

T x;
X coordinate of the vector.

T y;
Y coordinate of the vector.

T z;
Z coordinate of the vector.

this(T X, T Y, T Z);
Construct the vector from its coordinates

T X X coordinate.
T Y Y coordinate.
T Z Z coordinate.

this(E)(Vector3!E otherVector);
Construct the vector from another type of vector

Vector3!E otherVector Vector to convert.