## gl-math

A small math library aimed at gamedev that provides 4x4 float matrix, vector, and quaternion operations. Uses the hypermath library.

### Requirements

- matchable

### Documentation

gl-math provides a number of functions for working with 4x4 matrices (plus a handful of others). The functionality is similar to what can be found in the glm egg, but with some notable differences:

- Matrix functions only operate on 4x4 matrices
- Matrix functions can accept either f32vectors or pointers
- No container is used to represent matrices

Additionally, gl-math is one fifth the compiled size of glm, has a more straight-forward code-base, and complete documentation.

gl-math expects matrices, vectors, and quaternions to be f32vectors or pointers. f32vectors must be 16 elements long, 3 elements long, or 4 elements long for matrices, vectors, or quaternions, respectively. The memory pointed to should likewise be an array of 16, 3, or 4 floats . If a function accepts more than one matrix, vector, or quaternion, all must be of the same type.

gl-math operates on matrices in a column-major fashion in correspondence with OpenGL (e.g. translation components are at indices 12, 13, and 14). Vectors are arranged as (`(x y z)`), and quaternions as (`(x y z w)`).

#### Matrix operations

`(print-mat4 MATRIX)`procedurePrints the given

`MATRIX`to`(current-output-port)`.

`(copy-mat4 MATRIX [RESULT])`procedureMake a copy of

`MATRIX`. If the matrix`RESULT`is given, it will be modified to contain the contents of`MATRIX`. If`RESULT`is`#t`,`MATRIX`must be an f32vector and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`MATRIX`must be an f32vector and the returned value will be an f32vector located in normal garbage collected memory.

`(m* A B [RESULT])`procedureMultiply matrix

`A`by matrix`B`. If the matrix`RESULT`is given, it will be modified to contain the results of the multiplication. If`RESULT`is`#t`,`A`and`B`must be f32vectors and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`A`and`B`must be f32vectors and the returned value will be an f32vector located in normal garbage collected memory.

`(m*s A S [RESULT])`procedureMultiply matrix

`A`by scalar`S`. If the matrix`RESULT`is given, it will be modified to contain the results of the multiplication. If`RESULT`is`#t`,`A`must be an f32vector and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`A`must be an f32vector and the returned value will be an f32vector located in normal garbage collected memory.

`(m+ A B [RESULT])`procedureAdd matrix

`A`with matrix`B`. If the matrix`RESULT`is given, it will be modified to contain the results of the multiplication. If`RESULT`is`#t`,`A`and`B`must be f32vectors and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`A`and`B`must be f32vectors and the returned value will be an f32vector located in normal garbage collected memory.

`(m- A B [RESULT])`procedureSubtract matrix

`B`from matrix`A`. If the matrix`RESULT`is given, it will be modified to contain the results of the multiplication. If`RESULT`is`#t`,`A`and`B`must be f32vectors and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`A`and`B`must be f32vectors and the returned value will be an f32vector located in normal garbage collected memory.

`(mat4-identity [RESULT])`procedureReturn an identity matrix. If

`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(translation VECTOR [RESULT])`procedureReturn the translation matrix given by

`VECTOR`. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(translate VECTOR MATRIX)`procedureTranslate

`MATRIX`by`VECTOR`.

`(x-rotation ANGLE [RESULT])`procedureReturn the rotation matrix given by a rotation of

`ANGLE`radians around the x-axis. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(rotate-x ANGLE MATRIX)`procedureRotate

`MATRIX`around the x-axis by`ANGLE`radians.

`(y-rotation ANGLE [RESULT])`procedureReturn the rotation matrix given by a rotation of

`ANGLE`radians around the y-axis. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(rotate-y ANGLE MATRIX)`procedureRotate

`MATRIX`around the y-axis by`ANGLE`radians.

`(z-rotation ANGLE [RESULT])`procedureReturn the rotation matrix given by a rotation of

`ANGLE`radians around the z-axis. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(rotate-z ANGLE MATRIX)`procedureRotate

`MATRIX`around the z-axis by`ANGLE`radians.

`(axis-angle-rotation AXIS ANGLE [RESULT])`procedureReturn the rotation matrix given by a rotation of

`ANGLE`radians around the vector`AXIS`. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(rotate-axis-angle AXIS ANGLE MATRIX)`procedureRotate

`MATRIX`around the vector`AXIS`by`ANGLE`radians.

`(quaternion-rotation Q [RESULT])`procedureReturn the rotation matrix given by the quaternion

`Q`. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(rotate-quaternion Q MATRIX)`procedureRotate

