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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org