From: Sebastian M. <seb...@gm...> - 2012-10-24 16:46:22
|
Hello Kevin, > What does it mean to have an empty sphere? Or aabox for that matter. Is > it same as sphere volume == 0. Or is it a flag to signify something > else (I.e. No objects contained in). > > if vol == 0 then why not set the size to 0... If it is so you can > remember previous size, why distinguish 0 volume, why not and an N > volume switch... Why a switch at all... > > Excuse me for not knowing/remembering the purpose of mEmpty... Imagine you have BoundingVolume (Doesn't matter if it is a box or sphere) that is default initialized. Now if you use this object to extend an existing volume it will expand it in a wrong way. Since an empty sphere (i.e. radius == 0.0) still has an position it will expand the volume to be extended incorrectly. (For example you have sphere1 with pos(10,0,0) and r = 1 and an empty sphere (pos(0,0,0), radius=0). The extendVolume will produce a sphere of pos(5.5,0,0) radius = 6, which is wrong) The main purposes of the empty flag is to ignore those primitives and to check if it was initialized. Your approach testing the volume might work in this case, but it is surely not a general solution. So I vote for Paul's approach. cheers Sebastian P.S. Hi Paul, nice to see you outside the OSG mailing list ;-) > > Thanks, > > Sent from my Phone > From: Paul Martz > Sent: 10/23/2012 5:15 PM > To: ggt...@li... > Subject: [ggt-devel] Sphere emptiness > Hi all -- My project uses both gmtl::Sphere and gmtl::AABox as > bounding volumes. > But I've noticed that Sphere lacks the 'bool mEmpty' member variable that is > present in AABox. Is there a reason for this? If not, I'd like to add it. > > I would also modify Containment.h's extendVolume(Sphere&,...) to respect that > variable (as is already done for extendVolume(AABox&,...) ). Finally, I'd also > add new extendVolume() functions to extend Sphere around an AABox and > vice versa. > > Just wanted to see if there was a logical reason for the current > design before I > embarked on changing the code. I know that I can emulate the desired behavior > with a negative radius, but it seems to me it would be desirable to have this > functionality in gmtl rather than only in my project. > > Thanks, > -Paul > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > ggt-devel mailing list > ggt...@li... > https://lists.sourceforge.net/lists/listinfo/ggt-devel > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > ggt-devel mailing list > ggt...@li... > https://lists.sourceforge.net/lists/listinfo/ggt-devel |