`MATRIX`by the quaternion`Q`.

`(ypr-rotation YAW PITCH ROLL [RESULT])`procedureReturn the rotation matrix given by rotating by

`ROLL`radians around the z-axis followed by`PITCH`radians around the x-axis followed by`YAW`radians around the y-axis. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(rotate-ypr YAW PITCH ROLL MATRIX)`procedureRotate

`MATRIX`by`ROLL`radians around the z-axis followed by`PITCH`radians around the x-axis followed by`YAW`radians around the y-axis.

`(2d-scaling SCALE-X SCALE-Y [RESULT])`procedureReturn the matrix created by scaling the x and y axes by

`SCALE-X`and`SCALE-Y`. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(scale-2d SCALE-X SCALE-Y MATRIX)`procedureScale the x and y axis of

`MATRIX`by`SCALE-X`and`SCALE-Y`.

`(3d-scaling SCALE-X SCALE-Y SCALE-Z [RESULT])`procedureReturn the matrix created by scaling the x, y and z axes by

`SCALE-X`,`SCALE-Y`, and`SCALE-Z`. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(scale-3d SCALE-X SCALE-Y SCALE-Z MATRIX)`procedureScale the x, y, and z axis of

`MATRIX`by`SCALE-X`,`SCALE-Y`, and`SCALE-Z`.

`(scaling SCALE [RESULT])`procedureReturn the matrix created by scaling the x, y and z axes by

`SCALE`. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(scale SCALE MATRIX)`procedureScale the x, y, and z axis of

`MATRIX`by`SCALE`.

`(flip-x MATRIX)`procedureFlip (mirror)

`MATRIX`along the x-axis.

`(flip-y MATRIX)`procedureFlip (mirror)

`MATRIX`along the y-axis.

`(flip-z MATRIX)`procedureFlip (mirror)

`MATRIX`along the z-axis.

`(translate-rotate-scale-2d VECTOR ANGLE SCALE [RESULT])`procedureEfficiently create a matrix translated by

`VECTOR`, rotated around the z-axis by`ANGLE`radians, then scaled by`SCALE`. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(transpose MATRIX [RESULT])`procedureTranspose

`MATRIX`. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`,`MATRIX`must be an f32vector and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`MATRIX`must be an f32vector and the returned value will be an f32vector located in normal garbage collected memory.

`(inverse MATRIX [RESULT])`procedureInvert

`MATRIX`. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`,`MATRIX`must be an f32vector and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`MATRIX`must be an f32vector and the returned value will be an f32vector located in normal garbage collected memory.

`(fast-inverse-transpose MATRIX [RESULT])`procedureEfficiently inverse the transpose the unscaled

`MATRIX`. If`MATRIX`has been scaled, this will produce incorrect results:`inverse`then`transpose`should be used instead. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`,`MATRIX`must be an f32vector and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`MATRIX`must be an f32vector and the returned value will be an f32vector located in normal garbage collected memory.

#### Projection matrices

`(ortho WIDTH HEIGHT NEAR FAR [RESULT])`procedureCreate an orthographic projection matrix. If the matrix

`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(ortho-viewport LEFT RIGHT NEAR FAR VIEWPORT-LEFT VIEWPORT-RIGHT VIEWPORT-BOTTOM VIEWPORT-TOP [RESULT])`procedureCreate an orthographic projection matrix mapping the

`LEFT`,`RIGHT`,`TOP`,`BOTTOM`,`NEAR`,`FAR`cube to a viewport of`VIEWPORT-LEFT`,`VIEWPORT-RIGHT`,`VIEWPORT-TOP`,`VIEWPORT-BOTTOM`. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(perspective WIDTH HEIGHT NEAR FAR ANGLE [RESULT])`procedureCreate an perspective projection matrix with a field of view of

`ANGLE`degrees. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(frustum LEFT RIGHT BOTTOM TOP NEAR FAR [RESULT])`procedureCreate a perspective projection matrix defined by a frustum with a near side of

