Skip to content

Fix RecoverParts transform order in public API#99

Merged
SarahWeiii merged 1 commit into
SarahWeiii:mainfrom
VMF-HIBIKI:fix-public-recoverparts-order
May 4, 2026
Merged

Fix RecoverParts transform order in public API#99
SarahWeiii merged 1 commit into
SarahWeiii:mainfrom
VMF-HIBIKI:fix-public-recoverparts-order

Conversation

@VMF-HIBIKI
Copy link
Copy Markdown
Contributor

This fixes the inverse transform order in public/coacd.cpp.

The public CoACD(...) path applies transforms in this order:

  1. Normalize()
  2. PCA() (optional)
  3. Compute()

So recovery must happen in reverse order:

  1. RevertPCA(rot)
  2. Recover(bbox)

Before this change, public/coacd.cpp::RecoverParts(...) called:

meshes[i].Recover(bbox);
meshes[i].RevertPCA(rot);

That rotates the translation restored by Recover(), which can offset the final convex hulls relative to the original mesh when PCA is enabled.

This patch makes the public wrapper consistent with the existing internal implementation in src/model_obj.cpp, which already applies:

meshes[i].RevertPCA(rot);
meshes[i].Recover(bbox);

Change scope is intentionally minimal: one line moved, no behavior changes outside the PCA recovery path.

@SarahWeiii SarahWeiii merged commit f8836b1 into SarahWeiii:main May 4, 2026
8 of 9 checks passed
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.

2 participants