dimforge / dimforge/ncollide

Point-in-mesh containment check which treats mesh as solid

Open
#317 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
926
Forks
104
PR merge metrics
No merged PRs in 30d

Description

This could use ray casting.

## Workaround

```rust
fn mesh_contains_point(mesh: &TriMesh, point: &Point3) -> bool {
if !mesh.aabb().contains_local_point(point) {
return false;
}

match mesh.toi_and_normal_with_ray(
&Isometry3::identity(),
&Ray::new(*point, Vector::new(T::one(), T::zero(), T::zero())),
false, // unused
) {
Some(intersection) => mesh.is_backface(intersection.feature),
None => false,
}
}
```

## Issues

1. Assumes mesh is well-formed (watertight and correctly wound)
2. Depends on ray casting for point queries, which is not necessarily ideal for keeping things modular

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.