[osg-users] osg::LineSegment intersect with Box and Sphere inconsistency
Wojciech Lewandowski
w.p.lewandowski at gmail.com
Tue Apr 28 23:39:14 PDT 2015
Thanks, Looks good to me.
Wojtek
2015-04-27 21:22 GMT+02:00 Robert Osfield <robert.osfield at gmail.com>:
> Hi Wojtek,
>
> I have decided I'd rather change the method name and break the build
> rather than silently change the behaviour of method in a way that
> could break end user code. What I have gone for is:
>
> --- include/osg/LineSegment (revision 14855)
> +++ include/osg/LineSegment (working copy)
> @@ -44,45 +44,48 @@
>
> inline bool valid() const { return _s.valid() && _e.valid()
> && _s!=_e; }
>
> +
> /** return true if segment intersects BoundingBox. */
> bool intersect(const BoundingBox& bb) const;
>
> - /** return true if segment intersects BoundingBox
> - * and return the intersection ratios.
> + /** return true if segment intersects BoundingBox and
> + * set float ratios for the first and second intersections,
> where the ratio is 0.0 at the segment start point, and 1.0 at the
> segment end point.
> */
> - bool intersect(const BoundingBox& bb,float& r1,float& r2) const;
> + bool intersectAndComputeRatios(const BoundingBox& bb, float&
> ratioFromStartToEnd1, float& ratioFromStartToEnd2) const;
>
> - /** return true if segment intersects BoundingBox
> - * and return the intersection ratios.
> + /** return true if segment intersects BoundingBox and
> + * set double ratios for the first and second intersections,
> where the ratio is 0.0 at the segment start point, and 1.0 at the
> segment end point.
> */
> - bool intersect(const BoundingBox& bb,double& r1,double& r2) const;
> + bool intersectAndComputeRatios(const BoundingBox& bb, double&
> ratioFromStartToEnd1, double& ratioFromStartToEnd2) const;
>
> +
> /** return true if segment intersects BoundingSphere. */
> bool intersect(const BoundingSphere& bs) const;
>
> - /** return true if segment intersects BoundingSphere and return
> the
> - * intersection ratio.
> + /** return true if segment intersects BoundingSphere and
> + * set float ratios for the first and second intersections,
> where the ratio is 0.0 at the segment start point, and 1.0 at the
> segment end point.
> */
> - bool intersect(const BoundingSphere& bs,float& r1,float& r2)
> const;
> + bool intersectAndComputeRatios(const BoundingSphere& bs,
> float& ratioFromStartToEnd1, float& ratioFromStartToEnd2) const;
>
> - /** return true if segment intersects BoundingSphere and return
> the
> - * intersection ratio.
> + /** return true if segment intersects BoundingSphere and
> + * set double ratios for the first and second intersections,
> where the ratio is 0.0 at the segment start point, and 1.0 at the
> segment end point.
> */
> - bool intersect(const BoundingSphere& bs,double& r1,double& r2)
> const;
> + bool intersectAndComputeRatios(const BoundingSphere&
> bs,double& ratioFromStartToEnd1, double& ratioFromStartToEnd2) const;
>
> - /** return true if segment intersects triangle
> - * and set ratio long segment.
> + /** return true if segment intersects triangle and
> + * set float ratios where the ratio is 0.0 at the segment
> start point, and 1.0 at the segment end point.
> */
> - bool intersect(const Vec3f& v1,const Vec3f& v2,const Vec3f&
> v3,float& r);
> + bool intersect(const Vec3f& v1,const Vec3f& v2,const Vec3f&
> v3,float& ratioFromStartToEnd);
>
> - /** return true if segment intersects triangle
> - * and set ratio long segment.
> + /** return true if segment intersects triangle and
> + * set double ratios where the ratio is 0.0 at the segment
> start point, and 1.0 at the segment end point.
> */
> - bool intersect(const Vec3d& v1,const Vec3d& v2,const Vec3d&
> v3,double& r);
> + bool intersect(const Vec3d& v1,const Vec3d& v2,const Vec3d&
> v3,double& ratioFromStartToEnd);
>
> I hope this make sense. This change is now checked into svn/trunk.
>
> Cheers,
> Robert.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150429/6cc530a6/attachment-0003.htm>
More information about the osg-users
mailing list