Hi Lionel,
On 14 May 2014 10:59, Lionel Lagarde <[email protected]> wrote:
> The center() method exists in the BoundingBox interface. With the Bound
> interface you provide, this code would throw a seg fault:
> og::Vec3 c = geometry->getBound().center();
The Bound class that I have implemented so far only access the
BoundingSphere::center() and doesn't attempt to pass back the
BoundingBox::center(). As the BoundingSphere is always implemented
this code should never produce a seg fault.
>
> In order to avoid any modification of user code, the center method (and all
> the methods defined in the BoundingBox and the BoundingSphere classes) has
> to be redefined in the helper class:
> osg::Vec3 Bound::center() const
> {
> if (bb) return bb->center();
> return bs->center();
> }
>
> But it's a pity to return a new instance of Vec3 for BoundingSphere (it
> should be a const reference).
The BoundingBox::center() is really just a convenience method, it
doesn't access a variable in the way that the BoundingSphere::center()
does, so I'm incline not to implement a Bound::center() other than to
access the BoundingSphere::center().
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org