Pulling Relative Transforms

Mark Story mstory at xion.org
Thu Jul 22 13:11:44 EDT 2004

Hi Caleb,

Any success with the "Infinite Monkey" method? :-)

I've only had a few minutes to steal to get to work on this, kind of ran
into a few dark corners with H7 HDK ...  Anyway, I think the method you 
want to use is getRelativeTransform(), however, I haven't gotten that 
far yet (sorry).

I threw together some test code (see below) but got a result I wasn't 
sure about and thought maybe I should ask the dev list before I go any 
further down a potential dead end.  What the problem is is that when I 
examine the contents of the matrix (after exploding the matrix) the 
translation values change when I adjust the rotation and scale params. 
My guess is that this is correct, because rotating and scaling will in 
fact place the object at a different location.

If you haven't looked at the example yet in the toolkit/samples/SOP dir, 
SOP_HDKObject.C, I think you'll find all the ingredients necessary to do 
what you're trying to do.

Let me know if you've got it working or not, if not, I'll send the rest 
of the code soon (just need to find a few minutes to finish this 



UT_String my_name, my_full_path, the_name;
OP_Network		*op_net_ptr;
SOP_Node		*sopptr;

OP_Director *my_director = OPgetDirector();
OP_Network   *my_network = my_director->getManager("obj");
OP_Node  *my_node = my_network->getCurrentNodePtr();
my_name = getName();

the_name = my_full_path;
the_name += "/";
the_name += my_name;
sopptr = getSOPNode(the_name, 0);	
op_net_ptr = sopptr->getCreator();

cout  << "my_full_path: " << my_full_path <<  \t"my_name: " << my_name 
<< "\tthe_name: " << the_name << endl;

my_sop_xform  = op_net_ptr->getWorldTransform(context);
my_sop_xform.explode(xformOrder, rot, scale, trans);

cout << "trans: x y z: " << trans.x() << "\t" << trans.y() << "\t" << 
trans.z() << endl;
cout << "rot: x y z: " << rot.x() << "\t" << rot.y() << "\t" << rot.z() 
<< endl;
cout << "scale: x y z: " << scale.x() << "\t" << scale.y() << "\t" << 
scale.z() << endl;

More information about the Sidefx-devkit-list mailing list