Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Uso de MEL (Maya Embedded Language) Para: Números aleatorios Fractales.

Similar presentations


Presentation on theme: "1 Uso de MEL (Maya Embedded Language) Para: Números aleatorios Fractales."— Presentation transcript:

1 1 Uso de MEL (Maya Embedded Language) Para: Números aleatorios Fractales

2 2 Abrir MEL

3 3

4 MEL (Maya Embedded Language) En el Script Editor. File -> Open (O copiar y pegar el script en la parte de abajo del Script Editor). Seleccionar la parte del texto a ejecutar y oprimir el botón: Practicar con el script: “Aleatorios.mel” 4

5 5 sphere; rename nurbsSphere1 a1; select a1; duplicate -rr; for($i=1; $i<=9; ++$i) duplicate -rr -st; for($i=1; $i<=10; ++$i) { select("a"+$i); $x=rand(-5,5); print $x; print " "; $y=rand(1,10); print $y; print " "; $z=rand(-5,5); print $z; print "\r"; move $x $y $z; select -d; }; for($i=1;$i<=10;$i++) { $x = rand(1,1000); select ("a"+$i); rotate $x $x $x; select -d; }; Aleatorios.mel

6 6

7 7

8 8

9 9 Mandelbrot.mel parte 1/3 //All the COLOURS used within the Mandelbrot set. createAndAssignShader lambert ""; setAttr "lambert2.color" -type double ; //blue createAndAssignShader lambert ""; setAttr "lambert3.color" -type double ; //black createAndAssignShader lambert ""; setAttr "lambert4.color" -type double ; //pink createAndAssignShader lambert ""; setAttr "lambert5.color" -type double ; //white createAndAssignShader lambert ""; setAttr "lambert6.color" -type double ; //yellow createAndAssignShader lambert ""; setAttr "lambert7.color" -type double ; //green createAndAssignShader lambert ""; setAttr "lambert8.color" -type double ; //light blue

10 10 int $iter; int $SIZE = 100; //number of spheres to be generated in x and y float $LEFT = -2.0; //constant determining the left most co-ordinate float $RIGHT = 1.0; //constant determining the right most co-ordinate float $TOP = 1.0; //constant determining the upper most co-ordinate float $BOTTOM = -1.0; //constant determining the lower most co-ordinate float $x, $y, $count; float $zr, $zi, $cr, $ci; float $rsquared, $isquared; Mandelbrot.mel parte 2/3

11 for ($y = 0; $y < $SIZE; $y++) { for ($x = 0; $x < $SIZE; $x++) { $zr = 0.0; $zi = 0.0; $cr = $LEFT + $x * ($RIGHT - $LEFT) / $SIZE; $ci = $TOP + $y * ($BOTTOM - $TOP) / $SIZE; $rsquared = $zr * $zr; $isquared = $zi * $zi; for ($count = 0; $rsquared + $isquared <= 4.0 && $count < 200; $count++) { $zi = $zr * $zi * 2 + $ci; $zr = $rsquared - $isquared + $cr; $rsquared = $zr * $zr; $isquared = $zi * $zi; if ($rsquared + $isquared >= 4.0){ $iter = $count; break; } COLOREA CADA ESFERA } Mandelbrot.mel parte 3/3 11 if ($iter >= 0 && $iter <= 1){ sphere -p $x 0 $y -r 0.4; sets -e -forceElement lambert8SG; } if ($iter > 1 && $iter <= 2){ sphere -p $x 0 $y -r 0.5; sets -e -forceElement lambert7SG; } if ($iter > 2 && $iter <= 3){ sphere -p $x 0 $y -r 0.6; sets -e -forceElement lambert6SG; } if ($iter > 3 && $iter <= 5){ sphere -p $x 0 $y -r 0.7; sets -e -forceElement lambert5SG; } if ($iter > 5 && $iter <= 10){ sphere -p $x 0 $y -r 0.8; sets -e -forceElement lambert4SG; } if ($iter > 10 && $iter < 200){ sphere -p $x 0 $y -r 0.8; sets -e -forceElement lambert2SG; } if ($rsquared + $isquared <= 4.0 && $iter = 200){ sphere -p $x 0 $y -r 0.8; sets -e -forceElement lambert3SG; } Cálculos con cada esfera Variable $iter guarda el número de iteración en que x2 + y2 >= 4

12 12

13 13 Planos alternos para el Conjunto de Mandelbrot Plano 1/  Se itera esta función:


Download ppt "1 Uso de MEL (Maya Embedded Language) Para: Números aleatorios Fractales."

Similar presentations


Ads by Google