oriented polyline#425
Conversation
a0a863e to
b906e3b
Compare
sebcrozet
left a comment
There was a problem hiding this comment.
Thank you for this PR!
Another modification that is needed is the behavior of the implementation of PointQuery for Polyline so it mirrors the trimesh behavior. If a Polyline is oriented, then a point starting inside of it should be considered to be its own projection.
See for example the case of an oriented TriMesh:
parry/src/query/point/point_composite_shape.rs
Lines 288 to 311 in ef63da4
| /// Pseudo-normals are a 2D-only feature; in 3D this is a no-op. 3D stub so | ||
| /// `set_flags`/`scaled`/`reverse` compile; mirrors `TriMesh`'s dim2 stub. | ||
| #[cfg(feature = "dim3")] | ||
| fn compute_pseudo_normals(&mut self) {} |
| /// Per-vertex outward pseudo-normals, present when [`PolylineFlags::ORIENTED`] is set; contact | ||
| /// normals are then clamped to one side so the polyline acts as a one-sided surface. | ||
| pseudo_normals: Option<Vec<Vector>>, | ||
| flags: PolylineFlags, |
There was a problem hiding this comment.
Since pseudo-normals (and the PolylineFlags as well) are only relevant in 2d, they should be excluded from 3d using #[cfg(feature = "dim2")].
| .1 | ||
| let (proj, _) = self.project_local_point_and_get_location(point, solid); | ||
|
|
||
| if solid && proj.is_inside { |
There was a problem hiding this comment.
I chose to use solid here arbitrarily because it made sense to me, but happy to drop to the literal is_inside case only
| } | ||
|
|
||
| #[inline] | ||
| #[allow(unused_mut)] // Because we need mut in 2D but not in 3D. |
There was a problem hiding this comment.
I think this function can be written a different way to exclude this, but chose this path so it would be mirror more of how the trimesh implementation solves the issue
|
I believe I have addressed all feedback -- I tried to follow the Trimesh patterns closely here. I've left inline comments, too. Thanks! |
closes #254
adds 2D version of TriMeshFlags::ORIENTED + TriMeshFlags::FixInternalEdges