Skip to content

Get 3D bounding box using scene graph? #663

Answered by mosra
asmaloney asked this question in Q&A
Discussion options

You must be logged in to vote

How precise do you want the bounding volume to be? Does it have to be a box, or is a bounding sphere okay as well? Is the scene static or can the transformation change?

A GL::Mesh doesn't contain any information about what's in it anymore, if you want to calculate a bounding volume, you have to do it from the vertex data before they're turned into a GL mesh. There is MeshTools::boundingSphereBouncingBubble() that gives you a bounding sphere, or MeshTools::boundingRange() (which is basically just a call to Math::minmax() inside) for a axis-aligned bounding box, all of them accept a list of three-component positions. If your meshes are imported as Trade::MeshData, you can pass mesh.attribut…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by asmaloney
Comment options

You must be logged in to vote
1 reply
@mosra
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants