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

Generate bounding info from points #50

Open
2 of 3 tasks
ScanMountGoat opened this issue May 31, 2021 · 2 comments
Open
2 of 3 tasks

Generate bounding info from points #50

ScanMountGoat opened this issue May 31, 2021 · 2 comments
Labels
ssbh_data High level data access

Comments

@ScanMountGoat
Copy link
Member

ScanMountGoat commented May 31, 2021

This is required for creating new mesh files from existing data. The process can be automated using glam for a more efficient and correct implementation than requiring people to compute their own bounding information. The functionality can probably be it's own crate and be combined with normals, tangents, and other functions ported from SFGraphics.utils.

  • bounding sphere
  • axis-aligned bounding box
  • oriented bounding box
@ScanMountGoat ScanMountGoat added the ssbh_data High level data access label May 31, 2021
@ScanMountGoat
Copy link
Member Author

ScanMountGoat commented May 31, 2021

Oriented bounding boxes are currently using an approximation based off of the axis-aligned bounding box with an identity transform. This is the current behavior in StudioSB and produces a slightly less optimal solution than a version that allows rotation.

@ScanMountGoat
Copy link
Member Author

Oriented bounding boxes can be calculated using eigenvalue decomposition, but O(n^3) is too slow for meshes. A simple approach is to just rotate the AABB by the mesh transform. There are a number of efficient approximation algorithms if that approach ends up being too naive. https://doc.cgal.org/latest/Optimal_bounding_box/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ssbh_data High level data access
Projects
None yet
Development

No branches or pull requests

1 participant