[osg-users] intersect() methods in LineSegment (probably others)
Adrian Egli OpenSceneGraph (3D)
3dhelp at gmail.com
Wed Feb 6 07:05:00 PST 2008
Hi Andy,
I feel open to change to double if we are working with double precision as
internal representation. Or if we have double precsion in bounding sphere.
For all care about performance, i don't be sure this change will become much
slower as it is for the moment. But of course double is not as fast as
floating point operations are. Few weeks ago i sent to the submission one
change i did in the intersection test, it make the tri-checks a little
faster, but it's not yet in the current SVN. May we could take it first, and
check the correctness, then we can do the double fix.
But if you like to change the intersection test, you should take care about
the number of triangles check: at the moment the check is done in O(n).
there is a need of kd-tree support in line intersection (real time ray
tracing data structure for ray intersection test).
i know that i still mentioned to propose some line of code, but
unfortunatelly i never get the needed time slot for doing that. if you were
interest in it, please let me know. but this change will be one of the most
important with respect to performance w.r.t. line intersection tests.
(screenshots on openscenegraph webpages)
/adegli
2008/2/6, Andy Skinner <Andy.Skinner at mathworks.com>:
>
> I got the LineSegment::intersect() method to work when I converted the
> vectors you get from finding the difference between the start and the
> sphere center, and the difference between the start and the end, to
> Vec3d. You want the dot product to be in doubles.
>
> In my version, I get the difference in terms of Vec3, and then convert
> them to Vec3d. The rest of the method is in doubles until setting r1
> and r2. Another approach would be to change the internal representation
> of _e and _s to Vec3d, or maybe just keep _e - _s as a Vec3d so you
> don't have to subtract that one each time.
>
> So is anyone counting on this being floats for performance? Would
> anyone else welcome this calculation in doubles? I don't mind adding
> some code in our own source if other people don't want this in doubles,
> but I'd have to make my own IntersectVisitor as well as my own
> LineSegment, when all I really want to replace is the LineSegment.
> Having an almost-but-not-quite copy of a class and having to watch the
> original for updates doesn't sound like any fun. If I could get
> IntersectVisitor to use a class derived from LineSegment, with just the
> changes I want, that might not be bad.
>
> I think I'll submit a version of LineSegment, and you (Robert and the
> mailing list) can tell me what you think.
>
> andy
>
> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Andy
> Skinner
> Sent: Tuesday, February 05, 2008 8:57 AM
> To: OpenSceneGraph Users
> Subject: [osg-users] intersect() methods in LineSegment (probably
> others)
>
> I'm not sure what changed (in OSG or our code), but one of our unittests
> is failing on Windows as I try to upgrade our software to OSG 2.3.3.
> The picking I'm doing isn't hitting anything. It appears that the use
> of floats in the LineSegment::intersect(BoundingSphere) method may be
> hurting us.
>
> I've seen mentions on this in the list archives. Is the calculation
> done in this method done in float on purpose? If some of the
> intermediate value in this calculation were done in double, would it
> slow things down too much?
>
> We're squaring some large numbers and subtracting them from each other,
> and it isn't holding up for us. I'm going to experiment with doing some
> of this in double, but since it seems known that there are precision
> problems in this code, I wonder if it has remained in float for a
> reason.
>
> I could try to make an example for this, but because there seems to be
> an awareness of the issue, I'll raise it now.
>
> Thoughts?
>
> thanks
> andy
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
********************************************
Adrian Egli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080206/1677464f/attachment.htm
More information about the osg-users
mailing list