All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- our own
FromandIntotraits, because a quirk with Rust's generics won't let us use the standard ones to convert between types of vector, matrix, etc. FromandIntoimplementations forMatrixandVectorthat allow converting from one type of type to another, using the existing conversion of the wrapped types.
Matrix::from_fnnow uses aMatrixCoordinateas an index instead of a tupleVectormath operations now assume input and output types will be the same (this simplifies the trait bounds in downstream code)
- More tests for
MatrixAreaIterator
MatrixAreaIteratorwas supposed to be inclusive of both the start and end coordinates, but was excluding both the ending row and column insteadMatrixAreaIteratorwould sometimes panic when iterating in reverse due to subtracting from 0 for an unsigned integerMatrixAreaIterator::newwould sometimes panic for areas of certain dimensions due to using the wrong dimension in a size calculation
- Tests for
MatrixAreaIterator - Implemented
FusedIteratorandExactSizeIteratorforMatrixAreaIterator
- rewrote
MatrixAreaIteratorto simplify, to fix iterating 1 element past the last row in the area
into_iter_forandas_iter_formethods onVectorandMatrix(to be able to choose custom indices to iterate)
VectorRefIteratorandMatrixRefIteratorrenamed toVectorReferenceIteratorandMatrixReferenceIteratorrespectively.VectorIterator,VectorReferenceIterator,MatrixIterator, andMatrixReferenceIteratornow use generic iterators for indices.
VectorIndexIteratortrait (this was part of my original approach to index iterators that got scrapped in favor of using the built-in iterator traits)
- Generic parameters on
Vectoriterators to allow customization of the order/set iterated
rowandcolumnfields ofMatrixCoordinateare now publicVectorIterator,VectorRefIterator,MatrixIterator, andMatrixRefIteratornow implementFusedIteratorfor optimization purposes
VectorIteratorandVectorRefIteratorfor iterating overVector- Implemented
IntoIteratorforVectorand references toVector MatrixIteratorandMatrixRefIteratorfor iterating (along rows) overMatrix- Implemented
IntoIteratorforMatrixand references toMatrix MatrixCoordinatetype
Matrixshould now be indexed usingMatrixCoordinateinstead of a tuple (this makes it clearer which is the row vs column)
- Negation operator for
Matrix(Negtrait) - Unit tests for negation of
VectorandMatrix
- Unit tests for vector math
- Negation operator for
Vector(Negtrait)
- Unit tests for Matrix-Matrix and Matrix-Scalar multiplication
- Matrix-Matrix multiplication was incorrect due to reversing rows and columns in the operation
- Loads of documentation for basically everything
#![must_use]annotations on any methods that return a value and don't mutate an input
Matrixnow implementsEqandPartialEq- Methods that need to initialize a
0,1, or-1value for a generic type now useFrom<i8>instead ofDefaultto do so - Linter now denies a lot more things
- Functions to create matrices and vectors from a single value
- Functions to create zero and identity matrices
- Function to create zero vectors
Defaultimplemented forVectorandMatrixScalarmarker implemented forisizeandusize
Matrix::from_arrayandVector::from_arrayare now const
MatrixtoVectormultiplicationVector::from_fnlikeMatrix::from_fn, to create a vector component-by-component via a function
MatrixmultiplicationMatrix::from_fnto create a matrix component-by-component via a function
ComponentwiseOptrait renamed toComponentwise,componentwise_opfunction tocomponentwiseAssignComponentwiseOptrait renamed toAssignComponentwise,assign_componentwise_opfunction toassign_componentwise_op- Componentwise operator can use a closure with captured variables
Powtrait for types that can be exponentiatedSqrttrait for types from which a square root can be calculated
magnitude,magnitude_squared,normalizeandassign_normalizefunctions on Vectors made more generic
- Make cross product output type as flexible as the other math operators
- Dot product implementation for Vector
- Cross product implementation for Vector3 (3 dimensional only for now)
DotAssigntrait (dot product returns a scalar from two Vector/Matrix inputs, so it needs to be stored in a third memory location)CrossAssigntrait (since cross products intermingle each value with those of different indices in both vectors, it is impossible to store the calculations without putting them into an intermediate location first, which is the same as just using the Cross trait, so there's no need to repeat ourselves here)
- Vector and Matrix math operators can return values with different types than the left-hand-side depending on how the underlying math operators of each component type is implemented. Usually it will return the same as the left-hand-side though.
- Traits for dot and cross products
- Traits for componentwise operations between types composed of multiple values of the same type (like Vector and Matrix)
- Implementation for componentwise operator for Vector
- Re-added
Scalarmarker type (turns out to be useful after all) - Re-added addition and subtraction where left is a Vector and right is a Scalar
- Re-added multiplication and division where both sides are Vectors
- Indexing operator for Matrix
from_arrayfactory functions for Vector and Matrix- function to transpose a Matrix
- Addition, subtraction, scalar multiply, and scalar divide for Matrix
Scalarmarker type
- Size generics for Matrix type were swapped (not consistent with the math)
- Initial implementation of
Matrix(just the struct for now) - Indexing operator for Vector
- Scalar operators for Vector (such as adding a vector and a scalar, etc.)
- Magnitude squared function, for when you want to skip the expensive square root calculation
- Functions to normalize a Vector
- rename
*_vector_opto*_componentwise_opto be more consistent with math terminology
- Add and subtract where left is a Vector and right is a scalar
- Multiply and divide where both sides are vectors
- Vector operators are now more flexible and can handle type differences better
- Function to calculate the magnitude of a Vector
- Componentwise operations were skipping the last element in a vector
- Initial implementation of the
Vectortype