dsfml.system.vector3

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.

You generally don't have to care about the templated form (Vector2!(T), the most common specializations have special aliases:

  • Vector3!(float) is Vector2f
  • Vector3!(int) is Vector2i

Members

Aliases

Vector3f
alias Vector3f = Vector3!(float)

Definition of a Vector3 of floats.

Vector3i
alias Vector3i = Vector3!(int)

Definition of a Vector3 of integers.

Structs

Vector3
struct Vector3(T)

Utility template struct for manipulating 3-dimensional vectors.

Examples

1 auto v1 = Vector3f(16.5f, 24.f, -8.2f);
2 v1.x = 18.2f;
3 float y = v1.y;
4 float z = v1.z;
5 
6 auto v2 = v1 * 5.f;
7 Vector3f v3;
8 v3 = v1 + v2;
9 
10 bool different = (v2 != v3);

See Also

$(VECTOR2_LINK)

Meta