|
|
Hi
But what if the loop control variable is a vector that is shared
between several nested loops? (See my example macro below.)
Would this be possible with nested for-loops?
Regards
Tor Olav
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html
PoD wrote:
> Some aspects of the language which relate purely to programming could be
> changed or (probably better) extended without affecting those who don't
> use them.
>
> For a non-programmer or a programmer , macros, loops etc are a lot
> harder in POV than the equivalents in most programming languages.
>
> Surely replacing
> #declare I=1; #while(I<=5) ... #declare I=I+1;#end
> with either
> for I = 1 to 5 {...}
> ala Basic, or even for a non-programmer,
> for( I=1; I <= 5; I=I+1){...}
> would make life easier for all.
>
> PoD.
#macro ObjectSplit(Thing, Point1, Point2, nnv)
// Cuts an object into several "box"-parts
// Result is returned in an array of such parts
//#local nnv = <nx, ny, nz>;
#local ThingArray = array[nnv.x][nnv.y][nnv.z]
#local dPoint = (Point2 - Point1)/nnv;
#local Cntv = Nullv;
#while (Cntv.z < nnv.z)
#local Cntv = Cntv*z;
#while (Cntv.y < nnv.y)
#local Cntv = Cntv*(y+z);
#while (Cntv.x < nnv.x)
#local ThingArray[Cntv.x][Cntv.y][Cntv.z] =
intersection {
object { Thing }
box { Point1 + dPoint*Cntv, Point1 + dPoint*(Cntv+Unitv) }
}
#local Cntv = Cntv+x;
#end // while
#local Cntv = Cntv+y;
#end // while
#local Cntv = Cntv+z;
#end // while
ThingArray
#end // macro ObjectSplit
Post a reply to this message
|
|