I have written an OBJ Loader in REALbasic:
http://www.sqlabs.net/blog/2006/03/realbasic-obj-loader.html
Using vertex values is easy to calculate the radius of the bounding
sphere (using the abs value), but what is the best way to compute its
center?
It is safe to assume that the center is always 0,0,0 if I compute the
radius in this simple way:
if (abs(mMaxVertex.x) > Radius) then Radius = abs(mMaxVertex.x)
if (abs(mMaxVertex.y) > Radius) then Radius = abs(mMaxVertex.y)
if (abs(mMaxVertex.z) > Radius) then Radius = abs(mMaxVertex.z)
if (abs(mMinVertex.x) > Radius) then Radius = abs(mMinVertex.x)
if (abs(mMinVertex.y) > Radius) then Radius = abs(mMinVertex.y)
if (abs(mMinVertex.z) > Radius) then Radius = abs(mMinVertex.z)
mMaxVertex and mMinVertex are computed at load time.
Thanks a lot,
---
Marco Bambini
http://www.sqlabs.net
http://www.sqlabs.net/blog/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|