1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | global proc int sierp(int $counter , int $max) { int $currentCounter = $counter ; if($currentCounter == $max) { return 0 ; } string $objs[]; clear($objs); $objs = `ls -sl -tr`; string $newObjsList[]; clear($newObjsList); for( $item in $objs) { string $tempArray[]; // pega Bouding Box float $bbox[]= `polyEvaluate -b $item`; // separa em elemtos float $xmin = $bbox[0]; float $xmax = $bbox[1]; float $ymin = $bbox[2]; float $ymax = $bbox[3]; float $zmin = $bbox[4]; float $zmax = $bbox[5]; //print $xmin ; //print "\n" ; //print $xmax ; //print "\n" ; // acha divisoes float $quarter = ($xmax - $xmin)/4; float $half = ($xmax - $xmin) /2; float $leftQuarter = ($xmin + $quarter); float $rightQuarter = ($xmax - $quarter); float $mid = $xmin + $half ; float $bottomQuarter = ($ymin + $quarter); float $topQuarter = ($ymax - $quarter); float $topMid = ($ymax - $half); float $frontQuarter = ($zmax - $quarter); float $backQuarter = ($zmin + $quarter); float $frontMid = ($zmax - $half); //********** CRIA CUBOS ************ //LEFT BOTTOM FRONT $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $leftQuarter $bottomQuarter $frontQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); //RIGHT BOTTOM FRONT $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $rightQuarter $bottomQuarter $frontQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); //LEFT BOTTOM BACK $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $leftQuarter $bottomQuarter $backQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); //RIGHT BOTTOM BACK $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $rightQuarter $bottomQuarter $backQuarter ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); // MID TOP FRONTMID $tempArray = `polyCube -w $half -h $half -d $half -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`; move -absolute $mid $topQuarter $frontMid ; $newObjsList[size($newObjsList)] = $tempArray[0]; clear($tempArray); // DELETA OBJ ORIGINAL delete $item; } $currentCounter += 1; select $newObjsList; sierp($currentCounter , $max); return 0; } sierp(0, 5); |
quarta-feira, 8 de abril de 2015
Sierpinski_triangle
Crie um Cubo e Rode o Script com o Cubo selecionado :
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário