Skip to content

Conversation

Vrixyz
Copy link
Contributor

@Vrixyz Vrixyz commented Jun 19, 2025

This approach is to wrap computation results into Results when it makes sense.

We can probably go further into this approach, and really hunt for any misconfiguration and return an error whenever the inputs don't make sense, but let's discuss this first.

I considered adding try variants, but it doesn't add too much value so I went straight to migrating to fallible everywhere.

indices: &[[u32; DIM]],
params: &VHACDParameters,
) -> Self {
) -> Option<Self> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit complicated to promote to fallible, because the input may contain multiple incorrect shapes.

behavior on master is to only return the shapes that the algorithm could make, and crash when NO shapes are able to be made.

This PR improves this by not crashing. It may be interesting to have more information about why it failed (and how to fix).

Copy link
Contributor Author

@Vrixyz Vrixyz Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a todo to improve error reporting (done, keeping the discussion open for discoverability)

}

/// Approximate convex decomposition using the VHACD algorithm.
#[derive(Debug)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few debug derive to help me with degugging

Comment on lines +243 to +244
right_ch = convex_hull(&right_ch_pts)
.unwrap_or_else(ConvexHullError::into_incorrect_empty);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of this behavior, but I think it makes sense to have an indicator at call site that the return may be incorrect (empty).

@Vrixyz Vrixyz force-pushed the 347-fallible_decomposition branch from d6e5bcb to 084efbc Compare June 19, 2025 13:53
@Vrixyz Vrixyz requested a review from sebcrozet June 25, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convex decomposition can panic
1 participant