gl3n.linalg

gl3n.linalg

Special thanks to:

  • Tomasz Stachowiak (h3r3tic): allowed me to use parts of omg.
  • Jakob Øvrum (jA_cOp): improved the code a lot!
  • Florian Boesch (___doc__): helps me to understand opengl/complex maths better, see: http://codeflow.org/.
  • #D on freenode: answered general questions about D.

Members

Aliases

mat2
alias mat2 = Matrix!(float, 2, 2)

Pre-defined matrix types, the first number represents the number of rows and the second the number of columns, if there's just one it's a nxn matrix. All of these matrices are floating-point matrices.

mat3
alias mat3 = Matrix!(float, 3, 3)
Undocumented in source.
mat34
alias mat34 = Matrix!(float, 3, 4)
Undocumented in source.
mat4
alias mat4 = Matrix!(float, 4, 4)
Undocumented in source.
quat
alias quat = Quaternion!(float)

Pre-defined quaternion of type float.

vec2
alias vec2 = Vector!(float, 2)

Pre-defined vector types, the number represents the dimension and the last letter the type (none = float, d = double, i = int).

vec2d
alias vec2d = Vector!(double, 2)
Undocumented in source.
vec2i
alias vec2i = Vector!(int, 2)
Undocumented in source.
vec3
alias vec3 = Vector!(float, 3)
Undocumented in source.
vec3d
alias vec3d = Vector!(double, 3)
Undocumented in source.
vec3i
alias vec3i = Vector!(int, 3)
Undocumented in source.
vec4
alias vec4 = Vector!(float, 4)
Undocumented in source.
vec4d
alias vec4d = Vector!(double, 4)
Undocumented in source.
vec4i
alias vec4i = Vector!(int, 4)
Undocumented in source.

Functions

cross
T cross(T veca, T vecb)

Calculates the cross product of two 3-dimensional vectors.

distance
T.vt distance(T veca, T vecb)

Calculates the distance between two vectors.

dot
T.vt dot(T veca, T vecb)

Calculates the product between two vectors.

reflect
T reflect(T vec, T norm)

reflect a vector using a surface normal

Structs

Matrix
struct Matrix(type, int rows_, int cols_)

Base template for all matrix-types.

Quaternion
struct Quaternion(type)

Base template for all quaternion-types.

Vector
struct Vector(type, int dimension_)

Base template for all vector-types.

Meta

Authors

David Herberth

License

MIT

Note: All methods marked with pure are weakly pure since, they all access an instance member. All static methods are strongly pure.