-
-
Notifications
You must be signed in to change notification settings - Fork 123
Fallible methods for decomposition #348
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
base: master
Are you sure you want to change the base?
Conversation
indices: &[[u32; DIM]], | ||
params: &VHACDParameters, | ||
) -> Self { | ||
) -> Option<Self> { |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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)] |
There was a problem hiding this comment.
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
right_ch = convex_hull(&right_ch_pts) | ||
.unwrap_or_else(ConvexHullError::into_incorrect_empty); |
There was a problem hiding this comment.
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).
d6e5bcb
to
084efbc
Compare
This approach is to wrap computation results into
Result
s 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.