|
![](/i/fill.gif) |
Peter Popov wrote:
>
> On Wed, 6 Jun 2001 17:50:20 -0400, "parasonic" <par### [at] home com>
> wrote:
>
> >Is there a way to clip a torus along its internal circle, where you would
> >still have a ring, but it would be an arc of x degrees?
>
> Like this? The arc lies in the x-z plane, starts at +x and goes
> counterclockwise.
>
> #macro Arc (Major, Minor, Degrees)
> intersection
> {
> torus { Major, Minor }
> plane { -z, 0 }
> plane { -z, 0 rotate -Degrees*y }
> }
> #end
>
>
> Peter Popov ICQ : 15002700
> Personal e-mail : pet### [at] vip bg
> TAG e-mail : pet### [at] tag povray org
I made a slightly more thorough version a while ago.
// Angles are in degrees. Torus is described counter_clockwise around
the z axis (for positive angles) starting at Major_radius * x
// Angles with an absolute value greater than 360 returns a complete
torus.
#macro Torus_segment (Major_radius,Minor_radius,Angle)
#if (abs(Angle)>=360)
torus {Major_radius,Minor_radius rotate 90*x}
#else
#if ((abs(Angle)/Angle)>0)
#if (Angle <= 180)
intersection{
torus {Major_radius,Minor_radius rotate 90*x}
plane {-y,0}
plane {y,0 rotate Angle*z}
}
#else
intersection {
merge {
plane {-y,0}
plane {y,0 rotate Angle*z}
}
torus {Major_radius,Minor_radius rotate 90*x}
}
#end
#else
#if (Angle >= -180)
intersection{
torus {Major_radius,Minor_radius rotate 90*x}
plane {y,0}
plane {-y,0 rotate Angle*z}
}
#else
intersection {
merge {
plane {y,0}
plane {-y,0 rotate Angle*z}
}
torus {Major_radius,Minor_radius rotate 90*x}
}
#end
#end
#end
#end
--
Dan Johnson
http://www.geocities.com/zapob
Post a reply to this message
|
![](/i/fill.gif) |