Skip to content

Commit 1d117e5

Browse files
committed
Merge branch 'master' into 310-fix_flat_triangles
2 parents 19660d0 + a84ab9e commit 1d117e5

89 files changed

Lines changed: 6134 additions & 4896 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/parry-ci-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
run: cargo check --features enhanced-determinism
4646
- name: Run tests
4747
run: cargo test --features wavefront
48+
- name: Run tests
49+
run: cargo test --features parallel
4850
build-wasm:
4951
runs-on: ubuntu-latest
5052
env:
@@ -69,6 +71,8 @@ jobs:
6971
run: cargo build --verbose --no-default-features --features required-features --target=x86_64-unknown-linux-gnu
7072
- name: build thumbv7em-none-eabihf
7173
run: cargo build --verbose --no-default-features --features required-features --target=thumbv7em-none-eabihf
74+
- name: build thumbv7em-none-eabihf with alloc
75+
run: cargo build --verbose --no-default-features --features required-features,alloc --target=thumbv7em-none-eabihf
7276
build-doc:
7377
runs-on: ubuntu-latest
7478
env:

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
1-
# Change Log
1+
# 0.22.0-beta.1
2+
3+
### Fixed
4+
5+
- Fix invalid BVH state that could be reached after a removal resulting in a partial root.
6+
7+
# 0.22.0-beta.0
8+
9+
### Added
10+
11+
- Add a new `Bvh` acceleration data-structure. It replaces `Qbvh` entirely. It supports:
12+
- Traversals (best-first, depth-first, BVTT, leaf iterators, and leaf pairs iterator).
13+
- It can be constructed either incrementally by inserting nodes, or from a set of leaves using either the
14+
binned building strategy or the PLOC (without parallelism) strategy.
15+
- Dynamic leaf insertion, update, removal.
16+
- Incremental tree rebalancing.
17+
18+
### Fixed
19+
20+
- Fix `clip_aabb_line` crashing when given incorrect inputs (zero length direction or NAN).
21+
- Fix `Segment::intersects_ray` returning false-positive when the segment is zero-length. ([#31](https://github.com/dimforge/parry/issues/31)).
22+
- Expose `utils::sort3` and `utils::sort2`.
23+
24+
### Modified
25+
26+
- The `local_point_cloud_aabb`, `point_cloud_aabb`, and `Aabb::from_points` now takes an iterator over point values instead
27+
of an iterator to point references. Variants taking point references still exist and are named `local_point_cloud_aabb_ref`,
28+
`point_cloud_aabb_ref` and `Aabb::from_points_ref`.
29+
- Renamed `SimdCompositeShape` and `TypedSimdCompositeShape` to `CompositeShape` and TypedCompositeShape`.
30+
- The `TypedCompositeShape` trait now derives from `CompositeShape`.
31+
- Removed every `*Visitor` structures. Instead, either call `Bvh::traverse` (or `Bvh::search_best`, or `Bvh::leaves`, or
32+
`bvh::leaf_pairs`), or wrap your composite shape into `CompositeShapeRef` to access some generic implementation of
33+
various geometric queries for any composite shape.
34+
- All composite shapes now rely on the new `Bvh` acceleration structure instead of `Qbvh`.
35+
- The `Qbvh` has been removed. Use `Bvh` instead.
236

337
## 0.21.1
438

crates/parry2d-f64/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "parry2d-f64"
3-
version = "0.21.1"
3+
version = "0.22.0-beta.1"
44
authors = ["Sébastien Crozet <developer@crozet.re>"]
55

66
description = "2 dimensional collision detection library in Rust. 64-bit precision version."
@@ -89,6 +89,7 @@ log = "0.4"
8989
ordered-float = { version = "5", default-features = false }
9090
thiserror = { version = "2", default-features = false }
9191
ena = { version = "0.14.3", optional = true, default-features = false }
92+
smallvec = "1"
9293

9394
[dev-dependencies]
9495
simba = { version = "0.9", default-features = false }

crates/parry2d/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "parry2d"
3-
version = "0.21.1"
3+
version = "0.22.0-beta.1"
44
authors = ["Sébastien Crozet <developer@crozet.re>"]
55

66
description = "2 dimensional collision detection library in Rust."
@@ -89,6 +89,7 @@ ordered-float = { version = "5", default-features = false }
8989
log = "0.4"
9090
thiserror = { version = "2", default-features = false }
9191
ena = { version = "0.14.3", optional = true, default-features = false }
92+
smallvec = "1"
9293

9394
[dev-dependencies]
9495
simba = { version = "0.9", default-features = false }

crates/parry3d-f64/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "parry3d-f64"
3-
version = "0.21.1"
3+
version = "0.22.0-beta.1"
44
authors = ["Sébastien Crozet <developer@crozet.re>"]
55

66
description = "3 dimensional collision detection library in Rust. 64-bits precision version."
@@ -89,6 +89,7 @@ bytemuck = { version = "1", features = ["derive"], optional = true }
8989
rstar = "0.12.0"
9090
obj = { version = "0.10.2", optional = true }
9191
ena = { version = "0.14.3", optional = true, default-features = false }
92+
smallvec = "1"
9293

9394
log = "0.4"
9495
ordered-float = { version = "5", default-features = false }

crates/parry3d/Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "parry3d"
3-
version = "0.21.1"
3+
version = "0.22.0-beta.1"
44
authors = ["Sébastien Crozet <developer@crozet.re>"]
55

66
description = "3 dimensional collision detection library in Rust."
@@ -59,7 +59,7 @@ improved_fixed_point_support = []
5959

6060
# Do not enable this feature directly. It is automatically
6161
# enabled with the "simd-stable" or "simd-nightly" feature.
62-
simd-is-enabled = []
62+
simd-is-enabled = [ "glam" ]
6363

6464
[lib]
6565
name = "parry3d"
@@ -92,6 +92,13 @@ thiserror = { version = "2", default-features = false }
9292
rstar = "0.12.0"
9393
obj = { version = "0.10.2", optional = true }
9494
ena = { version = "0.14.3", optional = true, default-features = false }
95+
smallvec = "1"
96+
static_assertions = "1"
97+
98+
# NOTE: needed only for element_min for SIMD BVH ray-casting.
99+
# can be removed once `wide` supports it (and allows filtering-out the
100+
# fourth element).
101+
glam = { version = "0.30.4", optional = true }
95102

96103
[dev-dependencies]
97104
oorandom = "11"

crates/parry3d/tests/geometry/convex_hull.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,7 +4061,9 @@ fn test_complex_convex_hull() {
40614061
];
40624062

40634063
let (vertices, indices) = transformation::convex_hull(&input);
4064-
transformation::check_convex_hull(&vertices, &indices);
4064+
if let Err(error) = transformation::check_convex_hull(&vertices, &indices) {
4065+
panic!("{}", error);
4066+
}
40654067
}
40664068

40674069
#[test]
@@ -4078,5 +4080,7 @@ fn test_planar_convex_hull() {
40784080
];
40794081

40804082
let (vertices, indices) = transformation::convex_hull(&input);
4081-
transformation::check_convex_hull(&vertices, &indices);
4083+
if let Err(error) = transformation::check_convex_hull(&vertices, &indices) {
4084+
panic!("{}", error);
4085+
}
40824086
}

src/bounding_volume/aabb.rs

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use na;
99
use num::Bounded;
1010

1111
#[cfg(all(feature = "dim3", not(feature = "std")))]
12-
use na::ComplexField; // for .sin_cos()
12+
use na::ComplexField;
13+
// for .sin_cos()
1314

1415
use crate::query::{Ray, RayCast};
1516
#[cfg(feature = "rkyv")]
@@ -143,10 +144,18 @@ impl Aabb {
143144
Self::new(center - half_extents, center + half_extents)
144145
}
145146

146-
/// Creates a new `Aabb` from a set of points.
147-
pub fn from_points<'a, I>(pts: I) -> Self
147+
/// Creates a new `Aabb` from a set of point references.
148+
pub fn from_points_ref<'a, I>(pts: I) -> Self
148149
where
149150
I: IntoIterator<Item = &'a Point<Real>>,
151+
{
152+
super::aabb_utils::local_point_cloud_aabb(pts.into_iter().copied())
153+
}
154+
155+
/// Creates a new `Aabb` from a set of points.
156+
pub fn from_points<I>(pts: I) -> Self
157+
where
158+
I: IntoIterator<Item = Point<Real>>,
150159
{
151160
super::aabb_utils::local_point_cloud_aabb(pts)
152161
}
@@ -174,6 +183,28 @@ impl Aabb {
174183
return extents.x * extents.y * extents.z;
175184
}
176185

186+
/// In 3D, returns the half-area. In 2D returns the half-perimeter of the AABB.
187+
pub fn half_area_or_perimeter(&self) -> Real {
188+
#[cfg(feature = "dim2")]
189+
return self.half_perimeter();
190+
#[cfg(feature = "dim3")]
191+
return self.half_area();
192+
}
193+
194+
/// The half perimeter of this `Aabb`.
195+
#[cfg(feature = "dim2")]
196+
pub fn half_perimeter(&self) -> Real {
197+
let extents = self.extents();
198+
extents.x + extents.y
199+
}
200+
201+
/// The half area of this `Aabb`.
202+
#[cfg(feature = "dim3")]
203+
pub fn half_area(&self) -> Real {
204+
let extents = self.extents();
205+
extents.x * (extents.y + extents.z) + extents.y * extents.z
206+
}
207+
177208
/// The extents of this `Aabb`.
178209
#[inline]
179210
pub fn extents(&self) -> Vector<Real> {
@@ -251,6 +282,15 @@ impl Aabb {
251282
true
252283
}
253284

285+
/// Computes the distance between the origin and this AABB.
286+
pub fn distance_to_origin(&self) -> Real {
287+
self.mins
288+
.coords
289+
.sup(&-self.maxs.coords)
290+
.sup(&Vector::zeros())
291+
.norm()
292+
}
293+
254294
/// Does this AABB intersects an AABB `aabb2` moving at velocity `vel12` relative to `self`?
255295
#[inline]
256296
pub fn intersects_moving_aabb(&self, aabb2: &Self, vel12: Vector<Real>) -> bool {

src/bounding_volume/aabb_convex_polygon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ impl ConvexPolygon {
66
/// Computes the world-space [`Aabb`] of this convex polygon, transformed by `pos`.
77
#[inline]
88
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
9-
super::details::point_cloud_aabb(pos, self.points())
9+
super::details::point_cloud_aabb_ref(pos, self.points())
1010
}
1111

1212
/// Computes the local-space [`Aabb`] of this convex polygon.
1313
#[inline]
1414
pub fn local_aabb(&self) -> Aabb {
15-
super::details::local_point_cloud_aabb(self.points())
15+
super::details::local_point_cloud_aabb_ref(self.points())
1616
}
1717
}

src/bounding_volume/aabb_convex_polyhedron.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ impl ConvexPolyhedron {
66
/// Computes the world-space [`Aabb`] of this convex polyhedron, transformed by `pos`.
77
#[inline]
88
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
9-
super::details::point_cloud_aabb(pos, self.points())
9+
super::details::point_cloud_aabb_ref(pos, self.points())
1010
}
1111

1212
/// Computes the local-space [`Aabb`] of this convex polyhedron.
1313
#[inline]
1414
pub fn local_aabb(&self) -> Aabb {
15-
super::details::local_point_cloud_aabb(self.points())
15+
super::details::local_point_cloud_aabb_ref(self.points())
1616
}
1717
}

0 commit comments

Comments
 (0)