`LEFT`,`RIGHT`,`TOP`,`BOTTOM`,`NEAR`, and a far side at`FAR`. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(frustum-viewport LEFT RIGHT BOTTOM TOP NEAR FAR VIEWPORT-LEFT VIEWPORT-RIGHT VIEWPORT-BOTTOM VIEWPORT-TOP [RESULT])`procedureCreate a perspective projection matrix mapping the

`LEFT`,`RIGHT`,`TOP`,`BOTTOM`,`NEAR`,`FAR`frustum to a viewport of`VIEWPORT-LEFT`,`VIEWPORT-RIGHT`,`VIEWPORT-BOTTOM`,`VIEWPORT-TOP`. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

#### Camera functions

`(look-at EYE OBJ UP [RESULT])`procedureCreate a “look-at” style camera matrix. The camera is positioned at point

`EYE`, pointing towards the point`OBJ`.`UP`defines the camera’s up vector. If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`, the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(camera-inverse CAMERA [RESULT])`procedureInvert

`CAMERA`in an efficient fashion. This allows the camera to be constructed in an intuitive fashion by translating and rotating before inverting in order to position the scene properly. This function is far faster than the general`inverse`function, but the matrix`CAMERA`must only be a matrix representing a translation and a rotation (no scaling). If the matrix`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`,`CAMERA`must be an f32vector and the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided,`CAMERA`must be an f32vector and the returned value will be an f32vector located in normal garbage collected memory.

#### Vector operations

`(make-point X Y Z [NON-GC?])`procedure`(point-x POINT)`procedure`(point-y POINT)`procedure`(point-z POINT)`procedure`(point-x-set! POINT)`procedure`(point-y-set! POINT)`procedure`(point-z-set! POINT)`procedureVector constructor, getters, and setters. If

`NON-GC?`is`#t`, the point is created in a non-garbage-collected area (the memory will still be freed when there are no more references to the vector).

`(v+ A B [RESULT])`procedureReturn the result of the addition of vectors

`A`and`B`. If the vector`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(v- A B [RESULT])`procedureReturn the result of the subtraction of vector

`B`from`A`. If the vector`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(v* V S [RESULT])`procedureReturn the result of the multiplication of vector

`A`with scalar`S`. If the vector`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(cross-product A B [RESULT])`procedureReturn the result of the cross product between the vectors

`A`and`B`. If the vector`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(dot-product A B)`procedureReturn the result of the dot product between the vectors

`A`and`B`.

`(vector-magnitude V)`procedureReturn the magnitude of vector

`V`.

`(normalize! V)`procedureDestructively normalize the vector

`V`.

`(m*vector! MATRIX VECTOR)`procedureDestructively multiply

`VECTOR`by`MATRIX`.

`(m*vector-array! MATRIX VECTORS stride: [STRIDE] length: [LENGTH])`procedureDestructively multiply the array of 3 element floats

`VECTORS`by`MATRIX`.`VECTORS`may be given as an f32vector, a u8vector or a pointer. The keyword`STRIDE`specifies the number of elements between consecutive vectors, given in number of floats (which must be at least 3) when`VECTORS`is an f32vector and in bytes when`VECTORS`is a u8vector or a pointer. When`VECTORS`is given as a pointer, the keyword`LENGTH`must be provided, specifying the number of vectors in`VECTORS`.

`(lerp A B T [RESULT])`procedureLinear interpolation between the points

`A`and`B`with the interpolation parameter`T`which must be between 0 and 1. If the vector`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

#### Quaternion operations

Quaternions are expected to be normalized before they are used in certain functions (`quaternion-normalize!` may be used to do so). All the provided functions that create quaternions, create unit quaternions.

The order of quaternion cross-multiplication is the inverse of the “standard” order, so a quaternion that has undergone a series or rotations will represent the same rotation as a marix that has gone through the same series, in the same order.

`(make-quaternion X Y Z W [NON-GC?])`procedure`(quaternion-x POINT)`procedure`(quaternion-y POINT)`procedure`(quaternion-z POINT)`procedure`(quaternion-w POINT)`procedure`(quaternion-x-set! POINT)`procedure`(quaternion-y-set! POINT)`procedure`(quaternion-z-set! POINT)`procedure`(quaternion-w-set! POINT)`procedureQuaternion constructor, getters, and setters. If

`NON-GC`is`#t`, the quaternion is created in a non-garbage-collected area (the memory will still be freed when there are no more references to the quaternion).

`(quaternion-normalize! Q)`procedureDestructively normalize the quaternion

`Q`.

`(quaternion-inverse Q [RESULT])`procedureReturn the inverse of the unit quaternion

