mel script and math for honeycomb image sal2
Greetings all
I’m trying to adapt this mel script that was given to me to use hexagons
so when I deform it all the edges connect like this
http://www.youtube.com/watch?v=-nao3-YnsMo
I know it’s a problem with my math but I’m not sure how to fix it so all
the hexagons are connected when they are created with the mel script.
tia sal2
//==============================================================
proc drawPlane (float $x1,float $z1){
polyPlane -sh 1 -sw 1; //create with one face
move -r $x1 0 $z1; //diamond
rotate -r -os 0 -45 0;
};
//====================
proc diagonalPlanes(){
float $x, $z, $len, $max, $diag;
$len = sind(45.0);
$diag = 2 * sind(45.0);
$max = 10;
//Draw the outer shell
for ($x = 0; $x < $max; $x++ ){
for ($z = 0; $z < $max; $z++ ){
drawPlane($x*$diag, $z*$diag);
}
}
//Draw the inner shell: max = N-1, and offset = .707
//$max--; // draw 1 less row and column
for ($x = 0; $x < ($max); $x++ ){
for ($z = 0; $z < ($max); $z++ ){
drawPlane( ($x*$diag+$len), ($z*$diag+$len));
// with an offset added of: .707 0 .707
}
}
};
diagonalPlanes();