Skip to content

Commit

Permalink
chore: update to nalgebra 0.33 (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet authored Jun 23, 2024
1 parent 990d421 commit 96f680f
Show file tree
Hide file tree
Showing 24 changed files with 145 additions and 188 deletions.
10 changes: 5 additions & 5 deletions crates/parry2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serde-serialize = ["serde", "nalgebra/serde-serialize", "arrayvec/serde", "bitfl
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]
simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/packed_simd", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
enhanced-determinism = ["simba/libm_force", "indexmap"]
parallel = ["rayon"]

Expand All @@ -47,14 +47,14 @@ num-traits = { version = "0.2", default-features = false }
smallvec = "1"
slab = { version = "0.4", optional = true }
arrayvec = { version = "0.7", default-features = false }
simba = { version = "0.8", default-features = false }
nalgebra = { version = "0.32", default-features = false, features = ["libm"] }
simba = { version = "0.9", default-features = false }
nalgebra = { version = "0.33", default-features = false, features = ["libm"] }
approx = { version = "0.5", default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }
rkyv = { version = "0.7.41", optional = true }
num-derive = "0.4"
indexmap = { version = "2", features = ["serde"], optional = true }
rustc-hash = { version = "1", optional = true }
rustc-hash = { version = "2", optional = true }
cust_core = { version = "0.1", optional = true }
spade = { version = "2", optional = true } # Make this optional?
rayon = { version = "1", optional = true }
Expand All @@ -64,7 +64,7 @@ ordered-float = { version = "4", default-features = false }
thiserror = { version = "1", optional = true }

[dev-dependencies]
simba = { version = "0.8", default-features = false, features = ["partial_fixed_point_support"] }
simba = { version = "0.9", default-features = false }
oorandom = "11"
ptree = "0.4.0"
rand = { version = "0.8" }
10 changes: 5 additions & 5 deletions crates/parry2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serde-serialize = ["serde", "nalgebra/serde-serialize", "arrayvec/serde", "bitfl
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]
simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/packed_simd", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
enhanced-determinism = ["simba/libm_force", "indexmap"]
parallel = ["rayon"]

Expand All @@ -47,14 +47,14 @@ num-traits = { version = "0.2", default-features = false }
smallvec = "1"
slab = { version = "0.4", optional = true }
arrayvec = { version = "0.7", default-features = false }
simba = { version = "0.8", default-features = false }
nalgebra = { version = "0.32", default-features = false, features = ["libm"] }
simba = { version = "0.9", default-features = false }
nalgebra = { version = "0.33", default-features = false, features = ["libm"] }
approx = { version = "0.5", default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }
rkyv = { version = "0.7.41", optional = true }
num-derive = "0.4"
indexmap = { version = "2", features = ["serde"], optional = true }
rustc-hash = { version = "1", optional = true }
rustc-hash = { version = "2", optional = true }
cust_core = { version = "0.1", optional = true }
spade = { version = "2", optional = true }
rayon = { version = "1", optional = true }
Expand All @@ -64,7 +64,7 @@ log = "0.4"
thiserror = { version = "1", optional = true }

[dev-dependencies]
simba = { version = "0.8", default-features = false, features = ["partial_fixed_point_support"] }
simba = { version = "0.9", default-features = false }
oorandom = "11"
ptree = "0.4.0"
rand = { version = "0.8" }
Expand Down
8 changes: 4 additions & 4 deletions crates/parry3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serde-serialize = ["serde", "nalgebra/serde-serialize", "bitflags/serde"]
rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize"]
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]
simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/packed_simd", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
enhanced-determinism = ["simba/libm_force", "indexmap"]
parallel = ["rayon"]

