Jump to content

Beginner's question: centroid vs $CEX vs bbox


Serafim_Chayka

Recommended Posts

Hello! 
I am new to coding. I assume my problem is that I don't fully understand Hscript's syntax and also I seem to struggle with explanation provided by official documentation.

Quote

"Centroid expression function: Returns centroid information for a surface node."

1) First, just to make it clear, does "returns" mean: This function "gives/provides/sends"?

2) By "centroid information" it implies world coordinates of the object's centroid?

3) And by "surface node" it implies individual parameter cell where I write in my values? (btw how should I properly call those "cells/windows", are those parameter channels? confused...)

4) centroid type D_Z, what does "D" stand for?

a. I placed a box and move it -4 in Z direction; b. I created Transform node and wrote centroid function in Z translate parameter cell: centroid("../box1", D_Z)  = -4;  c. -4-4=-8...; d. Oh... Ok... So when I put (-) before this function it looks like that -(-4) = +4 Which translates box into the world center. It means that I kind off answered to the first 3 questions myself. Right? : D

Quote

a.Screenshot_10.png.ca2fdf156a1c7404250abebcdacac473.png b.Screenshot_11.png.0de2229aa251febea629aa880f1fcdc5.png c.Screenshot_12.png.722998a60060016238c7cbbb78b5173b.png d.Screenshot_13.png.d3be15d7de4ee42e5185ee80a90403b4.png

5) What is the difference between centroid and $CEZ? Why would I use one over the other? What are those "Global variables" and how do they differ from "Expression functions"?

6) Is bbox type D_ZSIZE just the distance value between D_ZMIN and D_ZMAX?

 

Thank you!

Edited by Serafim_Chayka
Link to comment
Share on other sites

1) return => function int sum(int x, int y) { return x+y; } takes 2 integers and returns their sum .. so yeah it gives you back something

2) yes

3) surface node is any SOP. those "cells/windows" are parameters. They can have 1 or more channels (= "cells" per row)

4) probably Dimension. Don't care, I'm lazy and use 0, 1, 2 :ph34r:

5) centroid() is a function, $CEX, etc are global variables. Difference is centroid() can grab centroid of any SOP whereas $CEX always returns the centroid of the SOP you use it on

6) yes

Edited by 3dome
  • Thanks 2
Link to comment
Share on other sites

16 hours ago, 3dome said:

1) return => function int sum(int x, int y) { return x+y; } takes 2 integers and returns their sum .. so yeah it gives you back something

2) yes

3) surface node is any SOP. those "cells/windows" are parameters. They can have 1 or more channels (= "cells" per row)

4) probably Dimension. Don't care, I'm lazy and use 0, 1, 2 :ph34r:

5) centroid() is a function, $CEX, etc are global variables. Difference is centroid() can grab centroid of any SOP whereas $CEX always returns the centroid of the SOP you use it on

6) yes

Hi Dominik! Thank you for your reply! 

1) Very clear! 

3) Here is what I found in the documentation:

Quote

Edit a parameter value

  • Click in a parameter value box and type a new value.

Parameter value box = channel; Right?

Screenshot_14.png.4e5e483991a9b5f49b1d123a26d4773a.png

Aren't channels specifically related to animation? Is channel just a value that is bound to a keyframe? 

 

4) Where should I look for that kind of information, if I want to start defining parts of a code? Is it a waste of my time and should I just memorize each code as it is?

...I do not understand what you mean by "use 0, 1, 2"

5) Is there somewhere a full list of global variables? Found one here but it doesn't seem to be complete... At least I can't find the one we discussed... :D

 

Sorry for deluging you with questions... :blush:

 

 

Link to comment
Share on other sites

On 2/14/2019 at 7:19 AM, Serafim_Chayka said:

Parameter value box = channel; Right?

right.

On 2/14/2019 at 7:19 AM, Serafim_Chayka said:

Aren't channels specifically related to animation? Is channel just a value that is bound to a keyframe? 

no and no. For every parameter (no matter if one or more channels) there is a function defined somewhere in the code that takes the values you enter in the channel(s) as function arguments. Keyframes is a different story.

On 2/14/2019 at 7:19 AM, Serafim_Chayka said:

4) Where should I look for that kind of information, if I want to start defining parts of a code? Is it a waste of my time and should I just memorize each code as it is?

...I do not understand what you mean by "use 0, 1, 2"

you will memorize the syntax of the most common functions over time. If you're not sure, open help or when you type a function name and then the first open bracket houdini should pop up a help to this function where you can see how it's being used

centroid("/path/to/sop", 0) instead of centroid("path/to/sop", D_X) and so on

On 2/14/2019 at 7:19 AM, Serafim_Chayka said:

5) Is there somewhere a full list of global variables? Found one here but it doesn't seem to be complete... At least I can't find the one we discussed... :D

should all be in the docs. http://www.sidefx.com/docs/houdini/ref/expression_cookbook.html   
they are referred to as expressions, which makes sense as they are not variables that represent constant values!

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...