|
|
"Timothy R. Cook" wrote:
>
> Grey Knight wrote:
> > Here's the code for a flat iris extracted from my archives, maybe
> > you can modify it while I'm away.
>
> Er? Point 1: I use Moray to make my scenes, and don't really get
> into hand coding... Point 2: However, I do see some math in there
> that might be helpful to have a straight explanation of what you're
> doing to accomplish the task with some simple formulas (of the
> 'plug in this number and out comes this other number' variety)
> Maybe a nice diagram...
Sorry I forgot to say the disc_iris macro was originally written by
someone else, then dumped into my personal archives. Here's a quick
breakdown, but I have to run soon, so I can't be more specific. I'm sure
the other guys can help you analyse the transforms if you're having
trouble.
#macro disc_iris(iCenter,iNormal, Radius, NumPetals, Open, UseUnion)
//^syntax is like that of disc{}, but with 3 extra values;
// NumPetals: integer: number of segments in iris
// Open : 0->1 : amount by which iris is open
// UseUnion : boolean: union petals or merge them?
//Original macro by Michael Andrews
//^ someone else wrote this
#declare Center=ensure_vector(iCenter);
#declare Normal=ensure_vector(iNormal);
//^ these just make sure we hae vector values!
intersection{
cylinder{ -0.05*z, 0.05*z, 1 }
//^ Comment out this line to see what happens
//^ It restricts each petal to the region inside the disc
#if(UseUnion)
union{
#else
merge{
#end
#local c=0;#while(c<NumPetals)
cylinder{ -0.01*z, 0.01*z, 1 // a petal
rotate -3*y
translate y
rotate 60*z
translate -y
rotate -Open*Open*120*z
translate y
rotate 360*(c/NumPetals)*z
//^ These transformations are what move the petal to it's proper
// position. I haven't time to parse the whole thing right now,
// but just consider each transform in turn to get a feel for what
// they do. You could even try commenting out all but the first line,
// render, uncomment second line, render, etc to see visually what
// each line does.
}
#local c=c+1;#end
}
scale Radius
rotate 90*x
rotate_to(Normal-Center)
translate Center
//^ these transforms just adjust the radius and position of the iris
// to that specified. rotate_to(Vect) just rotates an object pointing
in
// the +y direction to point in the Vect direction.
}
#end
--
signature{
"Grey Knight" contact{ email "gre### [at] yahoocom" }
site_of_week{ url "http://digilander.iol.it/jrgpov" }
}
Post a reply to this message
|
|