From: Simon C Mills (simon++at++wgs.estec.esa.nl)
Date: 08/24/2000 07:43:36
Hi,
There is no built in function to do this but it's easy to make a
recursive function that does. Here's an example. Call this function like
ComputeAbsPos(scene, myNode, myMat)where myNode is the node you're
interested in and myMat contains the transformation from the scene world
coordinate to the your node.
/*
* Compute absolute position of node (recursively ascend hierarchy) from
root
*/
void
ComputeAbsPos(pfNode *root, pfNode *node, pfMatrix &m)
{
/* If node is null, return identity */
if (node == NULL) {
PFMAKE_IDENT_MAT(m);
pfNotify(PFNFY_DEBUG, PFNFY_PRINT, "ComputeAbsPos: NULL node");
return;
}
/* If node is SCS/DCS set matrix to node's matrix, otherwise
identity */
if (node->isOfType(pfSCS::getClassType()))
((pfSCS *) node)->getMat(m);
else
PFMAKE_IDENT_MAT(m);
/* If node is a child express in parent's coordinate system */
if (node->getNumParents() > 0) {
pfMatrix mparent;
pfNode *parent;
/* use the first parent */
parent = (pfNode *) node->getParent(0);
if (parent == root)
return;
ComputeAbsPos(root, parent, mparent);
m.postMult(mparent);
}
}
GAUVIN Yves wrote:
>
> Hello,
>
> I need to place an object in the coordinates of another object. So, I
> need the complete transformation of the two objects (root to object). Is
> there a "pfPathGetTransform" function or must I construct it manually?
>
> cheers,
>
> Yves GAUVIN
> FRENCH RAILROADS
Regards, Simon
_______________________________________________________________________
Simon Mills
Silicon Worlds S.A.
c/o Modelling & Simulation Section (TOS-EMM) Tel: +31 (0)71 565 3725
European Space Agency (ESA/ESTEC) Fax: +31 (0)71 565 5419
Postbus 299, 2200AG Noordwijk e-mail: simon++at++wgs.estec.esa.nl
The Netherlands http://www.estec.esa.nl/wmwww/EMM
_______________________________________________________________________
This archive was generated by hypermail 2b29 : Thu Aug 24 2000 - 07:42:20 PDT