View Full Version : Xpresso: Rounding to whole numbers?
Newstream 12312006, 12:12 AM Hi Gang,
Sorry for the embarrassingly n00bish question but I've got a brick missing in my humble wall of Xpresso knowledge.
Question: Is there a node (or simple way) to round off numbers?
For example: Lets say a node is outputting a value of 878.882 and I want the number to be rounded off to its closest whole number, in this case: 879
Any tips appreciated.
Cheers / Alex


PerAnders
12312006, 12:15 AM
just plugging your "real" output into an "integer" input (or long) will result in the value being automatically rounded down, you can use the universal converter node to do this if you want to. you can also use the math>FloatFunc node and pick "Floor" to round down to "Ceil" to round up (the result will still be a real "floating point" number rather than an integer).
Newstream
12312006, 12:27 AM
just plugging your "real" output into an "integer" input (or long) will result in the value being automatically rounded down, you can use the universal converter node to do this if you want to. you can also use the math>FloatFunc node and pick "Floor" to round down to "Ceil" to round up (the result will still be a real "floating point" number rather than an integer).
Thanks for those useful tips Per!
The math>FloatFunc node worked the best for this particular scene.
Good to learn something new too :thumbsup:
Cheers / Alex
CGTalk Moderation
12312006, 12:27 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002015, Jelsoft Enterprises Ltd.