PDA

View Full Version : The way of rounding off by MEL


frutachi
10-15-2011, 07:24 AM
Hello.

I would like to know good method to Rounding off by MEL
I think that there is no function appropriate for it.

Does someone know good way?

WesHowe
10-15-2011, 08:32 AM
Rounding off to what?
This MEL code:

float $prec=0.01;
float $a=1.016;
float $ar=floor(($a+(0.5*$prec))/$prec)*$prec;
print $ar;

yields 1.02 from 1.016. An input of 1.014 yields 1.01.

Use a different constant for $prec to round to other precisions.

<* Wes *>

NaughtyNathan
10-15-2011, 10:44 AM
someone usually knows good way, and the best way to find that out is by using search:

http://forums.cgsociety.org/showthread.php?f=89&t=869479&highlight=mel+rounding

:nathaN

CGTalk Moderation
10-15-2011, 10:44 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.