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

Addressing fallibility issues #282

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/query/epa/epa3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl EPA {

let mut niter = 0;
let mut max_dist = Real::max_value();
let mut best_face_id = *self.heap.peek().unwrap();
let mut best_face_id = *self.heap.peek()?;
let mut old_dist = 0.0;

/*
Expand Down
5 changes: 3 additions & 2 deletions src/shape/convex_polyhedron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ impl ConvexPolyhedron {
/// This explicitly computes the convex hull of the given set of points. Use
/// Returns `None` if the convex hull computation failed.
pub fn from_convex_hull(points: &[Point<Real>]) -> Option<ConvexPolyhedron> {
let (vertices, indices) = crate::transformation::convex_hull(points);
Self::from_convex_mesh(vertices, &indices)
crate::transformation::try_convex_hull(points)
.ok()
.and_then(|(vertices, indices)| Self::from_convex_mesh(vertices, &indices))
}

/// Attempts to create a new solid assumed to be convex from the set of points and indices.
Expand Down