Re: [osg-users] LineSegmentIntersector which objects are returned?

2011-02-11 Thread Heiko Thiel
Hi Robert,


robertosfield wrote:
 Secondly the intersections you get returned return the leaf node and
 drawable that is intersected along with the node path from the root of
 the intersection traversal down to the leaf node that was intersected.


you found my problem: I forgot that the demo access only the leaf node, so I 
can solve may problem by searching right node on nodePath.

But I can't use nodePath like expected. To play a little bit with the nodePath 
I wanted to print all names of nodes

So my first try was:

Code:
bool nodeFound = false;
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = 
intersections.begin(); hitr != intersections.end(); ++hitr)
{
  osg::NodePath path = hitr-nodePath;
  for(osg::NodePath::iterator hitNodeIt = path = hitr-nodePath.begin(); 
hitNodeIt != path = hitr-nodePath.end(); ++hitNodeIt)
  {
if (hitNodeIt-getName())
{
  nodeFound = true;
  std::cout  hitNodeIt-getName();
}
  }
  if (nodeFound) break;
}



Then I got:

 IntelliSense: Es ist keine passende benutzerdefinierte Konvertierung von  
 std::_Vector_const_iteratorstd::_Vector_valosg::Node *, 
 std::allocatorosg::Node * in 
 std::_Vector_iteratorstd::_Vector_valosg::Node *, 
 std::allocatorosg::Node * vorhanden.


So I tried this:

Code:
bool nodeFound = false;
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = 
intersections.begin(); hitr != intersections.end(); ++hitr)
{
  for(osg::NodePath::const_iterator hitNodeIt = hitr-nodePath.begin(); 
hitNodeIt != hitr-nodePath.end(); ++hitNodeIt)
  {
if (hitNodeIt-getName())
{
  nodeFound = true;
  std::cout  hitNodeIt-getName();
}
  }
  if (nodeFound) break;
}


But this won't compile too:

 error C2039: 'getName': Ist kein Element von 
 'std::_Vector_const_iterator_Myvec'
 error C2839: Ungültiger Rückgabetyp 'osg::Node *const *' für überladenen 
 Operator '-'
 IntelliSense: Der Ausdruck muss den Typ pointer-to-class aufweisen.
 


Any idea?

Heiko

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





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


Re: [osg-users] LineSegmentIntersector which objects are returned?

2011-02-11 Thread Jean-Sébastien Guay

Hello Heiko,


But this won't compile too:


error C2039: 'getName': Ist kein Element von 
'std::_Vector_const_iterator_Myvec'
error C2839: Ungültiger Rückgabetyp 'osg::Node *const *' für überladenen Operator 
'-'
IntelliSense: Der Ausdruck muss den Typ pointer-to-class aufweisen.


Any idea?


I think you just need to check the types of what you're using... 
hitNodeIt is an osg::NodePath::iterator. This expands to 
std::vectorosg::Node*::iterator (you are in Visual Studio, so you can 
press F12 with the cursor on osg::NodePath to see what type it really 
is, you'll see it's a typedef of std::vectorosg::Node* or something 
similar). So to be able to call getName() you need to do:


(*hitNodeIt)-getName()

Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] LineSegmentIntersector which objects are returned?

2011-02-11 Thread Heiko Thiel
Hi,

you are right :). I tried this myself before and saw that VS show me 
nevertheless an error. But didnt seen that the error message changed (I had 
forgot the .empty() on comparism) ;)

Thank you!

Cheers,
Heiko

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





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


Re: [osg-users] LineSegmentIntersector which objects are returned?

2011-02-07 Thread Robert Osfield
Hi Heiko,

I'm afraid I can't work out what is going on from your description so
the best I can do is provide some general suggestions.

First up only polygonal meshes can be interested by
LineSegmentIntersector, so point clouds and lines will not return
intersections.

Secondly the intersections you get returned return the leaf node and
drawable that is intersected along with the node path from the root of
the intersection traversal down to the leaf node that was intersected.

Robert.

On Sun, Feb 6, 2011 at 11:12 PM, Heiko Thiel osgfo...@tevs.eu wrote:
 Hi,

 I have a simple question to LineSegmentIntersector: Which objects can be 
 intersect with the test ray?

 I ask because I have following problem: I have following osg tree:

 - Geode -Field
  - Node (Model loaded from disc) - Contains Name obj1 by Model (so not set 
 by my - don't want to presume that the name is everytime same)
  - Geode (single quad of the ground of terrain) - Name: Ground
   - Geometry (4 vertices)

 If I do now a klick I got following names returned: obj1, obj1, obj, ..., 
 Ground (Model is a Firetree - many intersections). But never the name 
 Field. So the problem is: I can't assume that the Model has name obj1. 
 That is why I think I must additional geode around it with an extra class, so 
 I can check with dynamic_cast if the test ray had found an interesting object 
 or not. But this don't work, if I dont get the Field-Geode returned.

 How to handle this problem? (osgPick-Demo is to simple to see a solution :( )

 Thank you!

 Cheers,
 Heiko

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





 ___
 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


[osg-users] LineSegmentIntersector which objects are returned?

2011-02-06 Thread Heiko Thiel
Hi,

I have a simple question to LineSegmentIntersector: Which objects can be 
intersect with the test ray?

I ask because I have following problem: I have following osg tree:

- Geode -Field
 - Node (Model loaded from disc) - Contains Name obj1 by Model (so not set 
by my - don't want to presume that the name is everytime same)
 - Geode (single quad of the ground of terrain) - Name: Ground
   - Geometry (4 vertices)

If I do now a klick I got following names returned: obj1, obj1, obj, ..., 
Ground (Model is a Firetree - many intersections). But never the name Field. 
So the problem is: I can't assume that the Model has name obj1. That is why I 
think I must additional geode around it with an extra class, so I can check 
with dynamic_cast if the test ray had found an interesting object or not. But 
this don't work, if I dont get the Field-Geode returned.

How to handle this problem? (osgPick-Demo is to simple to see a solution :( )

Thank you!

Cheers,
Heiko

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





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