cgmath
A linear algebra and mathematics library for computer graphics.
0.18.0
12M downloads/mo
#2857 most downloaded on crates.io
rustgd/cgmath
What this package is like to depend on
Last release 6 years ago
no release in 18 months
Ships unpredictably
gaps range from 8 days to 2.0 years
Some releases are documented
notes for 17 of 34 stable releases
2 versions withdrawn
withdrawn after publishing
12 years old
36 releases · first in 2015
0 releases in the last 12 months
see the full history below
Release timeline
36 releases · Feb 2015 to Jan 2021Releases
latest 36-
0.18.003 Jan 2021 -
0.17.017 Jan 2019Release notes
Open source →438: Angle: add the normalize_zero method r=kvark a=mathstuf
This method is like
normalizeexcept that it normalizes to have an
absolute value of no more thanturn_div_2.
This is useful for making sure that an angle is no more than some offset from a target angle (e.g., implementing maximum turn rates in games).
Co-authored-by: Ben Boeckel [email protected]
Release notes
Open source →Added
- Add signed
Anglenormalization
Changed
- Move
lerp()fromInnerSpacetoVectorSpace constconstructors
- Add signed
-
0.16.121 Mar 2018Release notes
Open source →Added
- Implement
ElementWisetrait for point types - Add
mapfunction to points and vectors
Changed
- Remove
BaseNumtrait requirement forPointN::newfunctions
- Implement
-
0.16.005 Jan 2018Release notes
Open source →Added
- Add
InnerSpace::project_on - Add
Array::len - Re-export
Boundedand implement for vectors, points, and angles - Add vector subtraction to
EuclideanSpace - Add swizzle functions behind that
"swizzle"feature - Add
Matrix4::look_at_dir
Changed
- Return
Optionfrom cast functions
Release notes
Open source →Added
- Add
InnerSpace::project_on - Add
Array::len - Re-export
Boundedand implement for vectors, points, and angles - Add vector subtraction to
EuclideanSpace - Add swizzle functions behinde that
"swizzle"feature - Add
Matrix4::look_at_dir
Changed
- Return
Optionfrom cast functions
- Add
-
0.15.030 Jul 2017Release notes
Open source →Added
- Implement
mintconversions behind a feature - Add
Quaternion::cast
Changed
- Rename
use_simdfeature tosimd - Rename
edersfeature toserde
Fixed
- Fix matrix inversions for small determinants
- Implement
-
0.14.102 May 2017Release notes
Open source →Fixed
- Add a workaround for rust-lang/rust#41478, and in the process cleaned up some type projections for angles
-
0.14.026 Apr 2017Nothing published for this version
-
0.13.123 Apr 2017 -
0.13.014 Apr 2017Release notes
Open source →Added
- Add optional
use_simdfeature to improve the performance ofVector4<f32>,Matrix4<f32>andQuaternion<f32>. According to @DaseinPhaos in #394, under the given benchmark certain operations were able to become up to 60% faster. - Add component wise casting for the matrix and point types
Changed
- Update
serdeto version0.9, and useserde_deriveinstead ofserde_macros.
- Add optional
-
0.12.014 Sep 2016Release notes
Open source →Changed
- Use approx for approximate equality comparisons
- Remove
#[repr(packed)]from all structs where it was specified - Update serde to 0.8
-
0.11.017 Aug 2016Release notes
Open source →Added
Quaternion::from_arc
Changed
- Change the angle types to be tuple structs
- Make from-angle constructors take generic
Into<Rad<S>>values - Fix
Decomposed::concatimplementation
-
0.10.005 Jun 2016Release notes
Open source →Added
- A
MetricSpacetrait for types that have a distance between elements. EuclideanSpace::{midpoint, centroid}functions with default implementations.Vector1andPoint1structs.- Serde support behind the
edersfeature flag. - An
ApproxEqimplementation forDecomposed.
Changed
- Depend on the
num-traitscrate rather thannum, seeing as we only use the traits innum.num_traitshas also been re-exported so that you can more easily use these in your project. - Use an
Eulertype for euler angle conversions. - Constrain
InnerSpacebyMetricSpace. - Constrain
RotationbyOne - Implement
TransformandTransform3forMatrix4. - Implement
Transform,Transform2, andTransform3forMatrix4. - Fix
Euler-QuaternionandQuaternion-Eulerconversions. The axes are now correct, and the angles are applied in x-y-z order. The conversion now matches the conversion from axis angle. - Fix
Euler-{Matrix3, Matrix4}conversions.
- A
-
0.9.120 Apr 2016Release notes
Open source →Changed
- Fix angle assignment operators so that they actually mutate
self.
- Fix angle assignment operators so that they actually mutate
-
0.9.019 Apr 2016Release notes
Open source →Changed
- Assignment operators implementations have been stabilised, to coincide with their stabilisation in Rust 1.8.
- Renames
Vectortrait toVectorSpace. - Renames
EuclideanVectortoInnerSpace. - Renames
PointtoEuclideanSpace, andPoint::VectortoEuclideanSpace::Diff. Quaternions now implementVectorSpaceandInnerSpacefor the functions they share.- The
Matrixtrait is now constraint byVectorSpace, withMatrix::Elementremoved in favor ofVectorSpace::Scalar.
-
0.8.006 Apr 2016Release notes
Open source →Added
- Implements
fmt::DebugforBasis2,Basis3, andAffineMatrix3 - A
preludemodule for easy importing of common traits. - Constrained conversion functions for assisting in situations where type inference is difficult.
- An
ElementWisetrait for non-mathematical element-wise operations. - A default implementation for
EuclideanVector::angle.
Changed
- Improves the
fmt::Debugimpls forVector,Matrix,Point,Decomposed,QuaternionandAngleto make them easier to derive, and have clearer formatting. - Marks vectors, points, matrices, and angles as
#[repr(C, packed)]. - Renames the
Vector::{length, length2}functions toVector::{magnitude, magnitude2}. - Move
Angle::newto be directly implemented on theRadandDegtypes. - Move
Vector::dottoEuclideanVectortrait. - Move
Vector::from_valuetoArraytrait.
Removed
- The non-mathematical operator trait implementations have been removed from
the
Vectortrait, in favor of theElementWisetrait. Angle::equiv.- Remove
neg_selfmethod on vectors and matrices.
- Implements
-
0.7.023 Dec 2015Release notes
Open source →Added
- Add missing by-ref and by-val permutations of
Vector,Matrix,Point,QuaternionandAngleoperators. - Ease lifetime constraints by removing
'staticfrom some scalar type parameters. - Weaken type constraints on
perspectivefunction to take anInto<Rad<S>>. - Add
Angle::newfor constructing angles from a unitless scalar. - Implement assignment operators for nightly builds, enabled by the
"unstable"feature.
Changed
Vector,Matrix,Point, andAngleare now constrained to require specific operators to be overloaded. This means that generic code can now use operators, instead of the operator methods.- Take a
RadforProjectionFov::fovy, rather than arbitraryAngles. This simplifies the signature ofPerspectiveFovfromPerspectiveFov<S, A>toPerspectiveFov<S>. - The following trait constraints were removed from
Angle:Debug,ScalarConv,Into<Rad<S>>,Into<Deg<S>>. Angleno longer requiresOne, and the implementations have been removed fromDegandRad. This is because angles do not close over multiplication, and therefore cannot have a multiplicative identity. If we were truly accurate,Angle * Anglewould return anAngle^2(not supported by the current api).- Make remainder operators on
Angles make sense from the perspective of dimensional analysis. - Moved free trigonometric functions onto
Angle.
Removed
- Remove redundant
Point::{min, max}methods - these are now covered by theArray::{min, max}methods that were introduced in 0.5.0. - Removed
ToComponents,ToComponents2, andToComponents3. If you were relying onToComponents::decompose, you can produce the same effect by accessing the fields onDecomposeddirectly. To create the scale vector, use:Vector::from_value(transform.scale). - Removed
CompositeTransform,CompositeTransform2, andCompositeTransform3. - Remove
Vector::one. Vectors don't really have a multiplicative identity. If you really want aonevector, you can do something like:Vector::from_value(1.0). - Remove operator methods from
Vector,Matrix,Point, andAngletraits in favor of operator overloading. - Remove
*_selfmethods fromVector,Matrix,Point, andAngle. The operator methods can be used via the unstable assignment operators. - Remove
#[derive(Hash)]fromDegandRad. This could never really be used these types, because they expect to be given aBaseFloatunder normal circumstances.
- Add missing by-ref and by-val permutations of
-
0.6.012 Dec 2015Release notes
Open source →Added
- This CHANGELOG for keeping track of notable changes.
Matrix4::{from_scale, from_nonuniform_scale}for easily constructing homogeneous scale matrices.
Changed
- Renamed
SquareMatrix::onetoSquareMatrix::identity.identityis easier to search for, and the more common name for the multiplicative identity for matrices. - Matrix impls have now been constrained to
S: BaseFloat.
-
0.5.019 Nov 2015Release notes
Open source →Changed
- Take many point and vector parameters by value.
- Take point and vector operator overloads by value.
- Divide
Matrixtrait intoMatrixandSquareMatrix, opening the door for non-square matrices in the future. - Make many trait type parameters associated types.
- Move element-wise methods from
VectorandPointonto theArray1trait, and rename it toArray. - Make pointer access methods on
Arraymatch the naming scheme of those in the standard library.
Removed
- Removed collision types:
Ray,Plane,Frustum,Aabb2,Aabb3Obb2,Obb3Sphere,Cylinder. These can now be found at csherratt/collision-rs. - Remove
Array2trait, moving methods onto theMatrixtrait.
-
0.4.025 Oct 2015Nothing published for this version
-
0.3.120 Sep 2015Nothing published for this version
-
0.3.020 Sep 2015Nothing published for this version
-
0.2.011 May 2015Nothing published for this version
-
0.1.610 May 2015 withdrawnNothing published for this version
-
0.1.524 Apr 2015Nothing published for this version
-
0.1.424 Apr 2015 withdrawnNothing published for this version
-
0.1.307 Apr 2015Nothing published for this version
-
0.1.201 Apr 2015Nothing published for this version
-
0.1.126 Mar 2015Nothing published for this version
-
0.1.015 Mar 2015Nothing published for this version
-
0.0.809 Mar 2015Nothing published for this version
-
0.0.701 Mar 2015Nothing published for this version
-
0.0.621 Feb 2015Nothing published for this version
-
0.0.517 Feb 2015Nothing published for this version
-
0.0.412 Feb 2015Nothing published for this version
-
0.0.308 Feb 2015Nothing published for this version
-
0.0.201 Feb 2015Nothing published for this version