Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-06 Thread Ale Maro
Hi Robert,

now it works fine! Thank you very much for the update.

Cheers,
Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74672#74672





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-05 Thread Robert Osfield
Hi Ale,

Thanks for the updating test program, this illustrates a separate bug
in the KdTree copy constructor.  I have added missing copying of the
indices:

~/OpenSceneGraph/src/osg$ git diff
diff --git a/src/osg/KdTree.cpp b/src/osg/KdTree.cpp
index 709c12f99..3f7a4a34a 100644
--- a/src/osg/KdTree.cpp
+++ b/src/osg/KdTree.cpp
@@ -492,6 +492,8 @@ KdTree::KdTree(const KdTree& rhs, const
osg::CopyOp& copyop):
 Shape(rhs, copyop),
 _degenerateCount(rhs._degenerateCount),
 _vertices(rhs._vertices),
+_primitiveIndices(rhs._primitiveIndices),
+_vertexIndices(rhs._vertexIndices),
 _kdNodes(rhs._kdNodes)
 {
 }

Could you test out the commit?


https://github.com/openscenegraph/OpenSceneGraph/commit/34d58d447d7f0b35d7bb20572a2f5d4fd26b7961

Cheers.
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-05 Thread Ale Maro
Hi Robert,

thanks for the update.
The issue with ShapeDrawable take us to the wrong way.

So at the end we find the cause of the problem is different.
I will describe it again:

1 - Take a geode (e.g. we loaded "cow.osg") and build a kdtree
2 - Make a clone with DEEP_COPY_ALL
3 - Applying LineSegmentIntersection to the clone we get the crash

If we clone with SHALLOW_COPY it works fine 

Attached is the modified osgPick example that reproduces the crash.
You just need to set the correct path to the file to be loaded and specify the 
--relative-camera-scene option as before

Here is an extract of the code. If you use a SHALLOW_COPY instead of 
DEEP_COPY_ALL it does not crash.

[code]
osg::MatrixTransform* xform = new osg::MatrixTransform();
osg::MatrixTransform* xform2 = new 
osg::MatrixTransform(osg::Matrix::translate(10.0,0.0,0.));

osg::ref_ptr kdtreeBuilder = NULL;
kdtreeBuilder = 
osgDB::Registry::instance()->getKdTreeBuilder()->clone();

xform->addChild(cow);
//  xform->accept(*kdtreeBuilder);

osg::Object * cow2 = cow->clone(osg::CopyOp::DEEP_COPY_ALL);

xform2->addChild(cow2->asNode());

group->addChild(xform);
group->addChild(xform2);
[\code]




Cheers,
Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74652#74652




Attachments: 
http://forum.openscenegraph.org//files/osgpick_not_working_865.cpp


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-04 Thread Robert Osfield
Hi Ale,

I have invested the issue further, focusing on why the sphere appears
fine when the KdTree isn't build, but disappears when it is.  I
tracked this issue down to the ShapeDrawable::setShape() being invoked
by the KdTreeBuilder that creates a KdTree for a ShapeDrawable then
assigns this KdTree to the ShapeDrawable via the Drawable::setShape()
method which in turn invokes the ShapeDrawable::build() method that
attempts to build a geometry from the KdTree.  It's a bit of circular
reference - KdTree wasn't ever meant to work with ShapeDrawable, it's
only now working because of the change of ShapeDrawable from
subclassing from Drawable to subclassing from Geometry.

To prevent the unintended rebuild I have disable the
ShapeDrawable::build() from doing anything when the shape assigned is
a KdTree.


https://github.com/openscenegraph/OpenSceneGraph/commit/5f9c6a01704e26e6760cc023e09ab1dcf0da1a15

There is still a bit of mismatch in that KdTree is a special case of a
Shape, but still a valid use.  Shape's were always intended to be used
for intersection testing and physics, but never originally intended to
support a ShapeDrawable.  The ShapeDrawable was a quick and easy thing
to add to help visualize primitive shapes but in hindsight I should
never have implemented it as it's misused too much by the community as
a serious means for drawing objects.  It's not possible to remove
ShapeDrawable without breaking lots of user applications so it's still
part of the OSG.  Please consider it just there for backwards
compatibility.

