[mel]rnd rotate 'y', but with snapping?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2011
[mel]rnd rotate 'y', but with snapping?

hey peeps.

I made this.. maybe someone could use that..
now I need to actually rotate by steps like, 90degree steps.
Any Idea anyone?

string $sel[] = `ls -sl`; print $sel;
 float $yran = 0;
 for($i = 0; $i < size ($sel); $i++){
  $yran =  rand(0.2, 260);
 rotate  0 ($yran) 0 $sel[$i];
 }


thanks bastian
 
  01 January 2011
You could add a multiplier (example with step size of 30 degrees):


string $sel[] = `ls -sl`; print $sel;
 float $yran = 0;
 float $step = 30;
 for($i = 0; $i < size ($sel); $i++){
  $yran =  floor(rand(0, 10) + 0.5) * $step;
 rotate  0 ($yran) 0 $sel[$i];
 }
__________________
------------------------------------------------------
blog ----- portfolio
 
  01 January 2011
you're my hero, thx!
the floor thing is nice.. was also searching for a round thing for some time
 
  01 January 2011
Originally Posted by Sorath: ... was also searching for a round thing for some time



global proc float roundFloat (float $f, float $precision)
{
	$f /= $precision;
	float $f1 = floor($f);
	float $f2 = ceil($f);
	float $v = (($f - $f1) > ($f2 - $f)) ? $f2 : $f1;
	return ($v*$precision);
}
roundFloat 72 90
// Result:90//
roundFloat 72 30
// Result:60//
       

Last edited by denisT : 01 January 2011 at 02:57 PM.
 
  01 January 2011
wohoo! thx denis.
 
  01 January 2011
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:39 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.