`Q`. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-cross-product A B [RESULT])`procedureReturn the cross-product of the quaternions

`A`and`B`. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-axis-angle-rotation AXIS ANGLE [RESULT])`procedureReturn the quaternion corresponding to a rotation of

`ANGLE`radians around the vector`AXIS`. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-rotate-axis-angle AXIS ANGLE Q)`procedureRotate the quaternion

`Q`by a rotation of`ANGLE`radians around the vector`AXIS`.

`(quaternion-x-rotation ANGLE [RESULT])`procedureReturn the quaternion corresponding to a rotation of

`ANGLE`radians around the x-axis. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-rotate-x ANGLE Q)`procedureRotate the quaternion

`Q`by a rotation of`ANGLE`radians around the x-axis.

`(quaternion-y-rotation ANGLE [RESULT])`procedureReturn the quaternion corresponding to a rotation of

`ANGLE`radians around the y-axis. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-rotate-y ANGLE Q)`procedureRotate the quaternion

`Q`by a rotation of`ANGLE`radians around the y-axis.

`(quaternion-z-rotation ANGLE [RESULT])`procedureReturn the quaternion corresponding to a rotation of

`ANGLE`radians around the z-axis. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-rotate-z ANGLE Q)`procedureRotate the quaternion

`Q`by a rotation of`ANGLE`radians around the z-axis.

`(quaternion-ypr-rotation YAW PITCH ROLL [RESULT])`procedureReturn the quaternion corresponding to a rotation of

`ROLL`radians around the z-axis followed by`PITCH`radians around the x-axis followed by`YAW`radians around the y-axis. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

`(quaternion-rotate-ypr YAW PITCH ROLL Q)`procedureRotate the quaternion

`Q`by`ROLL`radians around the z-axis followed by`PITCH`radians around the x-axis followed by`YAW`radians around the y-axis.

`(quaternion-rotate-point! Q P)`procedureDestructively rotate the point

`P`by the unit quaternion`Q`.

`(slerp A B T [RESULT])`procedureSpherical linear interpolation between the quaternions

`A`and`B`with the interpolation parameter`T`which must be between 0 and 1. If the quaternion`RESULT`is given, it will be modified to contain the result. If`RESULT`is`#t`the returned value will be an f32vector located in non-garbage-collected memory (the memory will still be freed when there are no more references to the matrix). If`RESULT`is not provided, the returned value will be an f32vector located in normal garbage collected memory.

#### Angle operations

`(degrees->radians ANGLE)`procedureConverts

`ANGLE`from degrees to radians.

`(radians->degrees ANGLE)`procedureConverts

`ANGLE`from radians to degrees.

### Example

(import chicken scheme) (use gl-math) (define projection-matrix (perspective 640 480 0.1 100 70)) (define view-matrix (look-at (make-point 1 0 3) (make-point 0 0 0) (make-point 0 1 0))) (define model-matrix (mat4-identity)) (print-mat4 (m* projection-matrix (m* view-matrix model-matrix)))

### Version history

#### Version 0.8.0

7 August 2014

- Add
`m*`,`m+`,`m-`

#### Version 0.7.0

- Add
`frustum`,`frustum-viewport`

#### Version 0.6.0

8 October 2014

- Add
`fast-inverse-transpose`

#### Version 0.5.2

10 September 2014

`m*vector-array!`: Stride is given in bytes when vector is a pointer

**Version 0.5.0**

2 September 2014

- Many new vector and quaternion functions
- Functions that previously accepted vectors as individual floats, now accept them as f32vectors

#### Version 0.4.1

30 August 2014

- Fix
`m*vector-array!`

**Version 0.4.0**

27 July 2014

- Add
`copy-mat4`

#### Version 0.3.2

21 July 2014

- Allow pointer to array of vectors to be passed to
`m*vector-array!` - Fix error forms

**Version 0.3.1**

23 June 2014

- Matrix vector multiplication

#### Version 0.2.0

21 June 2014

- Each transformation function now has two variants: one that initializes a matrix, and one that operates on a matrix
- Provide
`pi/2` - Provide quaternion and YPR rotation
- Remove unhelpful composite operations
- Fix optional arguments for matrix operations
- Fix a bug in
`look-at`

#### Version 0.1.0

17 June 2014

- Initial release

### Source repository

Source available on GitHub.

Bug reports and patches welcome! Bugs can be reported via GitHub or to alex.n.charlton at gmail.

### Author

Alex Charlton

### Licence

BSD