mathed.types.vector

Implementation of vector as a list of values. Features:

  1. All vector actions is checked at compile time
  2. Vector contains only it's data, and nothing additional
  3. Almost all vector actions is pure and nothrow
  4. Vector can have one- and multiletter accessors

Usage: Create vector as in documentation below and treat it like a simple array (if you want to take some data from vector or put it in) or number (if you need to do some mathematical actions with vector).

Vector can have accessor - a named property method returning one of vector element. Accessor can be two types:

  1. One-letter accessor. To create vector with this type you should create vector like that:

    auto vec = Vector!(int, 2, "xy")(10, 20);

    Then you can call vector accessor:

    assert (vec.x == 10);

  2. Multiletter accessor. To create vector with this type you should create vector like that:

    auto vec = Vector!(int, 2, "col,row")(10, 20);

    Accessor delimiter in the accessors string should be ",". Then you can call vector accessor:

    assert (vec.col == 10);

Vector also has Orientation - a string that defines vector orientation: horizontal or vertical. It is needed only when vector is converted to matrix and by default is horizontal.

Members

Aliases

Planef
alias Planef = Vector!(2, float, "xy")
Undocumented in source.
Planei
alias Planei = Vector!(2, int, "xy")
Undocumented in source.
Stereof
alias Stereof = Vector!(3, float, "xyz")
Undocumented in source.
Stereoi
alias Stereoi = Vector!(3, int, "xyz")
Undocumented in source.
Vector2f
alias Vector2f = Vector!2
Undocumented in source.
Vector2i
alias Vector2i = Vector!(2, int)
Undocumented in source.
Vector3f
alias Vector3f = Vector!3
Undocumented in source.
Vector3i
alias Vector3i = Vector!(3, int)
Undocumented in source.
Vector4f
alias Vector4f = Vector!4
Undocumented in source.
Vector4i
alias Vector4i = Vector!(4, int)
Undocumented in source.

Structs

Vector
struct Vector(size_t Size, Type = float, string Accessors = "", string Orientation = "horizontal")

Main vector interface.

Templates

isVector (from mathed.utils.traits)
template isVector(alias Variable) via public import mathed.utils.traits : isVector;

Tests variable to be a vector.

Meta

Authors

Vlad Rindevich (rindevich.vs@gmail.com).