On Tue, 02 Oct 2007 04:56:57 GMT, temp <temp@[EMAIL PROTECTED]
> wrote:
Hey sal2...
I seem to recall a Canadian TV commercial about diagonal shredded wheat...
You could simply place the required cubes in a square pattern, group them
together and then rotation the entire group 45 degrees.
However diagonal construction has its uses.When you work with 3D
constructions
the square root of 3 is often used to center objects with a face to face
unity.
Four octahedrons can be aligned to a tetrahedrons faces using the square
root of
3.
For your mel script, you could do this in many ways...
But you seem to be looking for an outer shell limit and then filling the
shell,
so...
//==============================================================
proc drawCube (float $x1,float $z1){
polyCube;
move -r $x1 0 $z1; //diamond
rotate -r -os 0 -45 0;
};
//====================
proc diagonalCubes(){
float $x, $z, $len, $max, $diag;
$len = sind(45.0);
$diag = 2 * sind(45.0);
$max = 4;
//Draw the outer shell
for ($x = 0; $x < $max; $x++ ){
for ($z = 0; $z < $max; $z++ ){
drawCube($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++ ){
drawCube( ($x*$diag+$len), ($z*$diag+$len));
// with an offset added of: .707 0 .707
}
}
};
diagonalCubes();
//==============================================================
hth's aen
>Greetings all
>
>I have a mel script that works at making diamond shapes across and
down..I would like it to also have a diamond shape
>where the gaps are located in between ...I think I need another for loop
but I'm not sure if I need another variable.
>
>int $i;
>int $j;
>for ($i =0; $i <4; $i++) {
> for ($j=0; $j<4; $j++) {
>
> polyCube;
> move -r ($j*1.414) 0 ($i*1.414); //diamond
> rotate -r -os 0 -45 0;
>
>/* The diagonal of a square with a base of 1 is 1.414
> or square root of 2, or a 45 degree angle */
> }
>}
>tia sal2


|