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
From
andInto
traits, because a quirk with Rust's generics won't let us use the standard ones to convert between types of vector, matrix, etc. From
andInto
implementations forMatrix
andVector
that allow converting from one type of type to another, using the existing conversion of the wrapped types.
Matrix::from_fn
now uses aMatrixCoordinate
as an index instead of a tupleVector
math operations now assume input and output types will be the same (this simplifies the trait bounds in downstream code)
- More tests for
MatrixAreaIterator
MatrixAreaIterator
was supposed to be inclusive of both the start and end coordinates, but was excluding both the ending row and column insteadMatrixAreaIterator
would sometimes panic when iterating in reverse due to subtracting from 0 for an unsigned integerMatrixAreaIterator::new
would sometimes panic for areas of certain dimensions due to using the wrong dimension in a size calculation
- Tests for
MatrixAreaIterator
- Implemented
FusedIterator
andExactSizeIterator
forMatrixAreaIterator
- rewrote
MatrixAreaIterator
to simplify, to fix iterating 1 element past the last row in the area
into_iter_for
andas_iter_for
methods onVector
andMatrix
(to be able to choose custom indices to iterate)
VectorRefIterator
andMatrixRefIterator
renamed toVectorReferenceIterator
andMatrixReferenceIterator
respectively.VectorIterator
,VectorReferenceIterator
,MatrixIterator
, andMatrixReferenceIterator
now use generic iterators for indices.
VectorIndexIterator
trait (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
Vector
iterators to allow customization of the order/set iterated
row
andcolumn
fields ofMatrixCoordinate
are now publicVectorIterator
,VectorRefIterator
,MatrixIterator
, andMatrixRefIterator
now implementFusedIterator
for optimization purposes
VectorIterator
andVectorRefIterator
for iterating overVector
- Implemented
IntoIterator
forVector
and references toVector
MatrixIterator
andMatrixRefIterator
for iterating (along rows) overMatrix
- Implemented
IntoIterator
forMatrix
and references toMatrix
MatrixCoordinate
type
Matrix
should now be indexed usingMatrixCoordinate
instead of a tuple (this makes it clearer which is the row vs column)
- Negation operator for
Matrix
(Neg
trait) - Unit tests for negation of
Vector
andMatrix
- Unit tests for vector math
- Negation operator for
Vector
(Neg
trait)
- 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
Matrix
now implementsEq
andPartialEq
- Methods that need to initialize a
0
,1
, or-1
value for a generic type now useFrom<i8>
instead ofDefault
to 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
Default
implemented forVector
andMatrix
Scalar
marker implemented forisize
andusize
Matrix::from_array
andVector::from_array
are now const
Matrix
toVector
multiplicationVector::from_fn
likeMatrix::from_fn
, to create a vector component-by-component via a function
Matrix
multiplicationMatrix::from_fn
to create a matrix component-by-component via a function
ComponentwiseOp
trait renamed toComponentwise
,componentwise_op
function tocomponentwise
AssignComponentwiseOp
trait renamed toAssignComponentwise
,assign_componentwise_op
function toassign_componentwise_op
- Componentwise operator can use a closure with captured variables
Pow
trait for types that can be exponentiatedSqrt
trait for types from which a square root can be calculated
magnitude
,magnitude_squared
,normalize
andassign_normalize
functions 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)
DotAssign
trait (dot product returns a scalar from two Vector/Matrix inputs, so it needs to be stored in a third memory location)CrossAssign
trait (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
Scalar
marker 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_array
factory functions for Vector and Matrix- function to transpose a Matrix
- Addition, subtraction, scalar multiply, and scalar divide for Matrix
Scalar
marker 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_op
to*_componentwise_op
to 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
Vector
type