The above change is now checked into master and the OpenSceneGraph-3.6
branch. so it will be part of the 3.6.3 release I'll make this month.

Testing of these changes would be appreciated.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-04 Thread Ale Maro
Hi Robert,


I attached the stack trace for the modified osgPick example.

We analyzed the LineSegmentIntersector::intersect code (see below) and we saw 
that if we build KDTree AND the transofmation matrix has negative scale then 
"geometry->getVertexArray()" returns an empty array and "settings._vertices" 
becomes empty.
In debug an assert stops the execution (see stack trace), in release the 
execution continue but the geometry is not shown


Code:

void LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor& iv, 
osg::Drawable* drawable,
   const osg::Vec3d& s, const osg::Vec3d& e)
{
if (reachedLimit()) return;

LineSegmentIntersectorUtils::Settings settings;
settings._lineSegIntersector = this;
settings._iv = 
settings._drawable = drawable;
settings._limitOneIntersection = (_intersectionLimit == 
LIMIT_ONE_PER_DRAWABLE || _intersectionLimit == LIMIT_ONE);

osg::Geometry* geometry = drawable->asGeometry();
if (geometry)
{
settings._vertices = 
dynamic_cast(geometry->getVertexArray());
}






Cheers,
Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74635#74635




Attachments: 
http://forum.openscenegraph.org//files/stacktrace_370.txt


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-03 Thread Robert Osfield
Hi Ale,

I built with release.

I will try with a debug build.  A change in behaviour between release
a debug would suggest an unintialized variable.

Could you provide the stack trace.

A binary for Windows isn't required at this point.

Cheers,
Robert.
On Mon, 3 Sep 2018 at 15:00, Ale Maro  wrote:
>
> Hi Robert,
>
> thanks for the update.
>
> Have you built in release?
> We are seeing now that the release version has the behaviour you described 
> (that is also strange becouse I expect to see something… if you do not build 
> the KdTree in the code you can see the sphere).
>
> The debug version crashes (the assert Windows says there is a call to front() 
> of an empty vector).
>
> It is correct you run with the --relative-camera-scene command line option.
>
> If needed I can send you the Windows binaries of the example.
>
>
> Cheers,
> Ale
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74632#74632
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-03 Thread Ale Maro
Hi Robert,

thanks for the update.

Have you built in release? 
We are seeing now that the release version has the behaviour you described 
(that is also strange becouse I expect to see something… if you do not build 
the KdTree in the code you can see the sphere).

The debug version crashes (the assert Windows says there is a call to front() 
of an empty vector).

It is correct you run with the --relative-camera-scene command line option.

If needed I can send you the Windows binaries of the example.


Cheers,
Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74632#74632





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-09-03 Thread Robert Osfield
Hi Ale,

I have now built and run your test and it works fine for me.

I have run with the --relative-camera-scene command line option and I
don't see any cube or sphere, but I do see reports of hits.

This is testing with the 3.6  branch under Kubuntu 18.04.

At this point I don't have anything to go any further.  Ideally I need
a test case that I can reproduce a problem, and if this isn't straight
forward then I need stack traces of what is happening on your system.

Cheers,
Robert,
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-08-29 Thread Robert Osfield
On Wed, 29 Aug 2018 at 09:17, Ale Maro  wrote:
> sorry for asking again. Did you have time to take a look to my example?

Not yet. Still busy wrapping up the last week of the Exploration Phase
of the VSG project.  Next week I'll spend time on the OSG side and
will have a look.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-08-29 Thread Ale Maro
Hi Robert,

sorry for asking again. Did you have time to take a look to my example?

Thank you.

Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74617#74617





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-08-29 Thread Ale Maro
Hi Robert,

sorry for asking again. Did you have time to take a look to my example?

Thank you.

Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74616#74616





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-07-27 Thread Ale Maro
No special data needed.
The scene is built from code.

Cheers,
Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74400#74400





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-07-27 Thread Robert Osfield
Thanks for the test example.  I don't have time right now to look into
it, but once I've achieved a couple of milestones on my Vulkan work
I'll return to clear up outstanding OSG bugs. Do I need any special
data to reproduce the crash?
On Fri, 27 Jul 2018 at 09:24, Ale Maro  wrote:
>
> Hi Robert,
>
> my colleague reproduced the crash by modifying the osgPick example.
> He created a sphere with a negative scaling transformation, build the kdtree 
> and attached to the osgPick scene.
> It crashes at the first intersection calculation.
> If you do not build the kdtree or if the scaling transformation is positive 
> it does not crash.
>
> Attached is the modified osgPick.cpp
>
> Thank you.
>
> Best regards
> Ale
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74398#74398
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/osgpick_163.cpp
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-07-27 Thread Ale Maro
Hi Robert,

my colleague reproduced the crash by modifying the osgPick example.
He created a sphere with a negative scaling transformation, build the kdtree 
and attached to the osgPick scene.
It crashes at the first intersection calculation.
If you do not build the kdtree or if the scaling transformation is positive it 
does not crash.

Attached is the modified osgPick.cpp

Thank you.

Best regards
Ale

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74398#74398




Attachments: 
http://forum.openscenegraph.org//files/osgpick_163.cpp


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] RayIntersector with KdTree causes a crash

