Hey everybody, Does anyone could give me an example of the modulus function in expression? since i very confused about this function.
Thanks.
modulus function
22576 7 3- nenuco
- Member
- 18 posts
- Joined: Nov. 2012
- Offline
- animatrix_
- Member
- 4516 posts
- Joined: Feb. 2012
- Offline
Hi,
You can use:
5 % 2
to get the remainder 1.
More info here:
http://www.cprogramming.com/tutorial/modulus.html [cprogramming.com]
You can use:
5 % 2
to get the remainder 1.
More info here:
http://www.cprogramming.com/tutorial/modulus.html [cprogramming.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
- nenuco
- Member
- 18 posts
- Joined: Nov. 2012
- Offline
- bollili
- Member
- 205 posts
- Joined: Dec. 2009
- Offline
- nenuco
- Member
- 18 posts
- Joined: Nov. 2012
- Offline
- nikmolson
- Member
- 54 posts
- Joined: Dec. 2011
- Offline
- bollili
- Member
- 205 posts
- Joined: Dec. 2009
- Offline
A bit confusing is the use of the word modulus in (british?) english. The absolute value function abs() is often called modulus.
see here (first paragraph) – abs() in Houdini
http://en.wikipedia.org/wiki/Absolute_value [en.wikipedia.org]
vs. here – % in Houdini
http://en.wikipedia.org/wiki/Modular_arithmetic [en.wikipedia.org]
see here (first paragraph) – abs() in Houdini
http://en.wikipedia.org/wiki/Absolute_value [en.wikipedia.org]
vs. here – % in Houdini
http://en.wikipedia.org/wiki/Modular_arithmetic [en.wikipedia.org]
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
Modulus is used to create “sawtooth” channels from varying data (channels, attributes, sequences of images/geometry, etc).
For example you can take some geometry with the same number of points per row and create values for each point like:
$PT%100
where 100 is the number of points per row and would return 0-99 for each row in your geometry. Comes in handy for a very lightweight way to set increasing attributes on curves for fur/hair/grass that have the same number of points per curve where you don't have access to the SOP network or geometry loaded in from disk.
—-
Modulus is used in crowds all the time. Either for cutting up a path in to strides and then index in to the right motion geometry or channels.
Countless other uses where you can identify a repeating pattern and you wish to work with it.
For example you can take some geometry with the same number of points per row and create values for each point like:
$PT%100
where 100 is the number of points per row and would return 0-99 for each row in your geometry. Comes in handy for a very lightweight way to set increasing attributes on curves for fur/hair/grass that have the same number of points per curve where you don't have access to the SOP network or geometry loaded in from disk.
—-
Modulus is used in crowds all the time. Either for cutting up a path in to strides and then index in to the right motion geometry or channels.
Countless other uses where you can identify a repeating pattern and you wish to work with it.
There's at least one school like the old school!
-
- Quick Links