Skip to content

Commit

Permalink
implement feature_normal_at_point for trimesh
Browse files Browse the repository at this point in the history
  • Loading branch information
thefakeplace committed Feb 21, 2024
1 parent e57762f commit 239ad7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/shape/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,15 @@ impl Shape for TriMesh {
Real::frac_pi_4()
}

fn feature_normal_at_point(
&self,
feature: FeatureId,
point: &Point<Real>,
) -> Option<Unit<Vector<Real>>>
{
self.feature_normal_at_point(feature, point)
}

#[cfg(feature = "std")]
fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape> {
Some(self as &dyn SimdCompositeShape)
Expand Down
15 changes: 15 additions & 0 deletions src/shape/trimesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,21 @@ impl TriMesh {
)
})
}

/// Gets the normal of the triangle represented by `feature`.
pub fn feature_normal_at_point(
&self,
feature: FeatureId,
_point: &Point<Real>,
) -> Option<na::Unit<Vector<Real>>>
{
match feature {
FeatureId::Face(i) => self
.triangle(i % self.num_triangles() as u32)
.feature_normal(FeatureId::Face(0)),
_ => None,
}
}
}

impl<Storage: TriMeshStorage> GenericTriMesh<Storage> {
Expand Down

0 comments on commit 239ad7f

Please sign in to comment.