2018-07-26 Thread Robert Osfield
Hi Ale,

The KdTree was refactored in 3.6.x to add support for points and lines
and PolytopeIntersector.  While there has been lots of internal
changes in it, it of course shouldn't crash.

At this point in time I don't have any idea where the issue stems
from.  Could you create a small example that reproduces the crash, I
or others can then step through what is happening and work out a fix.

Given this regression it looks like we'll have to make a 3.6.3 sooner
rather than later, but not before we fix the crash...

Cheers,
Robert.
On Thu, 26 Jul 2018 at 10:39, Ale Maro  wrote:
>
> Hi,
>
> we have a problem with OSG 3.6.2 and Visual Studio 2017
>
> We have a pick functionality in our software that uses RayIntersector.
> We enabled KdTrees for this use.
>
> When we apply the intersector to an object with a negative scale in the 
> MatrixTransform parent node (e.g. scale = (-1, 1, 1)), it crashes inside the 
> KdTree code.
>
> If we disable kdtree everything works fine.
> It also works with Visual Studio 2013 and OSG 3.4.0.
>
> Here is the call stack when crashed:
>
>
> >
> > > osg157-osgUtild.dll!std::vector > > int,std::allocator >::operator[](const unsigned __int64 
> > > _Pos) Line 1818 C++
> >
> > osg157-osgUtild.dll!osg::KdTree::intersect
> >  > 
> > >(osg::TemplatePrimitiveFunctor
> >  > & functor, const osg::KdTree::KdNode & node) Line 160  C++
> >
> > osg157-osgUtild.dll!osg::KdTree::intersect
> >  > 
> > >(osg::TemplatePrimitiveFunctor
> >  > & functor, const osg::KdTree::KdNode & node) Line 176  C++
> >
> > osg157-osgUtild.dll!osg::KdTree::intersect
> >  > 
> > >(osg::TemplatePrimitiveFunctor
> >  > & functor, const osg::KdTree::KdNode & node) Line 176  C++
> >
> > osg157-osgUtild.dll!osgUtil::LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor
> >  & iv, osg::Drawable * drawable, const osg::Vec3d & s, const osg::Vec3d & 
> > e) Line 540 C++
> >
> > osg157-osgUtild.dll!osgUtil::RayIntersector::intersect(osgUtil::IntersectionVisitor
> >  & iv, osg::Drawable * drawable) Line 122  C++
> >
> > osg157-osgUtild.dll!osgUtil::IntersectionVisitor::intersect(osg::Drawable * 
> > drawable) Line 282   C++
> >
> > osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Geode & geode) 
> > Line 240 C++
> >osg157-osgd.dll!osg::Geode::accept(osg::NodeVisitor & nv) 
> > Line 37 C++
> >osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> > Line 63  C++
> >
> > osg157-osgFXd.dll!osgFX::Effect::inherited_traverse(osg::NodeVisitor & nv) 
> > Line 213  C++
> >osg157-osgFXd.dll!osgFX::Effect::traverse(osg::NodeVisitor & 
> > nv) Line 51  C++
> >osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> > Line 278C++
> >
> > osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> > Line 221   C++
> >osg157-osgFXd.dll!osgFX::Outline::accept(osg::NodeVisitor & 
> > nv) Line 54  C++
> >osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> > Line 63  C++
> >osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> > Line 278C++
> >
> > osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & 
> > transform) Line 417  C++
> >osg157-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform 
> > & node) Line 158  C++
> >
> > osg157-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv) Line 37 
> >C++
> >osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> > Line 63  C++
> >osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> > Line 278C++
> >
> > osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> > Line 221   C++
> >osg157-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv) 
> > Line 38  C++
> >osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> > Line 63  C++
> >osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> > Line 278C++
> >
> > osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & 
> > transform) Line 417  C++
> >osg157-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform 
> > & node) Line 158  C++
> >
> > osg157-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv) Line 37 
> >C++
> >osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> > Line 63  C++
> >osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> > Line 278   

