Sign in to follow this  
ahlywog

Finding the radius of an imported sphere?

Recommended Posts

when loading models vertices and storing them into VBO I flag the extents of the mesh to build a bounding box. You could use this to get you radius but you only need to get the max value one one axis in the case of a sphere. just loop though all vertices checking if the current ones x value is the largest (you could use y or z also)providing your sphere is centered at 0,0,0 this will give you your radius.

if its not at 0,0,0 then just get the max "x" value as above, also get the minimum value on the x-axis. subtract min from max and this will be the diameter then you can just divide by 2 to get the radius

unless the model format you export to stores such data as "radius of a sphere" I'm not aware of any other way.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this