Re: [Plib-devel] ssgaSpheres?
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2005-02-02 06:33:04
|
McEVOY, Nick wrote: > Bram Stolk wrote: > <...snip...> > >> bounds0: center=-0.124761,0.005011,0.317507 radius=1.860521 >> bounds1: center=0.000000,0.000000,-0.000000 radius=0.947555 >>...which looks wrong for three reasons: >>1) radius of non latlong sphere is roughly twice as big >>2) radii are not 1.0 >>3) center of bounding sphere for non latlong sphere is not 0,0,0 > > > I had a similar problem (and its still a problem nearly 3yrs later - I never > had time to dig deeper into the PLIB code) - but in my case I was loading a > sphere from AC3D (a 3D modelling tool) of radius 10 and centred at 0,0,0 - > but when I check its bounding sphere ... getBSphere() I got bounding sphere > radius return 17.9544 ??? And the centre of -1.27190,-0.726630,0.303701 ??? The code for computing a really tight bounding sphere around an object is horribly, horribly expensive. Since PLIB's bounding sphere is only used for optimising rendering, it doesn't need to be perfect. What it does is to compute the maximum and minimum X, Y and Z coordinates - uses that to find the median X, Y and Z and makes that the center of the sphere - the radius is the smallest sphere to enclose an axially aligned box that extends from (minX, minY, minZ) to (maxX, maxY, maxZ). If you follow that tortured explanation then you'll see that the bounding sphere for a sphere is not an exact fit for the sphere. Now - to take this one step further - an ssgaSphere is more than one ssgLeaf node. The system has to compute the sphere around each of those and then the sphere around those spheres. Don't sweat it. It's not *supposed* to be a tight fit - and it isn't. You could try to look for a more intelligent bsphere calculating algorithm - but unless it's REALLY efficient, we won't want it no matter how accurate it might be. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |