|
|
See below for my suggestion for this macro.
Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html
Chris Huff wrote:
>
> Try this rewritten version, I neglected to include the counter variable:
>
> #declare Animation = off;
>
> #macro CircleCoil(RadiusMinor, TurnsMinor, RadiusMajor, TurnsMajor,
> Parts)
> #if(Animation=on)
> // must have at least one component in blob
> #local StopVal = Parts*clock + 1;
> #else
> #local StopVal = Parts;
> #end
> blob {
> #local I=0;
> #while(I < StopVal)
> //////////// Sphere ////////////
> sphere {< 0, 0, 0>, 0.5, strength 2
> scale < 0.5, 50/Parts, 0.5 >
> translate vrotate(z,
> y*(I/(Parts-1))*TurnsMinor*360)*RadiusMinor
> rotate < 0, 0, 90-((I/(Parts-1))*360)>
> translate
> vrotate(y,-z*(I/(Parts-1))*TurnsMajor*360)*RadiusMajor
> }
> #local I = I+1;
> #end
> }// end blob
> #end// end CircleCoil
>
> object {CircleCoil(< 0.25, 0, 0.25>, 8, < 1.25, 1.25, 0>, 1, 1000)
> rotate < 90, 0, 0>
> texture {
> pigment {color rgb < 0.7, 0.8, 0.9>}
> finish {
> ambient 0.125
> //reflection 0.95
> }
> }
> translate y*0.5
> } // end object
>
#macro CircleCoil(RadiusMinor, TurnsMinor,
RadiusMajor, TurnsMajor,
Parts, Animation)
#local dPhi = 360/(Animation ? 1 + (Parts - 1)*clock : Parts);
blob {
#local Phi = 0;
#while (Phi < 360)
sphere {
<0, 0, 0>, 0.5,
strength 2
scale <1, 100/Parts, 1>/2
translate RadiusMinor*vrotate(z, Phi*TurnsMinor*y)
rotate (90 - Phi)*z
translate RadiusMajor*vrotate(y, -Phi*TurnsMajor*z)
}
#local Phi = Phi + dPhi;
#end
}
#end // macro CircleCoil
object {
CircleCoil(<0.25, 0, 0.25>, 8, <1.25, 1.25, 0>, 1, 1000, off)
rotate 90*x
texture {
pigment { color rgb <0.7, 0.8, 0.9> }
finish {
ambient 0.125
// reflection 0.95
}
}
translate y/2
}
Post a reply to this message
|
|