Re: [osg-users] Vertex picker - multiple selection

2011-11-25 Thread Leandro Motta Barros
Hi,

A naïve approach would be to use a LineSegmentIntersector towards each
of the points selected by the PolytopeIntersector (let's call this
point P). If P is not the first intersection found by the
LineSegmentIntersector (that is, it is not the closest to the camera),
it means that there is something occluding it (AKA it is not
visible).

I suppose this could easily become too inefficient if you have too
many points, though.

LMB


On Fri, Nov 25, 2011 at 8:23 AM, Aurelien Albert
aurelien.alb...@alyotech.fr wrote:
 Hi,

 I'm working on an application which allows the user to edit some vertex data 
 (vertex attributes array).

 To edit a vertex data, user pick it and edit values in a popup.

 I made multiple selection by picking multiple vertices holding shift key :
 Shift + clic add a vertex to current selection.

 I would like to make a rubber band selection.

 Look at the screen shot : the aim is to select all vertices in the red 
 rubber band.

 I think I can do this with a polytope intersector, but I have a problem : I 
 don't want to select all vertices that are in the polytope, only the vertices 
 that are visible to the user.

 Any idea on how can I do that ?

 Thanks !

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




 ___
 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] Vertex picker - multiple selection

2011-11-25 Thread Aurelien Albert
Hi,

That's naive, but it's also a good idea, I'll try that

Aurelien

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





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


Re: [osg-users] Vertex picker - multiple selection

2011-11-25 Thread Aurelien Albert
Hum... there's still a problem...

how can I retrieve intersected vertices from polytope intersection ?

From a LineSegmentIntersector, I use this code :


Code:
intersection is a osgUtil::LineSegmentIntersector::Intersection instance from 
LineSegmentIntersector

osg::Geometry* pGeometry = 
dynamic_castosg::Geometry*(intersection.drawable.get());

if (pGeometry != NULL)
{
osg::ref_ptrosg::Vec3Array pVertexArray = 
dynamic_castosg::Vec3Array*(pGeometry-getVertexArray()); 
if (pVertexArray != NULL)
{
for (unsigned int i=0; iintersection.indexList.size(); i++)
{
if ( (nearestVertexIndex = 0)  (nearestVertexIndex  
(int) pVertexArray-size()) )
{
addVertexToSelection(pGeometry, 
nearestVertexIndex);
}
}
}
}




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





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


Re: [osg-users] Vertex picker - multiple selection

2011-11-25 Thread Leandro Motta Barros
I've only used PolytopeIntersector to deal with point clouds. In this
case, osgUtil::PolytopeIntersector::getIntersections() returns what I
need (that is, all the points inside the polytope). I don't know,
however, what exactly it counts as intersections when dealing with
polygons. :-/

LMB

On Fri, Nov 25, 2011 at 1:37 PM, Aurelien Albert
aurelien.alb...@alyotech.fr wrote:
 Hum... there's still a problem...

 how can I retrieve intersected vertices from polytope intersection ?

 From a LineSegmentIntersector, I use this code :


 Code:
 intersection is a osgUtil::LineSegmentIntersector::Intersection instance from 
 LineSegmentIntersector

 osg::Geometry* pGeometry = 
 dynamic_castosg::Geometry*(intersection.drawable.get());

 if (pGeometry != NULL)
 {
        osg::ref_ptrosg::Vec3Array pVertexArray = 
 dynamic_castosg::Vec3Array*(pGeometry-getVertexArray());
        if (pVertexArray != NULL)
        {
                for (unsigned int i=0; iintersection.indexList.size(); i++)
                {
                        if ( (nearestVertexIndex = 0)  (nearestVertexIndex 
  (int) pVertexArray-size()) )
                        {
                                addVertexToSelection(pGeometry, 
 nearestVertexIndex);
                        }
                }
        }
 }




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





 ___
 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