Cumulative transform between two nodes?

Have jReality programming problems or questions? Post them here.
Post Reply
ted
Posts: 57
Joined: Wed 25. Jul 2012, 22:53

Cumulative transform between two nodes?

Post by ted » Sat 28. Jul 2012, 08:07

Is there a utility function to calculate the cumulative transform between two arbitrary nodes in a scene graph in JReality?

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Cumulative transform between two nodes?

Post by steffen » Wed 1. Aug 2012, 08:35

You can create a SceneGraphPath for each of nodes, both paths starting at the scene root. Then use path1.getMatrix and path2.getInverseMatrix and multiply them together. There is no utility function for this, because the paths might not be unique.

ted
Posts: 57
Joined: Wed 25. Jul 2012, 22:53

Re: Cumulative transform between two nodes?

Post by ted » Fri 3. Aug 2012, 05:29

I just ran across these two methods that retrieve the path, given a node or a name.

Code: Select all

static List<SceneGraphPath>	SceneGraphUtility.getPathsBetween(SceneGraphComponent begin, SceneGraphNode end) 
static List<SceneGraphPath>	SceneGraphUtility.getPathsToNamedNodes(SceneGraphComponent root, String name) 
When used with getMatrix for the path, these should be sufficient for cleanly getting the transforms necessary to render cylinders between two nodes, which is why I'm interested in it.

Thanks

_-T

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Cumulative transform between two nodes?

Post by steffen » Fri 3. Aug 2012, 06:30

All right, I forgot about that method. It will return all paths from one component to a node, in your case it is probably just one path. Still you need two paths, except if one component is an ancestor of the other.

Post Reply