Expand All @@ -47,14 +47,14 @@ num-traits = { version = "0.2", default-features = false }
smallvec = "1"
slab = { version = "0.4", optional = true }
arrayvec = { version = "0.7", default-features = false }
simba = { version = "0.8", default-features = false }
nalgebra = { version = "0.32", default-features = false, features = ["libm"] }
simba = { version = "0.9", default-features = false }
nalgebra = { version = "0.33", default-features = false, features = ["libm"] }
approx = { version = "0.5", default-features = false }
serde = { version = "1.0", optional = true, features = ["derive", "rc"] }
rkyv = { version = "0.7.41", optional = true }
num-derive = "0.4"
indexmap = { version = "2", features = ["serde"], optional = true }
rustc-hash = { version = "1", optional = true }
rustc-hash = { version = "2", optional = true }
cust_core = { version = "0.1", optional = true }
spade = { version = "2", optional = true } # Make this optional?
rayon = { version = "1", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions crates/parry3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rkyv-serialize = ["rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-seri
bytemuck-serialize = ["bytemuck", "nalgebra/convert-bytemuck"]

simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/packed_simd", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
enhanced-determinism = ["simba/libm_force", "indexmap"]
parallel = ["rayon"]

Expand All @@ -48,14 +48,14 @@ num-traits = { version = "0.2", default-features = false }
smallvec = "1"
slab = { version = "0.4", optional = true }
arrayvec = { version = "0.7", default-features = false }
simba = { version = "0.8", default-features = false }
nalgebra = { version = "0.32", default-features = false, features = ["libm"] }
simba = { version = "0.9", default-features = false }
nalgebra = { version = "0.33", default-features = false, features = ["libm"] }
approx = { version = "0.5", default-features = false }
serde = { version = "1.0", optional = true, features = ["derive", "rc"] }
rkyv = { version = "0.7.41", optional = true }
num-derive = "0.4"
indexmap = { version = "2", features = ["serde"], optional = true }
rustc-hash = { version = "1", optional = true }
rustc-hash = { version = "2", optional = true }
cust_core = { version = "0.1", optional = true }
spade = { version = "2", optional = true } # Make this optional?
rayon = { version = "1", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ mod simd {
#[cfg(feature = "simd-is-enabled")]
mod simd {
#[cfg(all(feature = "simd-nightly", feature = "f32"))]
pub use simba::simd::{f32x4 as SimdReal, m32x4 as SimdBool};
pub use simba::simd::{f32x4 as SimdReal, mask32x4 as SimdBool};
#[cfg(all(feature = "simd-stable", feature = "f32"))]
pub use simba::simd::{WideBoolF32x4 as SimdBool, WideF32x4 as SimdReal};

#[cfg(all(feature = "simd-nightly", feature = "f64"))]
pub use simba::simd::{f64x4 as SimdReal, m64x4 as SimdBool};
pub use simba::simd::{f64x4 as SimdReal, mask64x4 as SimdBool};
#[cfg(all(feature = "simd-stable", feature = "f64"))]
pub use simba::simd::{WideBoolF64x4 as SimdBool, WideF64x4 as SimdReal};

Expand Down
12 changes: 6 additions & 6 deletions src/query/closest_points/closest_points_composite_shape_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ pub struct CompositeShapeAgainstShapeClosestPointsVisitor<'a, D: ?Sized, G1: ?Si
g2: &'a dyn Shape,
}

impl<'a, D: ?Sized, G1: ?Sized> CompositeShapeAgainstShapeClosestPointsVisitor<'a, D, G1>
impl<'a, D, G1> CompositeShapeAgainstShapeClosestPointsVisitor<'a, D, G1>
where
D: QueryDispatcher,
G1: TypedSimdCompositeShape,
D: ?Sized + QueryDispatcher,
G1: ?Sized + TypedSimdCompositeShape,
{
/// Initializes a visitor for computing the closest points between a composite-shape and a shape.
pub fn new(
Expand All @@ -83,11 +83,11 @@ where
}
}

impl<'a, D: ?Sized, G1: ?Sized> SimdBestFirstVisitor<G1::PartId, SimdAabb>
impl<'a, D, G1> SimdBestFirstVisitor<G1::PartId, SimdAabb>
for CompositeShapeAgainstShapeClosestPointsVisitor<'a, D, G1>
where
D: QueryDispatcher,
G1: TypedSimdCompositeShape,
D: ?Sized + QueryDispatcher,
G1: ?Sized + TypedSimdCompositeShape,
{
type Result = (G1::PartId, ClosestPoints);

Expand Down
6 changes: 3 additions & 3 deletions src/query/contact/contact_composite_shape_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ where
}

/// Best contact between a shape and a composite (`Mesh`, `Compound`) shape.
pub fn contact_shape_composite_shape<D: ?Sized, G2: ?Sized>(
pub fn contact_shape_composite_shape<D, G2>(
dispatcher: &D,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &G2,
prediction: Real,
) -> Option<Contact>
where
D: QueryDispatcher,
G2: SimdCompositeShape,
D: ?Sized + QueryDispatcher,
G2: ?Sized + SimdCompositeShape,
{
contact_composite_shape_shape(dispatcher, &pos12.inverse(), g2, g1, prediction)
.map(|c| c.flipped())
Expand Down
6 changes: 3 additions & 3 deletions src/query/contact/contact_support_map_support_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ where
/// The vector-typed result is the vector that should be passed as `init` for
/// subsequent executions of the algorithm. It is also the contact
/// normal (that points toward the outside of the first solid).
pub fn contact_support_map_support_map_with_params<G1: ?Sized, G2: ?Sized>(
pub fn contact_support_map_support_map_with_params<G1, G2>(
pos12: &Isometry<Real>,
g1: &G1,
g2: &G2,
Expand All @@ -46,8 +46,8 @@ pub fn contact_support_map_support_map_with_params<G1: ?Sized, G2: ?Sized>(
init_dir: Option<Unit<Vector<Real>>>,
) -> GJKResult
where
G1: SupportMap,
G2: SupportMap,
G1: ?Sized + SupportMap,
G2: ?Sized + SupportMap,
{
let dir = if let Some(init_dir) = init_dir {
init_dir
Expand Down
2 changes: 2 additions & 0 deletions src/query/contact_manifolds/contact_manifolds_workspace.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::multiple_bound_locations)] // for impl_downcast

use downcast_rs::{impl_downcast, DowncastSync};

use crate::query::contact_manifolds::{
Expand Down
18 changes: 9 additions & 9 deletions src/query/distance/distance_composite_shape_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use crate::utils::IsometryOpt;
use simba::simd::{SimdBool as _, SimdPartialOrd, SimdValue};

/// Smallest distance between a composite shape and any other shape.
pub fn distance_composite_shape_shape<D: ?Sized, G1: ?Sized>(
pub fn distance_composite_shape_shape<D, G1>(
dispatcher: &D,
pos12: &Isometry<Real>,
g1: &G1,
g2: &dyn Shape,
) -> Real
where
D: QueryDispatcher,
G1: TypedSimdCompositeShape,
D: ?Sized + QueryDispatcher,
G1: ?Sized + TypedSimdCompositeShape,
{
let mut visitor = CompositeShapeAgainstAnyDistanceVisitor::new(dispatcher, pos12, g1, g2);
g1.typed_qbvh()
Expand All @@ -26,15 +26,15 @@ where
}

/// Smallest distance between a shape and a composite shape.
pub fn distance_shape_composite_shape<D: ?Sized, G2: ?Sized>(
pub fn distance_shape_composite_shape<D, G2>(
dispatcher: &D,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &G2,
) -> Real
where
D: QueryDispatcher,
G2: TypedSimdCompositeShape,
D: ?Sized + QueryDispatcher,
G2: ?Sized + TypedSimdCompositeShape,
{
distance_composite_shape_shape(dispatcher, &pos12.inverse(), g2, g1)
}
Expand Down Expand Up @@ -71,11 +71,11 @@ impl<'a, D: ?Sized, G1: ?Sized + 'a> CompositeShapeAgainstAnyDistanceVisitor<'a,
}
}

impl<'a, D: ?Sized, G1: ?Sized> SimdBestFirstVisitor<G1::PartId, SimdAabb>
impl<'a, D, G1> SimdBestFirstVisitor<G1::PartId, SimdAabb>
for CompositeShapeAgainstAnyDistanceVisitor<'a, D, G1>
where
D: QueryDispatcher,
G1: TypedSimdCompositeShape,
D: ?Sized + QueryDispatcher,
G1: ?Sized + TypedSimdCompositeShape,
{
type Result = (G1::PartId, Real);

Expand Down
16 changes: 6 additions & 10 deletions src/query/distance/distance_support_map_support_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,27 @@ use na::{self, Unit};
use num::Bounded;

/// Distance between support-mapped shapes.
pub fn distance_support_map_support_map<G1: ?Sized, G2: ?Sized>(
pos12: &Isometry<Real>,
g1: &G1,
g2: &G2,
) -> Real
pub fn distance_support_map_support_map<G1, G2>(pos12: &Isometry<Real>, g1: &G1, g2: &G2) -> Real
where
G1: SupportMap,
G2: SupportMap,
G1: ?Sized + SupportMap,
G2: ?Sized + SupportMap,
{
distance_support_map_support_map_with_params(pos12, g1, g2, &mut VoronoiSimplex::new(), None)
}

/// Distance between support-mapped shapes.
///
/// This allows a more fine grained control other the underlying GJK algorigtm.
pub fn distance_support_map_support_map_with_params<G1: ?Sized, G2: ?Sized>(
pub fn distance_support_map_support_map_with_params<G1, G2>(
pos12: &Isometry<Real>,
g1: &G1,
g2: &G2,
simplex: &mut VoronoiSimplex,
init_dir: Option<Vector<Real>>,
) -> Real
where
G1: SupportMap,
G2: SupportMap,
G1: ?Sized + SupportMap,
G2: ?Sized + SupportMap,
{
// TODO: or m2.translation - m1.translation ?
let dir = init_dir.unwrap_or_else(|| -pos12.translation.vector);
Expand Down
13 changes: 5 additions & 8 deletions src/query/epa/epa2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,12 @@ impl EPA {
/// the EPA algorithm failed to compute the projection.
///
/// Return the projected point in the local-space of `g`.
pub fn project_origin<G: ?Sized>(
pub fn project_origin<G: ?Sized + SupportMap>(
&mut self,
m: &Isometry<Real>,
g: &G,
simplex: &VoronoiSimplex,
) -> Option<Point<Real>>
where
G: SupportMap,
{
) -> Option<Point<Real>> {
self.closest_points(&m.inverse(), g, &ConstantOrigin, simplex)
.map(|(p, _, _)| p)
}
Expand All @@ -155,16 +152,16 @@ impl EPA {
///
/// The origin is assumed to be located inside of the shape.
/// Returns `None` if the EPA fails to converge or if `g1` and `g2` are not penetrating.
pub fn closest_points<G1: ?Sized, G2: ?Sized>(
pub fn closest_points<G1, G2>(
&mut self,
pos12: &Isometry<Real>,
g1: &G1,
g2: &G2,
simplex: &VoronoiSimplex,
) -> Option<(Point<Real>, Point<Real>, Unit<Vector<Real>>)>
where
G1: SupportMap,
G2: SupportMap,
G1: ?Sized + SupportMap,
G2: ?Sized + SupportMap,
{
let _eps: Real = crate::math::DEFAULT_EPSILON;
let _eps_tol = _eps * 100.0;
Expand Down
13 changes: 5 additions & 8 deletions src/query/epa/epa3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,12 @@ impl EPA {
/// the EPA algorithm failed to compute the projection.
///
/// Return the projected point in the local-space of `g`.
pub fn project_origin<G: ?Sized>(
pub fn project_origin<G: ?Sized + SupportMap>(
&mut self,
m: &Isometry<Real>,
g: &G,
simplex: &VoronoiSimplex,
) -> Option<Point<Real>>
where
G: SupportMap,
{
) -> Option<Point<Real>> {
self.closest_points(&m.inverse(), g, &ConstantOrigin, simplex)
.map(|(p, _, _)| p)
}
Expand All @@ -205,16 +202,16 @@ impl EPA {
///
/// The origin is assumed to be located inside of the shape.
/// Returns `None` if the EPA fails to converge or if `g1` and `g2` are not penetrating.
pub fn closest_points<G1: ?Sized, G2: ?Sized>(
pub fn closest_points<G1, G2>(
&mut self,
pos12: &Isometry<Real>,
g1: &G1,
g2: &G2,
simplex: &VoronoiSimplex,
) -> Option<(Point<Real>, Point<Real>, Unit<Vector<Real>>)>
where
G1: SupportMap,
G2: SupportMap,
G1: ?Sized + SupportMap,
G2: ?Sized + SupportMap,
{
let _eps = crate::math::DEFAULT_EPSILON;
let _eps_tol = _eps * 100.0;
Expand Down
Loading

0 comments on commit 96f680f

Please sign in to comment.