POV-Ray : Newsgroups : povray.general : Clipping Server Time
7 Aug 2024 19:26:38 EDT (-0400)
  Clipping (Message 1 to 9 of 9)  
From: parasonic
Subject: Clipping
Date: 6 Jun 2001 17:50:20
Message: <3b1ea59c@news.povray.org>
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?

Thanks!


Post a reply to this message

From: Peter Popov
Subject: Re: Clipping
Date: 7 Jun 2001 01:32:14
Message: <9b4uht0k2pdahl512cc1l1kigcrgcivd52@4ax.com>
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


Post a reply to this message

From: Dan Johnson
Subject: Re: Clipping
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

From: Warp
Subject: Re: Clipping
Date: 7 Jun 2001 07:09:19
Message: <3b1f60df@news.povray.org>
I think it can be made more easily and efficiently:

#macro TorusSegment(MajRad, MinRad, Angle)
  #local Ang = abs(Angle);
  #if(Ang >= 360) torus { MajRad, MinRad }
  #else
    intersection
    { torus { MajRad, MinRad }
      #if(Ang>180) union { #end
        plane { -x,0 }
        plane { x,0 rotate -y*Ang }
      #if(Ang>180) } #end
      #local Dim = MajRad+MinRad;
      bounded_by { box { -<Dim,MinRad,Dim>, <Dim,MinRad,Dim> } }
      #if(Angle<0) scale <-1,1,1> #end
    }
  #end
#end


-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Peter Popov
Subject: Re: Clipping
Date: 8 Jun 2001 00:17:34
Message: <1gk0itgknga1vddfuqd1l2efjke6bn5tac@4ax.com>
On Fri, 08 Jun 2001 00:18:59 -0700, Dan Johnson <zap### [at] hotmailcom>
wrote:

>I made a slightly more thorough version a while ago.

<snip>

Not bad. Did you actually test mine in POV, 'coz I didn't have the
time to :)


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Nikodemus Siivola
Subject: Re: Clipping
Date: 8 Jun 2001 17:49:07
Message: <3b214853@news.povray.org>
>   I think it can be made more easily and efficiently:

For some boost you could get rid of the planes, even though they are more
_elegant_... Try this in place of the planes inside the macro:

#local H = 2*MinRad;
#local L = H +MajRad;
box { <0, H, L>, <L, -H, -L> }
box { <0, H, L>, <-L, -H, -L> rotate -y*Ang }

 - Nikodemus


Post a reply to this message

From: Warp
Subject: Re: Clipping
Date: 8 Jun 2001 18:52:23
Message: <3b215727@news.povray.org>
Nikodemus Siivola <tsi### [at] cchutfi> wrote:
: For some boost you could get rid of the planes, even though they are more
: _elegant_...

  I think bounded planes are faster than boxes (supposing the bounding box
of the plane is approximately equal in size as the box).
  Perhaps I should test this.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Nikodemus Siivola
Subject: Re: Clipping
Date: 9 Jun 2001 07:23:09
Message: <3b22071d$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote:

>   I think bounded planes are faster than boxes (supposing the bounding
box
> of the plane is approximately equal in size as the box).

Ooops, sorry. Do I feel silly... I didn't notice the bounding! Well, I you
do test, please tell.

 - Nikodemus


Post a reply to this message

From: Nikodemus Siivola
Subject: Re: Clipping
Date: 11 Jun 2001 12:27:28
Message: <3b24f170$1@news.povray.org>
"Nikodemus Siivola" <tsi### [at] cchutfi> wrote:

>Well, I you do test, please tell.

Was supposed to be: ...if you do test...
Ant nov I kant' ewen vrite. :(

 - Nikodemus


Post a reply to this message

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