[osg-users] RayIntersector with KdTree causes a crash

2018-07-26 Thread Ale Maro
Hi,

we have a problem with OSG 3.6.2 and Visual Studio 2017

We have a pick functionality in our software that uses RayIntersector.
We enabled KdTrees for this use.

When we apply the intersector to an object with a negative scale in the 
MatrixTransform parent node (e.g. scale = (-1, 1, 1)), it crashes inside the 
KdTree code.

If we disable kdtree everything works fine. 
It also works with Visual Studio 2013 and OSG 3.4.0. 

Here is the call stack when crashed:


> 
> > osg157-osgUtild.dll!std::vector > int,std::allocator >::operator[](const unsigned __int64 _Pos) 
> > Line 1818 C++
>
> osg157-osgUtild.dll!osg::KdTree::intersect
>  > 
> >(osg::TemplatePrimitiveFunctor
>  > & functor, const osg::KdTree::KdNode & node) Line 160  C++
>
> osg157-osgUtild.dll!osg::KdTree::intersect
>  > 
> >(osg::TemplatePrimitiveFunctor
>  > & functor, const osg::KdTree::KdNode & node) Line 176  C++
>
> osg157-osgUtild.dll!osg::KdTree::intersect
>  > 
> >(osg::TemplatePrimitiveFunctor
>  > & functor, const osg::KdTree::KdNode & node) Line 176  C++
>
> osg157-osgUtild.dll!osgUtil::LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor
>  & iv, osg::Drawable * drawable, const osg::Vec3d & s, const osg::Vec3d & e) 
> Line 540 C++
>
> osg157-osgUtild.dll!osgUtil::RayIntersector::intersect(osgUtil::IntersectionVisitor
>  & iv, osg::Drawable * drawable) Line 122  C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::intersect(osg::Drawable * 
> drawable) Line 282   C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Geode & geode) 
> Line 240 C++
>osg157-osgd.dll!osg::Geode::accept(osg::NodeVisitor & nv) Line 
> 37 C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>
> osg157-osgFXd.dll!osgFX::Effect::inherited_traverse(osg::NodeVisitor & nv) 
> Line 213  C++
>osg157-osgFXd.dll!osgFX::Effect::traverse(osg::NodeVisitor & 
> nv) Line 51  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>osg157-osgFXd.dll!osgFX::Outline::accept(osg::NodeVisitor & 
> nv) Line 54  C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & 
> transform) Line 417  C++
>osg157-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & 
> node) Line 158  C++
>osg157-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor 
> & nv) Line 37C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>osg157-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv) Line 
> 38  C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & 
> transform) Line 417  C++
>osg157-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & 
> node) Line 158  C++
>osg157-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor 
> & nv) Line 37C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>osg157-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv) Line 
> 38  C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>
> osg157-osgShadowd.dll!osgShadow::ShadowedScene::traverse(osg::NodeVisitor & 
> nv) Line 69  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>
> osg157-osgShadowd.dll!osgShadow::ShadowedScene::accept(osg::NodeVisitor & nv) 
> Line 36 C++
>  

