World Coordinates of PathCV node

   2551   10   0
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Hello,

This post is purely an “academic” question.

In a recent similar post patar was helpfull in showing me how I could do a parameters channel reference differently.

In working with this way I've come across something that got my attention.

In the file I've included I've laid down a PathCV node.

I intentially ( using the magnet to grid option ) plotted it down with the mouse that is offset the x/y plane on the z-axis by 0.5 units.

With PathCV nodes though it appears that once they are laid down any direct reference to the origin position is “lost”.

It sets that orginal position to it's own origin of value 0 and establishes the other points.

However, to get back what that original position is one just has to look at the “new” points created by the node and through a simple function could calculate what that original position is in world coordinates.

I think for such a function to work one would only have to study the default behaviour of how these points are established for the different plane references in which the original pathcv nodes are laid down in.

In the example file attached the pathcv was laid down from the scene view set to right side. So with the output of the pathcv node set back to its' default of using its bgeo node; Point 5 could be used as reference for getting the z value, which is -1.0. Simply dividing that by 2 gives us the “original” world coordinates or center world coordinates point of that pathcv node (for the z value).

I guess the bgeo node within that pathcv node holds this information and is doing its own internal functions to finally give the output of the node?

Any possible way to look into that node and see what's going on or even better “extract” and use that information( the original world coordinate center point of node, if available) as like maybe via a type of channel reference?

Again, this is purely academic but in knowing about this more I think it would be useful in understanding Houdini better.

Insights are appreciated, Thanks!
Edited by BabaJ - Sept. 16, 2016 11:52:05

Attachments:
getting pathcv world coordinates.hiplc (96.6 KB)

User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Working with this a bit further,

Aside from wondering about access to the internal contents of a bgeo ( which would be nice to know );

If I really wanted to ‘get’ this information,

the simplest way seems to be is to create a geo node with an object merge inside it and with the object merges' transform set to “Into This Object”.

Then reference the origin node inside the pathcv node.

User Avatar
Member
280 posts
Joined:
Offline
“the simplest way seems to be is to create a geo node with an object merge inside it and with the object merges' transform set to “Into This Object”.”

you are correct…but this option is not always can be used for example when you want to actually transform the object at the object level.

attached is a way to get that center point tho not in python instead its in hscript…

Attachments:
getting pathcv world coordinates_mod.hiplc (69.4 KB)

User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Hi patar,

Yeah I see what you mean…

I was sort of ‘thinking’ out loud when I stated that because it really was in reference to my project I'm working on rather than doing it that way in general.

Another good thing about the method I learned from you is that I will be doing further work on the vex part of my project where originaly what I was looking and knowing what I have to do - is use the vex rotate function.

Now that you've shown me the optransform ( and it does a have its vex conterpart from what I've seen in the docs ) I have more options to work with.

So thanks again.
User Avatar
Member
7725 posts
Joined: July 2005
Offline
To get the world coordinates of any object (which PathCV is just one instance of it):

hscript: originoffset() expression function
python: hou.ObjNode.worldTransform().extractTranslates()
Edited by edward - Sept. 19, 2016 00:56:27
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Hello edward,

Thank you for bringing my attention to yet another way of doing this.

However with the Hscript I can't seem to get the syntax right, I keep getting errors.

And with the python my syntax appears to be right but it doesn't appear that I am applying it correctly?

Anyone perhaps can shed some light on this?

Thanks
Edited by BabaJ - Sept. 18, 2016 11:33:46

Attachments:
getting pathcv world coordinates.hiplc (94.7 KB)

User Avatar
Member
280 posts
Joined:
Offline
typo i guess what he meant is “originoffset” not “originaoffset”
syntax:
http://www.sidefx.com/docs/houdini15.5/expressions/originoffset [sidefx.com]
thx for this info…

best regards
Patar
User Avatar
Member
7725 posts
Joined: July 2005
Offline
Oops, sorry for the typo. Fixed in original post.

Example python usage:

hou.node("/obj/pathcv1").worldTransform().extractTranslates()

Note that you need to replace /obj/pathcv1 with your actual name. See also how to use python expressions here: http://www.sidefx.com/docs/houdini/hom/expressions [sidefx.com]
Edited by edward - Sept. 19, 2016 00:58:53
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Hi edward,

Thanks for replying, but yeah that's why I said basically my python syntax is good but maybe I'm not applying the function in the right way, or maybe my expectations of what it can be used for; Because it doesn't work.

I originaly used :

Ref_Pcv = hou.node('/obj/subnet1/pathcv1')
result = Ref_Pcv.worldTransform().extractTranslates()
return result

but changed it to your format, and still no results; no errors either.

The results still come to the value of 0 instead of 6 ( which is what it should be ).

Including the file as an example.

Thanks again
Edited by BabaJ - Sept. 19, 2016 09:17:37

Attachments:
getting pathcv world coordinates.hiplc (78.4 KB)

User Avatar
Member
7725 posts
Joined: July 2005
Offline
Sorry, no time to open .hip files. However, if you're trying to use this directly on say some Translate parameter, then you need to replicate the expression 3 times to return each component separately, with appropriate indexing:

hou.node("/obj/pathcv1").worldTransform().extractTranslates()[0]
hou.node("/obj/pathcv1").worldTransform().extractTranslates()[1]
hou.node("/obj/pathcv1").worldTransform().extractTranslates()[2]
Edited by edward - Sept. 20, 2016 08:33:52
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
No need to be sorry…no one is obligated to answer or comment on my questions.

Everyones response is very much appreciated as people are giving their time freely.

And the addition of
[2]
to my expression makes it work like a charm.

Thanks for that imput edward.

I think I would benefit from studying ‘matrix’ math as my only level of understanding goes up to basic trigonometry.

The reason I say that is because when I looked at the worldTransform in the docs its showing it as ‘returning’ a Matrix4 ( which makes my mind glaze over as I don't know what to do with that/make sense of ) and the extractTranslates as ‘returning’ a vector3 - which for me is easier to understand.

So, yeah..beefing up the geometry math could probably go a long way into making sense of the docs in digging into them more thorougly, and understanding how they can work together like - worldTransform().extractTranslates()
  • Quick Links