Re: [osg-users] Transforming nodes

2009-12-22 Thread Oren Fromberg
Dear Brendan,

That was absolutely the problem!! Thanks so much for your help.

Sincerely,

Oren

p.s. I wish there was some kind of heads-up in the header file for 
DOFTransform!!

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





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


Re: [osg-users] Transforming nodes

2009-12-22 Thread GordonTomlinson
Hi,


 
 but for some reason the default scale for an osgSim::DOFTransform is (0,0,0)




To me that seems a rather bad default to have for scaling on a DOF, I would 
have assumed the default would be 1,1,1 not 0,0,0

Is there a reason why its 0,0,0, and not 1,1,1 and should we change it

BTW the default for MPI FLT DOF node is 1,1,1

Thank you!

Cheers,
GordonTomlinson

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





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


Re: [osg-users] Transforming nodes

2009-12-22 Thread Jean-Sébastien Guay

Hi Gordon,


To me that seems a rather bad default to have for scaling on a DOF, I would 
have assumed the default would be 1,1,1 not 0,0,0


That's bitten me a few times too. Specifically when I create DOFs 
programmatically instead of reading an FLT file.



Is there a reason why its 0,0,0, and not 1,1,1 and should we change it


I think we could change it. Just need to beat the inertia of making such 
a simple change and sending the whole modified file...


U...

Ok! Did it!

Uh, there are lots more uninitialized variables there... What should 
_minScale, _maxScale, _minHPR, _maxHPR, _minTranslate, _maxTranslate be 
set to? Fine, _currentTranslate and _currentHPR can be left at (0,0,0), 
but are there better defaults for the min and max? Does the OpenFlight 
spec give some appropriate defaults? And now that _currentScale is set 
to (1,1,1), does it bother that it's not between _minScale and _maxScale 
- which are both still at the default-constructed value of (0,0,0)?


I knew I shouldn't have opened the file to do the modification... :-)

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/
#include osgSim/DOFTransform

using namespace osgSim;
using namespace osg;

static const unsigned int TRANSLATION_X_LIMIT_BIT  = 0x8000u  0;
static const unsigned int TRANSLATION_Y_LIMIT_BIT  = 0x8000u  1;
static const unsigned int TRANSLATION_Z_LIMIT_BIT  = 0x8000u  2;
static const unsigned int ROTATION_PITCH_LIMIT_BIT = 0x8000u  3;
static const unsigned int ROTATION_ROLL_LIMIT_BIT  = 0x8000u  4;
static const unsigned int ROTATION_YAW_LIMIT_BIT   = 0x8000u  5;
static const unsigned int SCALE_X_LIMIT_BIT= 0x8000u  6;
static const unsigned int SCALE_Y_LIMIT_BIT= 0x8000u  7;
static const unsigned int SCALE_Z_LIMIT_BIT= 0x8000u  8;


DOFTransform::DOFTransform():
_previousTraversalNumber(-1),
_previousTime(0.0),
_limitationFlags(0),
_animationOn(false),
_increasingFlags(0x),
_multOrder(PRH),
_currentScale(1.0f,1.0f,1.0f)
{
}

DOFTransform::DOFTransform(const DOFTransform dof, const osg::CopyOp copyop):
osg::Transform(dof, copyop),
_previousTraversalNumber(dof._previousTraversalNumber),
_previousTime(dof._previousTime),
_minHPR(dof._minHPR),
_maxHPR(dof._maxHPR),
_currentHPR(dof._currentHPR),
_incrementHPR(dof._incrementHPR),
_minTranslate(dof._minTranslate),
_maxTranslate(dof._maxTranslate),
_currentTranslate(dof._currentTranslate),
_incrementTranslate(dof._incrementTranslate),
_minScale(dof._minScale),
_maxScale(dof._maxScale),
_currentScale(dof._currentScale),
_incrementScale(dof._incrementScale),
_Put(dof._Put),
_inversePut(dof._inversePut),
_limitationFlags(dof._limitationFlags),
_animationOn(dof._animationOn),
_increasingFlags(dof._increasingFlags),
_multOrder(dof._multOrder)
{
if (_animationOn) 
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
}