[osg-users] RayIntersector with KdTree causes a crash

2018-07-26 Thread Ale Maro
Hi,

we have a problem with OSG 3.6.2 and Visual Studio 2017

We have a pick functionality in our software that uses RayIntersector.
We enabled KdTrees for this use.

When we apply the intersector to an object with a negative scale in the 
MatrixTransform parent node (e.g. scale = (-1, 1, 1)), it crashes inside the 
KdTree code.

If we disable kdtree everything works fine. 
It also works with Visual Studio 2013 and OSG 3.4.0. 

Here is the call stack when crashed:


> 
> > osg157-osgUtild.dll!std::vector > int,std::allocator >::operator[](const unsigned __int64 _Pos) 
> > Line 1818 C++
>
> osg157-osgUtild.dll!osg::KdTree::intersect
>  > 
> >(osg::TemplatePrimitiveFunctor
>  > & functor, const osg::KdTree::KdNode & node) Line 160  C++
>
> osg157-osgUtild.dll!osg::KdTree::intersect
>  > 
> >(osg::TemplatePrimitiveFunctor
>  > & functor, const osg::KdTree::KdNode & node) Line 176  C++
>
> osg157-osgUtild.dll!osg::KdTree::intersect
>  > 
> >(osg::TemplatePrimitiveFunctor
>  > & functor, const osg::KdTree::KdNode & node) Line 176  C++
>
> osg157-osgUtild.dll!osgUtil::LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor
>  & iv, osg::Drawable * drawable, const osg::Vec3d & s, const osg::Vec3d & e) 
> Line 540 C++
>
> osg157-osgUtild.dll!osgUtil::RayIntersector::intersect(osgUtil::IntersectionVisitor
>  & iv, osg::Drawable * drawable) Line 122  C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::intersect(osg::Drawable * 
> drawable) Line 282   C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Geode & geode) 
> Line 240 C++
>osg157-osgd.dll!osg::Geode::accept(osg::NodeVisitor & nv) Line 
> 37 C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>
> osg157-osgFXd.dll!osgFX::Effect::inherited_traverse(osg::NodeVisitor & nv) 
> Line 213  C++
>osg157-osgFXd.dll!osgFX::Effect::traverse(osg::NodeVisitor & 
> nv) Line 51  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>osg157-osgFXd.dll!osgFX::Outline::accept(osg::NodeVisitor & 
> nv) Line 54  C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & 
> transform) Line 417  C++
>osg157-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & 
> node) Line 158  C++
>osg157-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor 
> & nv) Line 37C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>osg157-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv) Line 
> 38  C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & 
> transform) Line 417  C++
>osg157-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & 
> node) Line 158  C++
>osg157-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor 
> & nv) Line 37C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>osg157-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv) Line 
> 38  C++
>osg157-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv) 
> Line 63  C++
>
> osg157-osgShadowd.dll!osgShadow::ShadowedScene::traverse(osg::NodeVisitor & 
> nv) Line 69  C++
>osg157-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node) 
> Line 278C++
>
> osg157-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Group & group) 
> Line 221   C++
>
> osg157-osgShadowd.dll!osgShadow::ShadowedScene::accept(osg::NodeVisitor & nv) 
> Line 36 C++
>