Probabilidad
Download
Report
Transcript Probabilidad
Uso de MEL (Maya Embedded
Language)
Para:
• Números aleatorios
• Fractales
1
Abrir MEL
2
3
MEL (Maya Embedded Language)
4
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”
sphere;
rename nurbsSphere1 a1;
select a1;
duplicate -rr;
for($i=1; $i<=9; ++$i)
duplicate -rr -st;
5
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;
};
Aleatorios.mel
for($i=1;$i<=10;$i++)
{
$x =
rand(1,1000);
select ("a"+$i);
rotate $x $x $x;
select -d;
};
6
7
Aleatorios.mel
8
Mandelbrot.mel
parte 1/3
//All the COLOURS used within the Mandelbrot set.
createAndAssignShader lambert "";
setAttr "lambert2.color" -type double3 0.0 0.0 1.0
createAndAssignShader lambert "";
setAttr "lambert3.color" -type double3 0.0 0.0 0.0
createAndAssignShader lambert "";
setAttr "lambert4.color" -type double3 1.0 0.0 1.0
createAndAssignShader lambert "";
setAttr "lambert5.color" -type double3 1.0 1.0 1.0
createAndAssignShader lambert "";
setAttr "lambert6.color" -type double3 1.0 1.0 0.0
createAndAssignShader lambert "";
setAttr "lambert7.color" -type double3 0.0 1.0 0.0
createAndAssignShader lambert "";
setAttr "lambert8.color" -type double3 0.0 1.0 1.0
9
; //blue
; //black
; //pink
; //white
; //yellow
; //green
; //light blue
Mandelbrot.mel
parte 2/3
int $iter;
int $SIZE = 100;
float $LEFT = -2.0;
float $RIGHT = 1.0;
float $TOP = 1.0;
float $BOTTOM = -1.0;
//number of spheres to be generated in x and y
//constant determining the left most co-ordinate
//constant determining the right most co-ordinate
//constant determining the upper most co-ordinate
//constant determining the lower most co-ordinate
float $x, $y, $count;
float $zr, $zi, $cr, $ci;
float $rsquared, $isquared;
10
for ($y = 0; $y < $SIZE; $y++)
Mandelbrot.mel
if ($iter >= 0 && $iter <= 1){
{
sphere -p $x 0 $y -r 0.4;
parte 3/3
sets
-e
-forceElement
lambert8SG;
for ($x = 0; $x < $SIZE; $x++)
}
{
$zr = 0.0; $zi = 0.0;
if ($iter > 1 && $iter <= 2){
sphere
-p $x 0 $y -r 0.5;
$cr = $LEFT + $x * ($RIGHT - $LEFT)
/ $SIZE;
sets
-e
-forceElement lambert7SG;
$ci = $TOP + $y * ($BOTTOM - $TOP) / $SIZE;
}
$rsquared = $zr * $zr;
if ($iter > 2 && $iter <= 3){
$isquared = $zi * $zi;
Cálculos con cada esfera
sphere -p $x 0 $y -r 0.6;
sets -e -forceElement lambert6SG;
$isquared
<= 4.0
}
for ($count = 0; $rsquared +
&& $count < 200; $count++)
if ($iter > 3 && $iter <= 5){
{
sphere -p $x 0 $y -r 0.7;
$zi = $zr * $zi * 2 + $ci;
sets -e -forceElement lambert5SG;
}
$zr = $rsquared - $isquared + $cr;
$rsquared = $zr * $zr;
if ($iter > 5 && $iter <= 10){
$isquared = $zi * $zi;
sphere -p $x 0 $y -r 0.8;
sets -e -forceElement lambert4SG;
}
4.0){
if ($rsquared + $isquared >=
$iter = $count;
Variable
guarda
el
if ($iter
> 10 $iter
&& $iter
< 200){
sphere
$x 0 $y
break;
número
de -p
iteración
en-r 0.8;
sets
-e
-forceElement
lambert2SG;
}
que x2 + y2 >= 4
}
}
COLOREA CADA ESFERA
}
}
11
if ($rsquared + $isquared <= 4.0 && $iter = 200){
sphere -p $x 0 $y -r 0.8;
sets -e -forceElement lambert3SG;
}
12
Planos alternos para el Conjunto de
Mandelbrot
Plano 1/m
1/ m
Se itera esta función:
2
n1
n
z
13
z 1/
m 1/