void DOFTransform::traverse(osg::NodeVisitor nv)
{
if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
{
// ensure that we do not operate on this node more than
// once during this traversal.  This is an issue since node
// can be shared between multiple parents.
if ((nv.getTraversalNumber()!=_previousTraversalNumber)  
nv.getFrameStamp())
{
double newTime = nv.getFrameStamp()-getSimulationTime();

animate((float)(newTime-_previousTime));

_previousTraversalNumber = nv.getTraversalNumber();
_previousTime = newTime;
}
}

Transform::traverse(nv);
}

bool DOFTransform::computeLocalToWorldMatrix(osg::Matrix 
matrix,osg::NodeVisitor*) const
{
//put the PUT matrix first:
osg::Matrix l2w(getPutMatrix());

//now the current matrix:
osg::Matrix current;
current.makeTranslate(getCurrentTranslate());

//now create the local rotation:
if(_multOrder == PRH)
{
current.preMult(osg::Matrix::rotate(getCurrentHPR()[1], 1.0, 0.0, 
0.0));//pitch
current.preMult(osg::Matrix::rotate(getCurrentHPR()[2], 0.0, 1.0, 

Re: [osg-users] Transforming nodes

2009-12-22 Thread Gordon Tomlinson
HI J-S

In Creator/OpenFlight, the defaults for all the DOF min's and max's are all
0's and the step values are all 0's
and of course the scale current is set to 1,1,1

Creator has a DOF Viewer and when min, max are zero its ignores them it only
animates if you have a (Min or Max) and Step set to something other than
zero


__
Gordon Tomlinson 

gor...@gordontomlinson.com IM: gordon3db...@3dscenegraph.com 
www.vis-sim.com
www.gordontomlinson.com
www.PhotographyByGordon.com

__

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
Jean-Sébastien Guay
Sent: Tuesday, December 22, 2009 6:09 PM
To: osg-users@lists.openscenegraph.org
Cc: OpenSceneGraph Submissions
Subject: Re: [osg-users] Transforming nodes

Hi Gordon,

 To me that seems a rather bad default to have for scaling on a DOF, I 
 would have assumed the default would be 1,1,1 not 0,0,0

That's bitten me a few times too. Specifically when I create DOFs
programmatically instead of reading an FLT file.

 Is there a reason why its 0,0,0, and not 1,1,1 and should we change it

I think we could change it. Just need to beat the inertia of making such a
simple change and sending the whole modified file...

U...

Ok! Did it!

Uh, there are lots more uninitialized variables there... What should
_minScale, _maxScale, _minHPR, _maxHPR, _minTranslate, _maxTranslate be set
to? Fine, _currentTranslate and _currentHPR can be left at (0,0,0), but are
there better defaults for the min and max? Does the OpenFlight spec give
some appropriate defaults? And now that _currentScale is set to (1,1,1),
does it bother that it's not between _minScale and _maxScale
- which are both still at the default-constructed value of (0,0,0)?

I knew I shouldn't have opened the file to do the modification... :-)

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] Transforming nodes

2009-12-22 Thread Jean-Sébastien Guay

Hi Gordon,


In Creator/OpenFlight, the defaults for all the DOF min's and max's are all
0's and the step values are all 0's
and of course the scale current is set to 1,1,1


OK then the values that are now set should be correct (since the default 
ctor for Vec3 sets it to (0,0,0) ).


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] Transforming nodes

2009-12-21 Thread Oren Fromberg
bump...

I've managed to insert DOFTransform nodes into my model but the geometry under 
these nodes are not being drawn even though the drawable update callbacks are 
definitely being called...

The weird thing is, if I replace the DOFTransform with a simple 
MatrixTransform, the geometry renders just fine.  :? 

If I just leave the put and inverse put matrices as identity matrices, it 
should still render, right? what am I doing wrong??

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





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


Re: [osg-users] Transforming nodes

2009-12-21 Thread Brendan Ledwich
Hi Oren,
This mightn't be your problem, but for some reason the default scale for an 
osgSim::DOFTransform is (0,0,0). This is what I usually forget when using it.

Cheers,
Brendan

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





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


Re: [osg-users] Transforming nodes

2009-12-07 Thread Oren Fromberg
wow, thank you guys for the great help... DOFTransform seems to be right on the 
money.

Oren

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





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


[osg-users] Transforming nodes

2009-12-03 Thread Oren Fromberg
Hello everyone! Here is my question:

I have a model of a sea faring vessel that has little gadgets on it like 
radars, turrets, propellors, etc. these gadgets are fully contained in separate 
named Geodes. That means that the geometry in the geode is specified relative 
to the origin of the ship and not the point where the gadget is located. what 
is the best way to make these things transform (mainly rotate)?

I was thinking I could parent the gadget Geode with a MatrixTransform node to 
create some kind of local coordinate system for the geometry of the gadget but 
then the geometry itself would have to be respecified relative to this 
geometry. can I somehow put a static transform between the MatrixTransform and 
the Geode in order to offset the positions of all the vertices so that the 
point that the gadget transforms around becomes the location of the 
MatrixTransform?

Thanks in advance for your help! :D

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





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


Re: [osg-users] Transforming nodes

2009-12-03 Thread Paul Martz
Have you looked at transform nodes other than MatrixTransform? Either 
osgSim::DOFTransform or osg::PositionAttitudeTransform lets you set a 
pivot point. I've seen this in the code but never used it. But it 
sounds like it would make it easier for you to compose the 
transformation that you need.


Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ http://www.skew-matrix.com/
+1 303 859 9466



Oren Fromberg wrote:

Hello everyone! Here is my question:

I have a model of a sea faring vessel that has little gadgets on it like 
radars, turrets, propellors, etc. these gadgets are fully contained in separate 
named Geodes. That means that the geometry in the geode is specified relative 
to the origin of the ship and not the point where the gadget is located. what 
is the best way to make these things transform (mainly rotate)?

I was thinking I could parent the gadget Geode with a MatrixTransform node to 
create some kind of local coordinate system for the geometry of the gadget but 
then the geometry itself would have to be respecified relative to this 
geometry. can I somehow put a static transform between the MatrixTransform and 
the Geode in order to offset the positions of all the vertices so that the 
point that the gadget transforms around becomes the location of the 
MatrixTransform?

Thanks in advance for your help! :D

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





___
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] Transforming nodes

2009-12-03 Thread Oren Fromberg
Thanks for the suggestion... I'll definitely check it out.

my other question is how do I modify the geometry on the gadgets to be located 
around an origin, namely the point around which the gadget transforms? so if my 
gadget is located at point (x,y,z), I want the point of articulation to be at 
(0, 0, 0). I was thinking I could put a transform right above the geode that 
offsets everything by (-x,-y,-z), and somehow use the Optimizer in osgUtils. 
any suggestions?

Thanks again!

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





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


Re: [osg-users] Transforming nodes

2009-12-03 Thread Paul Martz

Oren Fromberg wrote:

Thanks for the suggestion... I'll definitely check it out.

my other question is how do I modify the geometry on the gadgets to be located 
around an origin, namely the point around which the gadget transforms? so if my 
gadget is located at point (x,y,z), I want the point of articulation to be at 
(0, 0, 0). I was thinking I could put a transform right above the geode that 
offsets everything by (-x,-y,-z), and somehow use the Optimizer in osgUtils. 
any suggestions?


That's one way to do it. If you're not familiar with the Optimizer, 
you'd want to use the FLATTEN_STATIC_TRANSFORMS bit.

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


Re: [osg-users] Transforming nodes

2009-12-03 Thread Jason Daly

Paul Martz wrote:
Have you looked at transform nodes other than MatrixTransform? Either 
osgSim::DOFTransform or osg::PositionAttitudeTransform lets you set a 
pivot point. I've seen this in the code but never used it. But it 
sounds like it would make it easier for you to compose the 
transformation that you need.
  


Hi, Oren,

osgSim::DOFTransform is exactly what you need here.  What you'll want to 
do is set the inverse put matrix to the transform that puts the 
articulated part at the origin, and set the put matrix to the 
transform that will put it back.  The position and orientation of the 
articulated part itself are specified by Vec3's (heading, pitch, roll 
for orientation).  You can either use the setCurrent* methods to do the 
animation yourself, or the setIncrement* methods to have the animation 
done for you during the update traversal.


--J

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