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

Simplified mesh intersection logic #221

Merged
merged 48 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
598dda9
WIP simplified mesh interseciton logic
Jul 8, 2024
39f026d
Make mesh intersection code more robust
Jul 9, 2024
1781d71
Fixed logic errors and addet tests
Jul 11, 2024
7a1d967
add test data
Jul 11, 2024
c6e3adf
Hide wavefront functionality behind a feature flag
Jul 12, 2024
008517e
Merge remote-tracking branch 'origin/master' into improve_mesh_inters…
Jul 12, 2024
9a7b87a
Fix compilation errors
Jul 12, 2024
130d5f2
Fix CI
Jul 12, 2024
20502c5
Fix CI issues
Jul 12, 2024
b061752
Delete unused code
Jul 12, 2024
592455d
Simplift feature flag
Jul 12, 2024
4c7e50b
Fix PR comments
Jul 15, 2024
00577c5
Fix clippy issue
Jul 15, 2024
fdd2919
Remove accidental pastes
Jul 15, 2024
8416d1f
Fix compilation in no-std
Jul 15, 2024
fe57b27
Fix clippy
Jul 15, 2024
b001cc5
Fix Clippy
Jul 15, 2024
97c2b6c
Fix clippy
Jul 15, 2024
998dfcc
Address new PR comments
Jul 15, 2024
f8d272d
Make clippy happy
Jul 15, 2024
ff83f9d
Replace glob import with explicit items
Jul 15, 2024
a79b65a
Replace unwrap with error checking
Jul 15, 2024
5a1a187
Fix bug when finding smallest triangle angle
Jul 15, 2024
b155fbf
Fix spelling
Jul 15, 2024
e93a2cd
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
9a227fb
Update src/shape/triangle.rs
Makogan Jul 16, 2024
0a18f4c
Update src/shape/triangle.rs
Makogan Jul 16, 2024
5b24476
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
5d06a91
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
d870f38
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
cad8511
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
5b20345
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
2dd4e03
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
a1e7f79
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
0a19454
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
46b1c75
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
08038a0
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
c514027
Update src/transformation/mesh_intersection/mesh_intersection.rs
Makogan Jul 16, 2024
773b949
Update comment
Jul 16, 2024
7501a0b
Merge branch 'improve_mesh_intersection_code' of https://github.com/M…
Jul 16, 2024
8193b70
Fix formatting
Jul 16, 2024
56856d0
chore: move test assets to assets/tests
sebcrozet Jul 17, 2024
e888e0d
chore: move angle_closest_to_90 as a method of Triangle
sebcrozet Jul 17, 2024
bb9447d
fix: re-add sanitization of spade point coordinates
sebcrozet Jul 17, 2024
fce4c30
chore: minor coding style fixes
sebcrozet Jul 17, 2024
1f5217a
chore: update changelog
sebcrozet Jul 17, 2024
0fc0e89
Merge remote-tracking branch 'origin/master' into improve_mesh_inters…
sebcrozet Jul 17, 2024
24b8b93
chore: more changelog update
sebcrozet Jul 17, 2024
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
6 changes: 6 additions & 0 deletions crates/parry3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ simd-stable = ["simba/wide", "simd-is-enabled"]
simd-nightly = ["simba/portable_simd", "simd-is-enabled"]
enhanced-determinism = ["simba/libm_force", "indexmap"]
parallel = ["rayon"]
wavefront = ["obj"]

# Do not enable this feature directly. It is automatically
# enabled with the "simd-stable" or "simd-nightly" feature.
Expand Down Expand Up @@ -59,6 +60,11 @@ cust_core = { version = "0.1", optional = true }
spade = { version = "2", optional = true } # Make this optional?
rayon = { version = "1", optional = true }
bytemuck = { version = "1", features = ["derive"], optional = true }
rstar = "0.12.0"
obj = { version = "0.10.2", optional = true }

[target.'cfg(not(target_os = "cuda"))'.dependencies]
cust = { version = "0.3", optional = true }
Makogan marked this conversation as resolved.
Show resolved Hide resolved
log = "0.4"
ordered-float = { version = "4", default-features = false }
thiserror = { version = "1", optional = true }
Expand Down
1 change: 1 addition & 0 deletions crates/parry3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ bytemuck = { version = "1", features = ["derive"], optional = true }
log = "0.4"
ordered-float = { version = "4", default-features = false }
thiserror = { version = "1", optional = true }
rstar = "0.12.0"

[dev-dependencies]
oorandom = "11"
Expand Down
5 changes: 5 additions & 0 deletions src/query/point/point_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ impl PointProjection {
point: pos * self.point,
}
}

/// Returns `true` if `Self::is_inside` is `true` or if the distance between the projected point and `point` is smaller than `min_dist`.
pub fn is_inside_eps(&self, original_point: &Point<Real>, min_dist: Real) -> bool {
self.is_inside || na::distance_squared(original_point, &self.point) < min_dist * min_dist
}
}

/// Trait of objects that can be tested for point inclusion and projection.
Expand Down
2 changes: 2 additions & 0 deletions src/shape/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ impl Triangle {
/// product).
#[inline]
pub fn scaled_normal(&self) -> Vector<Real> {
// Note: on thin triangles this can cause numerical issues. A more robust
// way to do this is to look for the incident angle closest to 90 degrees.
Makogan marked this conversation as resolved.
Show resolved Hide resolved
let ab = self.b - self.a;
let ac = self.c - self.a;
ab.cross(&ac)
Expand Down
27 changes: 17 additions & 10 deletions src/shape/trimesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,25 @@ pub struct TriMeshTopology {
pub half_edges: Vec<TopoHalfEdge>,
}

impl TriMeshTopology {
#[cfg(feature = "dim3")]
pub(crate) fn face_half_edges_ids(&self, fid: u32) -> [u32; 3] {
let first_half_edge = self.faces[fid as usize].half_edge;

let mut result = [first_half_edge; 3];
for k in 1..3 {
let half_edge = self.half_edges[result[k - 1] as usize];
result[k] = half_edge.next;
#[cfg(all(feature = "std", feature = "cuda"))]
impl TriMeshTopology<CudaStorage> {
fn as_device_ptr(&self) -> TriMeshTopology<CudaStoragePtr> {
TriMeshTopology {
vertices: self.vertices.as_device_ptr(),
faces: self.faces.as_device_ptr(),
half_edges: self.half_edges.as_device_ptr(),
}
}
}

result
#[cfg(all(feature = "std", feature = "cuda"))]
impl TriMeshTopology<DefaultStorage> {
fn to_cuda(&self) -> CudaResult<TriMeshTopology<CudaStorage>> {
Ok(TriMeshTopology {
vertices: CudaArray1::new(&self.vertices)?,
faces: CudaArray1::new(&self.faces)?,
half_edges: CudaArray1::new(&self.half_edges)?,
})
Makogan marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Loading