[osg-users] The problem disappeared! (problem with osgUtil::LineSegmentIntersector) Make it please in the next version.

Paul Melis paul at science.uva.nl
Thu Jul 31 05:23:21 PDT 2008


Hi,

There is definitely something fishy going on. With the attached 
extremely simple testcase (only 2 triangles, without any transform) and 
the normal osgpick example I indeed get no intersections at locations 
where there definitely should be some.

I think I've tracked this down to the fact that the triangles are 
aligned with the coordinate system axes, so the Y-planes defined by the 
bounding box are the same as the triangle planes. This results in 
intersection noise as, depending on numerical errors, the intersection 
found might be just outside the ray interval. Your museum scene's walls 
have the same problem, which is why you're getting those missing 
intersections.

Attached is an updated src/osgUtil/LineSegmentIntersector.cpp, which 
solves this for now by allowing the found intersection point to be a 
tiny bit beyond the end point of the segment. It also replaces the 
triangle intersection code with something that I can actually understand 
as the currect version is completely untransparent to me (and a 
surprising large amount of code for something so basic). I don't 
consider this a replacement as of yet as there are some things not 
completely equivalent to the current code (the r1, r2, r3 output 
parameters are not set). But maybe you find it useful for now.

Paul

GMD GammerMaxyandex.ru wrote:
> I decided my issue. I removed the code from the file. (as was the case previously in 2.5.2). The problem disappeared! Make it please in the next version.
>
> LineSegmentIntersector.cpp
>
> removed the code from the file: line 290 ..
>
> double epsilon = 1e-8;
> if ((s-e).length()<epsilon)
>  {    
>  osg::Vec3d delta_e_end = _end - e;
>  osg::Vec3d delta_s_start = _start - s;
>  double scale = 0.001;
>  s += (delta_s_start * scale);
>  e += (delta_e_end * scale);
>  }
>
>
>
> code version 2.5.2:
> s = _start;
> e = _end;
>
>
> The problem disappeared! Make it please in the next version.
>
>
>
> 28.07.08, 22:44, "GMD GammerMaxyandex.ru" <GammerMax at yandex.ru>:
>
>     > Here is the small example, where described problem appeares. Example is modified example of osgpick (chenged code which returns name of object and osg scene). To see this problem you must go in the deep of room (way is showen in 00.jpeg). Then you need make several clicks in different positions (movements bitween positions must be small) and you will see that cursor often falls throught the object over which cursor is (possible positions is showen on 11.jpg). There is two archives in attachement (with textures and without them). Code is in osgpick.zip file which taken from example osgpick. I hope this is enough to illustrate described problem. And I think it will be not good if this error appeares in this release (2.6.0).
>     > Thanks, Max.
>     > files:
>     > (download: enter number, click green button)
>     > http://narod.ru/disk/1711280000/osgpick.zip.html
>     > http://narod.ru/disk/1711073000/00.JPG.html
>     > http://narod.ru/disk/1711279000/11.JPG.html
>     > http://narod.ru/disk/1712663000/museum_with_textures.zip.html
>     > Thanks, Max.
>     > 28.07.08, 10:47, "GMD GammerMaxyandex.ru" <GammerMax at yandex.ru>:
>     > > Ok, I'll make small example and show where problem occures. I'll try do this today.
>     > > 28.07.08, 00:33, "sherman wilcox" <wilcox.sherman at gmail.com>:
>     > > > Can you make a small and simple prototype that *reliably* reproduces
>     > > > the problem? You have a better chance of getting help that way.
>     > > > On Sun, Jul 27, 2008 at 2:50 AM, GMD GammerMaxyandex.ru
>     > > > <GammerMax at yandex.ru> wrote:
>     > > > > Some offers of OSG 2.6.0( problems with new version).
>     > > > > Let's wait with OSG 2.6.0 release.  I asked this because I found a problem with osgUtil::LineSegmentIntersector function.
>     > > > > In OSG v 2.5.5 version of OSG function viewer->computeIntersections(x,y, hlist) works very strange - when cursor movements over object is short it(cursor) falls throught the object and function returns name of object which is behind current(object over which cursor is). In earlyer(less 2.5.2) versions of OSG this error has never appeared. How can I solve this problem in this(2.5.5) version of OSG?
>     > > > > It is necessary to solve the problem until  OSG 2.6.0 release.
>     > > > > Thanks in advance.  Best regards, Max.
>     > > > > _______________________________________________
>     > > > > osg-users mailing list
>     > > > > osg-users at lists.openscenegraph.org
>     > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>     > > > >
>     > > > _______________________________________________
>     > > > osg-users mailing list
>     > > > osg-users at lists.openscenegraph.org
>     > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tris.osg
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080731/6dfb17b8/attachment-0002.asc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LineSegmentIntersector.cpp
Type: text/x-c++src
Size: 16565 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080731/6dfb17b8/attachment-0003.cpp>


More information about the osg-users mailing list