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

Update nalgebra to 0.33 #109

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rand = "0.8"
log = "0.4"
serde = { optional = true, version = "1", features = ["derive"] }
num = "0.4.0"
nalgebra = { version = "0.32.2", features = ["default", "serde-serialize"] }
nalgebra = { version = "0.33.0", features = ["default", "serde-serialize"] }
rayon = {optional = true, version = "1.8.1" }

[dev-dependencies]
Expand Down
20 changes: 11 additions & 9 deletions src/bounding_hierarchy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! This module defines the [`BoundingHierarchy`] trait.

use nalgebra::{ClosedAdd, ClosedDiv, ClosedMul, ClosedSub, Scalar, SimdPartialOrd};
use nalgebra::{
ClosedAddAssign, ClosedDivAssign, ClosedMulAssign, ClosedSubAssign, Scalar, SimdPartialOrd,
};
use num::{Float, FromPrimitive, Signed};

use crate::aabb::Bounded;
Expand All @@ -14,11 +16,11 @@ pub trait BHValue:
Scalar
+ Copy
+ FromPrimitive
+ ClosedSub
+ ClosedAdd
+ ClosedSubAssign
+ ClosedAddAssign
+ SimdPartialOrd
+ ClosedMul
+ ClosedDiv
+ ClosedMulAssign
+ ClosedDivAssign
+ Float
+ Signed
+ std::fmt::Display
Expand All @@ -29,11 +31,11 @@ impl<T> BHValue for T where
T: Scalar
+ Copy
+ FromPrimitive
+ ClosedSub
+ ClosedAdd
+ ClosedSubAssign
+ ClosedAddAssign
+ SimdPartialOrd
+ ClosedMul
+ ClosedDiv
+ ClosedMulAssign
+ ClosedDivAssign
+ Float
+ Signed
+ std::fmt::Display
Expand Down
8 changes: 5 additions & 3 deletions src/ray/ray_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
//! for axis aligned bounding boxes and triangles.

use crate::{aabb::Aabb, bounding_hierarchy::BHValue};
use nalgebra::{ClosedAdd, ClosedMul, ClosedSub, ComplexField, Point, SVector, SimdPartialOrd};
use nalgebra::{
ClosedAddAssign, ClosedMulAssign, ClosedSubAssign, ComplexField, Point, SVector, SimdPartialOrd,
};
use num::{Float, One, Zero};

use super::intersect_default::RayIntersection;
Expand Down Expand Up @@ -99,7 +101,7 @@ impl<T: BHValue, const D: usize> Ray<T, D> {
///
pub fn intersects_aabb(&self, aabb: &Aabb<T, D>) -> bool
where
T: ClosedSub + ClosedMul + Zero + PartialOrd + SimdPartialOrd,
T: ClosedSubAssign + ClosedMulAssign + Zero + PartialOrd + SimdPartialOrd,
{
self.ray_intersects_aabb(aabb)
}
Expand All @@ -118,7 +120,7 @@ impl<T: BHValue, const D: usize> Ray<T, D> {
c: &Point<T, D>,
) -> Intersection<T>
where
T: ClosedAdd + ClosedSub + ClosedMul + Zero + One + Float,
T: ClosedAddAssign + ClosedSubAssign + ClosedMulAssign + Zero + One + Float,
{
let a_to_b = *b - *a;
let a_to_c = *c - *a;
Expand Down