Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R64 does not satisfy nalgebra::Real #18

Closed
alxarch opened this issue Aug 13, 2019 · 2 comments
Closed

R64 does not satisfy nalgebra::Real #18

alxarch opened this issue Aug 13, 2019 · 2 comments

Comments

@alxarch
Copy link

alxarch commented Aug 13, 2019

I get the following error while tryring to use magnitude() on a nalgebra::Vector3<decorum::R64>:

no method named `magnitude` found for type `na::Matrix<decorum::ConstrainedFloat<f64, decorum::constraint::FiniteConstraint<f64>>, na::U3, na::U1, na::ArrayStorage<decorum::ConstrainedFloat<f64, decorum::constraint::FiniteConstraint<f64>>, na::U3, na::U1>>` in the current scope

note: the method `magnitude` exists but the following trait bounds were not satisfied:
      `decorum::ConstrainedFloat<f64, decorum::constraint::FiniteConstraint<f64>> : na::Real`rustc(E0599)

The same problem comes up with normalize() but I can bypass using plexus::geomertry::ops::Normalize trait. Is this how it's supposed to be? Should I bypass the magnitude issue by implementing my own trait?

(I'm new to Rust, sorry if I'm missing something obvious here)

@olson-sean-k
Copy link
Owner

olson-sean-k commented Aug 13, 2019

Decorum's types do not implement alga's RealField trait, which is required for the magnitude and normalize APIs in nalgebra. This problem is being discussed in #16 and an issue was opened against alga as well.

I'm hoping that the requirements for RealField and ComplexField may be relaxed. Depending on that discussion, I may implement RealField behind a Cargo feature.

If you're using Plexus, I recommend using a recent commit from master, as the last release on crates.io is quite stale. Plexus now abstracts Euclidean spaces using the Theon crate, which provides APIs that include Euclidean norms and should support R64.

@alxarch
Copy link
Author

alxarch commented Aug 14, 2019

Will try that, thanks!

@alxarch alxarch closed this as completed Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants