Crate linbra

source ·
Expand description

Easily do linear algebra in game development, graphics and other sort of calculations using vectors and matrices.

Every implementation, function or item is documented mathematically and for programming. Browses the items and their functions to learn how to use them!

Overview

  • Objects:
MathematicsLinbraRelated types
$$ \begin{pmatrix} x_{1,1} & x_{1,2} & \dots & x_{1,C} \\ x_{2,1} & x_{2,2} & \dots & x_{2,C} \\ \vdots & \vdots & \ddots & \vdots \\ x_{R,1} & x_{R,2} & \dots & x_{R,C} \\ \end{pmatrix} $$Matrix<T, C, R>
$$ \begin{pmatrix} a_{1} \\ a_{2} \\ \vdots \\ a_{n} \\ \end{pmatrix} $$Vector<T, N>
  • Tools:
MathematicsRelated traitsand their functions
$$ \begin{pmatrix} x \\ y \\ \end{pmatrix} or \begin{pmatrix} x \\ y \\ z \\ \end{pmatrix} $$
$$ \begin{pmatrix} w \\ h \\ \end{pmatrix} or \begin{pmatrix} w \\ h \\ d \\ \end{pmatrix} $$
$$ \begin{pmatrix} r \\ g \\ b \\ \end{pmatrix} or \begin{pmatrix} r \\ g \\ b \\ a \\ \end{pmatrix} $$

Modules

  • Traits to retrieve the red, blue, green (and alpha) channels of colour vectors and the implements of these traits for vectors 3 and 4.
  • Matrix types and functions to perform calculations on matrices.
  • Traits to get x, y and z values of a 2d-point or a 3d-point, and constructors for these points.
  • Traits to get width, height and depths values of a 2d-objects or 3d-objects, and constructors for these sizes.
  • Fixed-size vector and easy-types for different usually used vectors with into/from implementations on relevant primitives types.

Traits

  • Common properties to all the number-primitive types.
  • Implements a function to get the zero-value of the type.