POV-Ray : Newsgroups : povray.general : Clipping : Re: Clipping Server Time
7 Aug 2024 21:18:22 EDT (-0400)
  Re: Clipping  
From: Dan Johnson
Date: 7 Jun 2001 03:17:26
Message: <3B207C63.9C3E6264@hotmail.com>
Peter Popov wrote:
> 
> On Wed, 6 Jun 2001 17:50:20 -0400, "parasonic" <par### [at] homecom>
> 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] vipbg
> TAG      e-mail : pet### [at] tagpovrayorg

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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.