CREATE-ROTATION-FROM-VIEW (VIEW WORLD-UP &OPTIONAL (SIZE (LENGTH VIEW)))
Given a direction to look in (VIEW), and the direction that is 'upwards' in a given coordinate system, this function creates a rotation matrix to translate into that coordinate system. This matrix should be post multiplied by any vectors. The matrix is defined using a left-handed coordinate system.
CREATE-ROTATION-FROM-VIEW-TO-VIEW (FROM-VIEW TO-VIEW WORLD-UP)
Creates a rotation matrix that will rotate the vector FROM-VIEW on to the vector TO-VIEW, using WORLD-UP as the coordinate system's 'upward' direction. This matrix should be post-multiplied by any vectors.
CREATE-ROTATION-MATRIX (VIEW RIGHT UP &OPTIONAL (SIZE 3))
Creates a rotation matrix from three vectors. VIEW is the direction that the object should be pointing along, UP is the direction upwards. RIGHT is the vector orthogonal to this.
Creates an size x size identity matrix.
MAKE-MATRIX (ROWS COLS &KEY INITIAL-ELEMENTS)
Creates a matrix of the given dimensions.
MAKE-VECTOR (DIM &KEY INITIAL-ELEMENTS)
Create a vector of the given dimensions.
PITCH-MATRIX (SIZE ANGLE)
Creates a matrix that rotates around the x-axis by the given angle, given in radians. This is a left-handed rotation.
ROLL-MATRIX (SIZE ANGLE)
Creates a matrix that rotates around the z-axis by the given angle, in radians. This is a left-handed rotation.
VECTOR (&REST ELEMENTS)
Create a vector.
YAW-MATRIX (SIZE ANGLE)
Creates a matrix that rotates around the y-axis by the given angle, given in radians. This is a left-handed rotation
* (&REST ITEMS)
+ (&REST ITEMS)
- (&REST ITEMS)
/ (&REST ITEMS)
DO-EACH-MATRIX-ELEMENT ((SYMBOL MATRIX &OPTIONAL ROW-INDEX-SYMBOL COL-INDEX-SYMBOL) &BODY BODY)
Iterates over each of the matrix elements, row by row.
DO-EACH-VECTOR-ELEMENT ((ELEMENT VECTOR &KEY (INDEX-SYMBOL NIL)) &BODY BODY)
Iterates over elements in a vector.
DO-EACH-MATRIX-ELEMENT-2 ((LHS-SYMBOL RHS-SYMBOL LHS-MATRIX RHS-MATRIX &KEY (TRANSPOSE-RHS T)) &BODY BODY)
CREATE-LIST-OPERATION-METHOD (NAME FUNCTION)
Generates a method, such as c+, which operates on common lisp lists, treating them as if they were vectors.
CREATE-VECTOR-OPERATION-METHOD (NAME FUNCTION)
Expands into code that can be used to fill out one a method for one of the generic methods defined below, such as c+
FILL-ROW (MATRIX ITEM-NAME ROW-NUM)
A macro useful for filling matrices in functions such as CREATE-ROTATION-MATRIX.
ETEST-DIMENSIONS (LHS RHS)
ANGLE-BETWEEN (FROM TO)
Returns the angle between two vectors. The angle is in radians, and is signed. The angle represents the the angle needed to transform the FROM vector to the TO vector.
BETWEEN (START END)
Calculates the vector half way between two other vectors. This is equivalent to (LINEAR-INTERPOLATION START END 0.5).
C* (LHS RHS)
multiplies two objects together.
C+ (LHS RHS)
Adds two objects together.
C- (LHS RHS)
C/ (LHS RHS)
Divides two objects.
Returns a copy of the given item.
Returns a copy of the original vector
CROSS-PRODUCT (LHS RHS)
Calculates the cross product between 3-vectors
Returns the dimensions of a given object.
DOT-PRODUCT (LHS RHS)
Calculates the dot product between two vectors.
ELT (VECTOR INDEX)
Returns the element of a VECTOR at the given index.
EQUIVALENT (LHS RHS)
Returns t iff the two objects are numerically the same. Real valued objects are always compared using *equivalence-tolerance*.
EUCLIDEAN-DISTANCE (LHS RHS)
Calculates the Euclidean distance between two objects.
An alias for DIMENSION
LINEAR-INTERPOLATION (START END T-VAL)
Interpolates between two points, using the parametric line equation. START and END are the two endpoints of a line. While T-VAL takes values between 0 and 1, inclusive, the returned points will lie between these two points. No matter the value of T-VAL, the returned point will always be on the line, but will be outside of the [start, end] line segment if T-VAL is not on the domain [0, 1]
Returns the number of columns in a matrix.
MATRIX-ELT (MATRIX ROW COL)
Return the matrix componenent at the given row and column
Return the number of rows in a matrix.
MATRIX= (LHS RHS)
Returns t iff the two matrices are equal. Effected by *equivalence-tolerance*.
Returns an item with all of its elements negated. This is non-destructive.
Returns the additive inverse of an item, much like NEGATE, only this version is destructive.
The distance of the vector from zero.
Returns a normalised version of the vector.
Destructively normalises the vector.
TEST-DIMENSIONS (LHS RHS &KEY (TRANSPOSE-RHS NIL) (BOTH T))
Throws an error if the two objects do not agree in dimensions. If the second object is a matrix, it is possible to transpose the dimensions that are tested using the :transpose-rhs argument.
TO-VECTOR (ITEM &KEY DIMENSION)
Returns a new vector object based created from the function's arguments. If dimension is supplied, it should be a positive integer defining the dimension of the returned vector. If the specified dimension is shorter than the given item, extra elements are truncated. If it is longer, the new vector will be padded with zero elements.
Returns the non-destructive transpose of a matrix
VECTOR= (LHS RHS)
Returns t iff the two vectors are equal. Effected by *equivalence-tolerance*.
Returns the w component from an appropriately sized vector.
SETFW (VALUE VECTOR)
Sets the w component from an appropriately sized vector.
Returns the x component from an appropriately sized vector.
SETFX (VALUE VECTOR)
Sets the x component from an appropriately sized vector.
Returns the y component from an appropriately sized vector.
SETFY (VALUE VECTOR)
Sets the y component from an appropriately sized vector.
Returns the z component from an appropriately sized vector.
SETFZ (VALUE VECTOR)
Sets the z component from an appropriately sized vector.
INITIALISE-DATA (ITEM SIZE)
Initialises the DATA slot to the given size. Returns the vector object.
TEST-NONZERO (VECTOR &OPTIONAL THRESHOLD)
Throws a ZERO-LENGTH-ERROR if the given vector has a length close to zero.
When objects are closer than this distance, they are considered equivalent.
A mathematical matrix class.
VECTOR (&REST ELEMENTS)
A mathematical vector class.