dche / glm-rs Goto Github PK
View Code? Open in Web Editor NEWGLSL mathematics for Rust programming language.
License: MIT License
GLSL mathematics for Rust programming language.
License: MIT License
Due to the quickcheck dependency tree having a dependency on an old version of memchr, this crate won't compile for the wasm32-unknown-unknown target.
The link to the documentation gives a 404
With the soon to be stabilitized associated constants, I wonder if this project would greatly benefit for rewriting some of the Vec code to use them.
This would allow for Vec's to be not limited to 2,3,4, and allow the code to be more readable by having less macros around it. I am sure there are many other quick wins we could get from them on this project but these are the first couple that came to mind.
(unsure if this project is still maintained)
Just a feature request - have you thought about including quaternions? The library looks good, this is something that stands out as potentially missing for someone used to glm.
Just a heads up -- we recently added Float::epsilon
in rust-num/num#231, and then a Crater run showed that glm broke due to call ambiguity. See the logs here:
https://tools.taskcluster.net/task-inspector/#ytvixlBAQzCMhtWXQCM3fA/0
The ambiguous call is in your ApproxEq::is_approx_eq
, where Self::BaseType::epsilon
could now either mean Float::epsilon
or your BaseFloat::epsilon
. You could change it to a more explicit call to one of these choices. Or since you seem to just be extending Float
, you might remove your epsilon
. (Float
also now has to_degrees
and to_radians
, if you like.)
A new warning was introduced with Rust 1.4 which occurs in a few places in GLM. This warning will be upgraded to an error in the next version of Rust.
src/basenum.rs:72:1: 88:2 warning: the trait
core::marker::Sized
is not implemented for the typeSelf
[E0277]
src/basenum.rs:72 pub trait SignedNum
src/basenum.rs:73 : Neg<Output = Self>
src/basenum.rs:74 + Sub<Self, Output = Self>
src/basenum.rs:75 {
src/basenum.rs:76 /// Returns the absolute value of the receiver.
src/basenum.rs:77 fn abs(&self) -> Self;
...
src/basenum.rs:72:1: 88:2 help: runrustc --explain E0277
to see a detailed explanation
src/basenum.rs:72:1: 88:2 note:Self
does not have a constant size known at compile-time
src/basenum.rs:72:1: 88:2 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/basenum.rs:72 pub trait SignedNum
src/basenum.rs:73 : Neg<Output = Self>
src/basenum.rs:74 + Sub<Self, Output = Self>
src/basenum.rs:75 {
src/basenum.rs:76 /// Returns the absolute value of the receiver.
src/basenum.rs:77 fn abs(&self) -> Self;
...
src/basenum.rs:72:1: 88:2 note: required bycore::ops::Sub
src/basenum.rs:77:5: 77:27 warning: the traitcore::marker::Sized
is not implemented for the typeSelf
[E0277]
src/basenum.rs:77 fn abs(&self) -> Self;
^~~~~~~~~~~~~~~~~~~~~~
src/basenum.rs:77:5: 77:27 help: runrustc --explain E0277
to see a detailed explanation
src/basenum.rs:77:5: 77:27 note:Self
does not have a constant size known at compile-time
src/basenum.rs:77:5: 77:27 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/basenum.rs:77 fn abs(&self) -> Self;
^~~~~~~~~~~~~~~~~~~~~~
src/basenum.rs:77:5: 77:27 note: required bycore::ops::Sub
src/basenum.rs:87:5: 87:28 warning: the traitcore::marker::Sized
is not implemented for the typeSelf
[E0277]
src/basenum.rs:87 fn sign(&self) -> Self;
^~~~~~~~~~~~~~~~~~~~~~~
src/basenum.rs:87:5: 87:28 help: runrustc --explain E0277
to see a detailed explanation
src/basenum.rs:87:5: 87:28 note:Self
does not have a constant size known at compile-time
src/basenum.rs:87:5: 87:28 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/basenum.rs:87 fn sign(&self) -> Self;
^~~~~~~~~~~~~~~~~~~~~~~
src/basenum.rs:87:5: 87:28 note: required bycore::ops::Sub
src/mat/traits.rs:30:1: 78:2 warning: the traitmat::traits::GenMat<T, C>
is not implemented for the type<<Self as mat::traits::GenMat<T, C>>::Transpose as mat::traits::GenMat<T, <Self as mat::traits::GenMat<T, C>>::R>>::Transpose
[E0277]
src/mat/traits.rs:30 pub trait GenMat
src/mat/traits.rs:31 <
src/mat/traits.rs:32 T: BaseFloat,
src/mat/traits.rs:33 C: GenFloatVec
src/mat/traits.rs:34 >
src/mat/traits.rs:35 : Sized
...
src/mat/traits.rs:30:1: 78:2 help: runrustc --explain E0277
to see a detailed explanation
src/mat/traits.rs:30:1: 78:2 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/mat/traits.rs:30 pub trait GenMat
src/mat/traits.rs:31 <
src/mat/traits.rs:32 T: BaseFloat,
src/mat/traits.rs:33 C: GenFloatVec
src/mat/traits.rs:34 >
src/mat/traits.rs:35 : Sized
...
src/mat/traits.rs:30:1: 78:2 note: required bymat::traits::GenMat
src/mat/traits.rs:64:5: 64:44 warning: the traitmat::traits::GenMat<T, C>
is not implemented for the type<<Self as mat::traits::GenMat<T, C>>::Transpose as mat::traits::GenMat<T, <Self as mat::traits::GenMat<T, C>>::R>>::Transpose
[E0277]
src/mat/traits.rs:64 fn transpose(&self) -> Self::Transpose;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mat/traits.rs:64:5: 64:44 help: runrustc --explain E0277
to see a detailed explanation
src/mat/traits.rs:64:5: 64:44 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/mat/traits.rs:64 fn transpose(&self) -> Self::Transpose;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mat/traits.rs:64:5: 64:44 note: required bymat::traits::GenMat
src/mat/traits.rs:77:5: 77:41 warning: the traitmat::traits::GenMat<T, C>
is not implemented for the type<<Self as mat::traits::GenMat<T, C>>::Transpose as mat::traits::GenMat<T, <Self as mat::traits::GenMat<T, C>>::R>>::Transpose
[E0277]
src/mat/traits.rs:77 fn mul_c(&self, rhs: &Self) -> Self;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mat/traits.rs:77:5: 77:41 help: runrustc --explain E0277
to see a detailed explanation
src/mat/traits.rs:77:5: 77:41 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/mat/traits.rs:77 fn mul_c(&self, rhs: &Self) -> Self;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mat/traits.rs:77:5: 77:41 note: required bymat::traits::GenMat
src/builtin/matrix.rs:77:1: 89:2 warning: the traitmat::traits::GenMat<T, R>
is not implemented for the type<M as mat::traits::GenMat<T, C>>::Transpose
[E0277]
src/builtin/matrix.rs:77 pub fn outerProduct<
src/builtin/matrix.rs:78 T: BaseFloat,
src/builtin/matrix.rs:79 C: GenFloatVec,
src/builtin/matrix.rs:80 R: GenFloatVec,
src/builtin/matrix.rs:81 M: GenMat<T, C, R = R>
src/builtin/matrix.rs:82 >(c: C, r: R) -> M {
...
src/builtin/matrix.rs:77:1: 89:2 help: runrustc --explain E0277
to see a detailed explanation
src/builtin/matrix.rs:77:1: 89:2 note: this warning results from recent bug fixes and clarifications; it will become a HARD ERROR in the next release. See RFC 1214 for details.
src/builtin/matrix.rs:77 pub fn outerProduct<
src/builtin/matrix.rs:78 T: BaseFloat,
src/builtin/matrix.rs:79 C: GenFloatVec,
src/builtin/matrix.rs:80 R: GenFloatVec,
src/builtin/matrix.rs:81 M: GenMat<T, C, R = R>
src/builtin/matrix.rs:82 >(c: C, r: R) -> M {
...
src/builtin/matrix.rs:77:1: 89:2 note: required bymat::traits::GenMat
The basenum.rs
warnings are easy, just add + Sized
, I have no idea how to fix the warnings on the nested types though.
Hey is there a reason why for the various transformation functions like translate, rotate, etc, you borrow the matrix and move the vector? I'm not sure I understand why the transform needs to take ownership of the vector.
It isn't requires much code, just for vectors
impl<T: SignedNum + BaseNum> AddAssign for $t<T> {
fn add_assign(&mut self, rhs: Self) {
self = self + rhs;
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.