HI Vincent,
The getWorldMatrices() method returns accumulated world matrices, if
there is more than one then it means you have multiple parental paths
and that multiple world matrices are required to position the
different instances. The getWorldMatrices() is not a list of
matrices along a parent path and is not something you accumulate that
you have done.
I hope you grasp the difference as its hard explaining it without pen
and paper. The key is you don't need to accumulate the matrices are
completed, just use them directly.
Robert.
On Thu, Mar 27, 2008 at 1:53 PM, Vincent Bourdier
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I make a little "up" of this topic because I'm now looking on it a last time
> (I hope)
>
> To be more clear,
>
> I have a difference between getting the transform quat with theses two way :
>
>
> osg::MatrixList ml = _node->getWorldMatrices();
> osg::Matrixd Msum = osg::Matrixd::identity();
> for(unsigned int i = 0; i< ml.size() ; i++)
> {
> Msum *= ml[i];
> }
> quat = Msum.getRotate();
>
> --------------------------------------------------------------------------------------------------------
>
> osg::PositionAttitudeTransform* pat =
> dynamic_cast<osg::PositionAttitudeTransform*>(_node.get());
> quat = pat->getAttitude();
>
> Do you know why I don't have the same result ?
>
> Thanks
> Vincent.
>
>
> 2008/3/21, Vincent Bourdier <[EMAIL PROTECTED]>:
> > Hi,
> >
> > So I've made some tests and now I have some questions about the
> differences between two methods to get tranformations on one node. Is the
> node is a Transform or not, I use two different method to get
> transformations.
> >
> > In the first method, I get directly the MatrixTransform node, so I can get
> directly the matrix, convert it to Quat and continue...
> > In the second method, I get a node, so I make a getWorldMatrices, and make
> a product between all the Matrix of the MatrixList...
> >
> > If I test on a node, which parent is a MatrixTransform, it doesn't return
> the same result with the two method (with the MatrixTranform as argument for
> the first method and the child of the MatrixTransform as argument of the
> second method)
> >
> > Is there any explanation for this difference ?
> >
> > Thanks.
> >
> > Regard,
> > Vincent.
> >
> >
> >
> > 2008/3/21, Vincent Bourdier <[EMAIL PROTECTED]>:
> >
> > > Hi Robert,
> > >
> > > sorry I'm not always very ... understandable, when I try to explain
> something.
> > >
> > > I've already tried getWorldMatrices() few days ago, but the result was
> very different with using one PAT or MT Quat/Matrix...
> > >
> > > That's why I'm asking if getting the PAT/MT accumulation Quat/Matrices
> is easy... or not.
> > >
> > > But if it getWorldMatrices() is the only solution, I'll will try again.
> > >
> > > Thanks.
> > > Vincent.
> > >
> > >
> > > 2008/3/21, Robert Osfield <[EMAIL PROTECTED]>:
> > >
> > > > Hi Vincent,
> > > >
> > > > I'm a bit confused about what you are trying to do, is it just get the
> > > > accumulated world matrix at a specific node?
> > > >
> > > > If so then node::getWorldMatrices() is what you want. This will
> > > > return a MatrixList, which will contain none, one or many matrices
> > > > given that any node many have none or many parental paths containing
> > > > transforms.
> > > >
> > > > Robert.
> > > >
> > > >
> > > > On Fri, Mar 21, 2008 at 11:03 AM, Vincent Bourdier
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > Hi all,
> > > > >
> > > > > I'm trying to get a node's parent as Transform (PAT or
> MatrixTransform) but
> > > > > I have to get the transformation in ABSOLUTE_RF...
> > > > >
> > > > > For the moment, I've done a recursive method to get Parent as
> Transform. It
> > > > > return me the first parent as Tranform it encounter.
> > > > >
> > > > > I've tried this :
> > > > >
> > > > > > osg::ref_ptr<osg::MatrixTransform> tmp_pt = new
> osg::MatrixTransform;
> > > > > > tmp_pt->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
> > > > > > tmp_pt->setMatrix(p_mt->getMatrix());
> > > > > >
> > > > >
> > > > > (where p_mt is my RELATIVE MatrixTransform)
> > > > >
> > > > >
> > > > > But the method return to me a MatrixTransform in RELATIVE. It is
> possible to
> > > > > get the Matrix in Absolute ? without traverse all the scenegraph ?
> > > > > Thanks.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Vincent.
> > > > >
> > > >
> > > > > _______________________________________________
> > > > > osg-users mailing list
> > > > > [email protected]
> > > > >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > > >
> > > > >
> > > > _______________________________________________
> > > > osg-users mailing list
> > > > [email protected]
> > > >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > >
> > >
> > >
> >
> >
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org