Re: [osg-users] Draw line in 3D screen

2012-01-12 Thread Lalit Manchwari
Hi,

Thks Robert and Shayne

I solve my problem with your direction.


Cheers,
Lalit

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





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


Re: [osg-users] Draw line in 3D screen

2012-01-10 Thread Robert Osfield
Hi Lalit,

In the past I've tackled problems like drawing from mouse coords into
3D by creating a ray from the mouse coords and then intersecting this
with a plane.  The maths for computing the intersection point can be
handled by the osg::Plane class, there is no need to use the high
level scene graph intersection routines.

For you application only you will be able to answer how you want to
constrain the points you want to generate - would a plane that is
orthogonal to the image plane and going through the mid point of the
data cloud be appropriate?  You'll need to decide yourself what is
appropriate.

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


Re: [osg-users] Draw line in 3D screen

2012-01-09 Thread Lalit Manchwari
Dear Robert:

Thanks for input. I am trying to re-phrase my question.

I have loaded a 3D data (X,Y,Z) on screen and can see these points as in 
screenshot_1. Also, I can, using mouse, draw line through these points (also 
shown.) However, if I want to draw a line as shown in screenshot_2, I am not 
able to do this, as this line does not passes through any loaded data.
What can be the procedure to draw these lines using mouse which are not passing 
through any data point.


Thank you!

Cheers,
Lalit

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




Attachments: 
http://forum.openscenegraph.org//files/screenshot_2_123.jpg
http://forum.openscenegraph.org//files/screenshot_1_443.jpg


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


Re: [osg-users] Draw line in 3D screen

2012-01-09 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
In the absence of existing data, what are your constraints for drawing
these lines in 3D?

Can they be coplanar in 3D space?

From your description, it sounds like you're drawing a line with the
mouse using 3D picking on existing points in 3D. Is this correct?

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Lalit
Manchwari
Sent: Monday, January 09, 2012 5:50 AM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Draw line in 3D screen

Dear Robert:

Thanks for input. I am trying to re-phrase my question.

I have loaded a 3D data (X,Y,Z) on screen and can see these points as in
screenshot_1. Also, I can, using mouse, draw line through these points
(also shown.) However, if I want to draw a line as shown in
screenshot_2, I am not able to do this, as this line does not passes
through any loaded data.
What can be the procedure to draw these lines using mouse which are not
passing through any data point.


Thank you!

Cheers,
Lalit

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




Attachments: 
http://forum.openscenegraph.org//files/screenshot_2_123.jpg
http://forum.openscenegraph.org//files/screenshot_1_443.jpg


___
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


Re: [osg-users] Draw line in 3D screen

2012-01-09 Thread Lalit Manchwari
Dear Shayne

I use polytope to pick the 3D coordinate of data. 

……..
osg::ref_ptrosgUtil::PolytopeIntersector picker;
picker = new osgUtil::PolytopeIntersector(osgUtil::Intersector::WINDOW, x-w, 
y-h, x+w, y+h );
osgUtil::IntersectionVisitor iv( picker );
viewer-getCamera()-accept( iv );
if(picker-containsIntersections())
{
………
}

I picked first point in 3D data and similarly the second point. The primitive 
is set for these two points as LINES and a line gets drawn on screen.

osg::ref_ptrosg::Vec3Array points = new osg::Vec3Array; 
osg::ref_ptrosg::Vec4Array color = new osg::Vec4Array; 
osg::ref_ptrGeometry geometry( new osg::Geometry); 

points-push_back(..get first x,y,z using osgUtil::PolytopeIntersector()…); 
points-push_back(..get second  x,y,z using osgUtil::PolytopeIntersector()…);

color-push_back(osg::Vec4(1.0,0.0,0.0,1.0)); 
geometry -setVertexArray(points.get()); 
geometry -setColorArray(color.get()); 
geometry -setColorBinding(osg::Geometry::BIND_OVERALL); 
geometry -addPrimitiveSet(new osg::DrawArrays(GL_LINES,0, points-size()));

I cannot use polytope in the area where there are no data points.

I think my line drawing procedure is wrong and this is why I am not able to do 
so in those areas where there are no points.
A line can be anywhere, not necessarily through points, in this space for some 
applications.


Thank you!

Cheers,
Lalit

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





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


Re: [osg-users] Draw line in 3D screen

2012-01-06 Thread Robert Osfield
Hi Lalit,

I suspect you haven't got any replies because it's impossible to work
out what you are actually wanting to achieve with drawing your line -
you need to provide constraints on where you'd want to place the
vertices of the line, unless you tell us what these constraints might
be, we can't provide any guidance to you.

Robert.

On 2 December 2011 14:41, Lalit Manchwari manchwari.la...@gmail.com wrote:
 Hi,

 I am loading a large number of 3D points (X, Y, Z) on OSG.  I want to draw 
 line on screen not necessarily passing through loaded points.  I am using 
 osgUtil::PolytopeIntersector but it draws lines which essentially pass 
 through loaded points.  What can be done to draw line by movement of mouse 
 dynamically anywhere in screen, i.e. could have its nodes on the loaded 
 points and as well on the area where there are no loaded points.
 Thank you!

 Cheers,
 Lalit

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





 ___
 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] Draw line in 3D screen

2011-12-20 Thread Tolga Yilmaz
Hi,
a simple line drawing code is below but i'm sure you want more complicated 
solition. Below you can update the start and end points on the fly by osgGA 
mouse movement.

Code:

osg::Vec3 sp(0,-180,120);
osg::Vec3 ep(0,480,120);
osg::ref_ptrGeometry beam( new osg::Geometry);
osg::ref_ptrosg::Vec3Array points = new osg::Vec3Array;
points-push_back(sp);
points-push_back(ep);
osg::ref_ptrosg::Vec4Array color = new osg::Vec4Array;
color-push_back(osg::Vec4(1.0,0.0,0.0,1.0));
beam-setVertexArray(points.get());
beam-setColorArray(color.get());
beam-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
beam-addPrimitiveSet(new osg::DrawArrays(GL_LINES,0,2));




Thank you!

Cheers,
Tolga

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





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


[osg-users] Draw line in 3D screen

2011-12-02 Thread Lalit Manchwari
Hi,

I am loading a large number of 3D points (X, Y, Z) on OSG.  I want to draw line 
on screen not necessarily passing through loaded points.  I am using 
osgUtil::PolytopeIntersector but it draws lines which essentially pass through 
loaded points.  What can be done to draw line by movement of mouse dynamically 
anywhere in screen, i.e. could have its nodes on the loaded points and as well 
on the area where there are no loaded points.
Thank you!

Cheers,
Lalit

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





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