Jump to content
  • Advertisement
Sign in to follow this  
spiffycrony

Geometry.ComputeBoundingSphere Directx

This topic is 4090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to compute the object radius & centre using Geometry.ComputeBoundingSphere for a mesh object. This works fine for a small mesh say few hundreds of triangles. But for a larger say few thousands of triangles the objectRadius returned is 0 & objectcenter is NAN(not a number). Any clue of why this is happening? Dim vb As VertexBuffer = mesh_.VertexBuffer Dim vertexData As GraphicsStream = vb.Lock(0, 0, LockFlags.NoSystemLock) objectRadius = Geometry.ComputeBoundingSphere(vertexData, mesh_.NumberVertices, mesh_.VertexFormat, objectCenter) vb.Unlock() vb.Dispose()

Share this post


Link to post
Share on other sites
Advertisement
Going from this, your thread on cloning and your thread on loading meshes, I'd say there's something horribly wrong with the STL file you converted to .X [smile] If you have the file around in a modelling app, you might want to check the scale in the modelling app to see if the coordinates aren't plain huge. If so, scale it down a good amount, so the largest vertex coordinate fits comfortably into a float datatype.

Share this post


Link to post
Share on other sites
Thanks remigius.

When I scaled the model by say 10 then the Geometry.ComputeBoundingSphere and also the mesh.clone works fine.

The minxyz - -260.49, -83.99997, -70.0 and
maxxyz - 222.11, 84.00003, 70.0
which are all small enough to fit into a float data type. So I dont think it can cause an overflow. But still I couldnt find the reason as to why without scaling it causes problem in Geometry.ComputeBoundingSphere and mesh.clone(where some vertex coordinates are QNAN)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!