Re: [osg-users] IntersectVisitor question

2007-08-28 Thread Dave Pugmire
Wow, so this is odd. I found a way to fix this.
I was using a linesegment length of 2.0, as I had a 2 ft stick attached 
to the wand. But, if I make the linesegment longer, to a length of 
200.0, the intersection works like a charm.
Is this the intended behavior?

Dave Pugmire wrote:
 Hi,
 I'm scratching my head on this one.
 I have a line segment, that is aligned to the tracked wand. I'm trying 
 to intersect it with the scene, which is composed of a single box.
 However, the intersections that I get are not making sense.
 
 Here is the line segment, made from two points:
 p1 = ( -.24, 5.5, .033 ) p2 = (-.24 5.5 -1.96)
 Note that this is a line of constant Y=5.5
 Length of 2 along the -Z direction.
 
 The box is cenetered at 0, 4.5, -1, and has unit dimensions.
 The bounding box of the box is:
 xyzMin = [-.5, 4, -1.5]  xyzMax = [.5, 5, -.5]
 The box has no transformations above it, it's a direct child of the 
 scene root.
 
 When I run IntersectVisitor on the graph, it detects an intersection 
 with the box at:  [-.17, 4.0, -.88]
 Which is NOT on the LineSegment.
 I'm confused.  Here is the code that I'm using.
 m_wandP1 and m_wandP2 are the two points mentioned above.
 
 
 Thanks,
 -dave
 
 
 void CWand::UpdateIntersect( osg::Group *pSceneRoot )
 {
  osg::Vec3 wandDir = m_wandP2 - m_wandP1;
 
  //Create a line segment for the wand end points.
 
  osg::ref_ptrosg::LineSegment wandStick = new osg::LineSegment( 
 m_wandP2, -wandDir );
 
  //Intersect with the scene graph.
  osgUtil::IntersectVisitor intersectVisitor;
  intersectVisitor.setLODSelectionMode( 
 osgUtil::IntersectVisitor::USE_HIGHEST_LEVEL_OF_DETAIL );
  intersectVisitor.addLineSegment( wandStick.get() );
  pSceneRoot-accept( intersectVisitor );
 
  if ( m_bPrintUpdate )
   printf( Poke: P0 %f %f %f P1 %f %f %f Dir:[%f %f %f]\n\n,
   m_wandP1[0],m_wandP1[1],m_wandP1[2], 
 m_wandP2[0],m_wandP2[1],m_wandP2[2],
   wandDir[0],wandDir[1],wandDir[2] );
 
  osgUtil:: IntersectVisitor::HitList htl = 
 intersectVisitor.getHitList( wandStick.get() );
  vectorosg::Geode* geodeHits;
  int numHits = 0;
  if ( htl.size()  0 ) // We always hit the wand, so only consider 
 additional hits.
  {
   for ( int i = 0; i  htl.size(); i++ )
   {
   osg::Vec3 pt = htl[i].getWorldIntersectPoint();
   osg::Vec3 n = htl[i].getWorldIntersectNormal();
   osg::NodePath np = htl[i].getNodePath();
   //osg::Vec3 pt = htl[i].getLocalIntersectPoint();
   osg::Vec3 dir = m_wandP1-pt;
 
   if ( true )
  {
   numHits++;
   geodeHits.push_back( htl[i].getGeode() );
 
   if ( m_bPrintUpdate )
   {
   printf( \tIsect[%d]: %s D=%f [%f %f %f] Pt=%f %f %f N%f 
 %f 
 %f\n, numHits,
   htl[i].getGeode()-getName().c_str(),
   dir.length(), 
 dir[0],dir[1],dir[2],pt[0],pt[1],pt[2], 
 n[0],n[1],n[2] );
   osg::BoundingBox bb = htl[i].getGeode()-getBoundingBox();
   printf( \tBBOX: [%f %f %f] [%f %f %f]\n,
   bb.xMin(),bb.yMin(),bb.zMin(),
   bb.xMax(),bb.yMax(),bb.zMax() );
   printf( \t Node path:\n );
   for ( int j = 0; j  np.size(); j++ )
   {
   osg::Node *node = np[j];
   printf( \t%d: %s\n, j, node-className() );
 
   osg::MatrixTransform *pMT = 
 dynamic_castosg::MatrixTransform*(node);
   osg::PositionAttitudeTransform *pPAT = 
 dynamic_castosg::PositionAttitudeTransform*(node);
   if ( pMT != NULL ) //node-className() == 
 MatrixTransform )
   {
   osg::MatrixTransform *pMtx = (osg::MatrixTransform 
 *) node;
   osg::Matrix mtx = pMtx-getMatrix();
   printf( \t T[%f %f %f] [%f %f %f] [%f %f %f] [%f 
 %f %f]\n,
   mtx(3,0),mtx(3,1),mtx(3,2),
   mtx(0,0),mtx(0,1),mtx(0,2),
   mtx(1,0),mtx(1,1),mtx(1,2),
   mtx(2,0),mtx(2,1),mtx(2,2) );
   }
   else if ( pPAT != NULL )
   {
   osg::Vec3 p = pPAT-getPosition();
   osg::Quat Q = pPAT-getAttitude();
   osg::Vec4 q = Q.asVec4();
   printf( \t T[ %f %f %f] Q[%f %f %f %f]\n,
   p[0],p[1],p[2], q[0],q[1],q[2],q[3] );
   }
   else
   printf( ??\n );
   }
   
   //osg::Matrix *mtx = (osg::Matrix*)htl[i].getMatrix();
   //printf

[osg-users] Light sources

2007-08-23 Thread Dave Pugmire
Hi,
How many are allowed? I'm having trouble getting multiple lights. One 
seems to work fine, but not 2 or 3. Does something need to be enabled?

Thanks,
Dave

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


[osg-users] Coordinate systems

2007-08-16 Thread Dave Pugmire
What is the easiest way to change the coordinate system of OSG?
I read in documentation that there is a way to do it, but it never says 
how. I need to have the world be XZ on the floor and +Y up. Is it best 
to attach a transform node below the root, and hang everything off that, 
or can I configure something?

Thanks,
Dave

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


Re: [osg-users] Moving things around

2007-08-15 Thread Dave Pugmire
The wand is hand held device that is motion tracked, so as I move it 
around in the immersive cave, the caveLib determines it's XYZ position 
and orientation.  What I want to do is to move an object in the scene 
graph around as if it were attached to the hand held device. Where the 
hand-held device goes, the node in the scene graph goes.

By tweaking and hacking, I was able to make things move. Using an simple 
scene with a floor, and the cow, with this heirarchy:

root -- group -- PositionAttitudeTransform -- MatrixTransform -- Geode(cow)

If I grab the MatrixTransform node, and postMultiply it's matrix with a 
translation matrix, I can make the cow move.  However, to get this to 
work in the general case, I need to obtain the localToWorld/worldToLocal 
mtx for the geode, and use it, with the position of the hand-held wand 
to create a new matrix for this geode that positions it on the wand.

Does that make sense?

-dave


Adrian Egli wrote:
 Hi Dave,
 
 i don't right understand what you are looking for. But there exists many 
 different
 techniques in the osg core, one it the osg::Animation may this node would
 be exactly you were looking for.
 
 /adegli
 
 2007/8/15, Dave Pugmire [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:
 
 Hi,
 I'm writing a cavelib application, and I want to be able to drag things
 around in the CAVE with the wand. So, given a Geode, I want to have it
 follow the position and orientation of the wand.  Not sure how to do
 this, or where in the examples or elsewhere to look for code that can
 help.  Can someone point me in the right direction?
 
 Thanks,
 Dave
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 mailto:osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 
 
 -- 
 
 Adrian Egli
 
 
 
 
 ___
 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] DISPLAY

2007-08-06 Thread Dave Pugmire
Hi,
I'm running an example remotely over ssh. I did ssh -X, and verified 
that DISPLAY is set. However, when I run, I get:
'unable to open display :0.0'

Ideas?

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


Re: [osg-users] compiling examples

2007-08-02 Thread Dave Pugmire
Thanks.
That did it.

Having an odd problem now. When I press esc to kill the app, it locks 
my computer. Is there some other setting I missed?
As a work around I have OSG_WINDOW set so that it doesn't run in full 
screen mode so I can kill it from the xterm.

Thanks,
-dave


Robert Osfield wrote:
 Hi Dave,
 
 The examples aren't build by default  - there are nearly a hundred of
 them so its good to keep build time down for those who don't need
 them.
 
 The examples can be built by running:
cd OpenSceneGraph
ccmake .
 
 And then in console GUI presented toggling on the BUILD_OSG_EXAMPLES
 to ON, the press 'c' to configure, then 'g' to generate the final
 build system.
 
 Then just run make as sual.
 
 Robert.
 
 On 8/1/07, Dave Pugmire [EMAIL PROTECTED] wrote:
 Hi,
 Newbie here.
 Just installed the 2.0 on linux, did a make:

 ./configure
 make

 But it didn't make the examples.
 cd examples

 cmake .

 gave me a 'Unknown Cmake command SETUP_EXAMPLE'

 I'm not finding anything in particular about building the examples.
 Should it happen automatically when building the OSG source?
 Not seeing anything in the make files either

 Thanks for your help-
 -dave

 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] compiling examples

2007-08-02 Thread Dave Pugmire
It would give back keyboard, provided that I didn't run in full screen 
mode, and could ^C it at the xterm to kill it. In full screen, I had to 
give it the vulcan death grip to kill the X server.

However, I just installed the latest NVIDIA driver, and all works now.

Thanks all for your help. I hope that as I learn, I can contribute back. 
So far, OSG seems very nice.

-dave


Peter Gebauer wrote:
 Hello there!
 
 I have a similar problem where it seems that the OSG apps refuse to give 
 back keyboard control to the window manager, could you be experiencing 
 something simlar? Does mouse control still work after quiting?
 
 /Peter
 
 
 On 2007-08-02 (Thu) 09:51, Dave Pugmire wrote:
 Thanks.
 That did it.

 Having an odd problem now. When I press esc to kill the app, it locks 
 my computer. Is there some other setting I missed?
 As a work around I have OSG_WINDOW set so that it doesn't run in full 
 screen mode so I can kill it from the xterm.

 Thanks,
 -dave


 Robert Osfield wrote:
 Hi Dave,

 The examples aren't build by default  - there are nearly a hundred of
 them so its good to keep build time down for those who don't need
 them.

 The examples can be built by running:
cd OpenSceneGraph
ccmake .

 And then in console GUI presented toggling on the BUILD_OSG_EXAMPLES
 to ON, the press 'c' to configure, then 'g' to generate the final
 build system.

 Then just run make as sual.

 Robert.

 On 8/1/07, Dave Pugmire [EMAIL PROTECTED] wrote:
 Hi,
 Newbie here.
 Just installed the 2.0 on linux, did a make:

 ./configure
 make

 But it didn't make the examples.
 cd examples

 cmake .

 gave me a 'Unknown Cmake command SETUP_EXAMPLE'

 I'm not finding anything in particular about building the examples.
 Should it happen automatically when building the OSG source?
 Not seeing anything in the make files either

 Thanks for your help-
 -dave

 ___
 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 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org