POV-Ray : Newsgroups : povray.newusers : difference, plane : Re: difference, plane Server Time
28 Jul 2024 16:29:28 EDT (-0400)
  Re: difference, plane  
From: Larry Hudson
Date: 12 Apr 2008 20:45:59
Message: <480157c7@news.povray.org>
stevenvh wrote:
> In the past I always "differenced" objects, never a plane, and maybe that's why
> I never noticed this before. Say I want a sphere with the top cut off:
> 
> difference {
>     sphere { 0 1  }
>     plane { y 0.8 }
>     texture { T_Brass_1D }
> }
> 
> Not what I want; only the top segment is kept. Logic holds that
> 
>     plane { -y -0.8 }
> 
> should do the trick, cutting away the stuff above the (inversed) plane instead
> of below it. But POV-Ray doesn't seem to accept negative distances here!
> How do I do this?
> TIA
> 

The key here is that, for CSG, the "inside" of a plane is the side 
_opposite_ the normal.  Also, the second parameter in the plane is the 
distance from the origin _in the direction of_ the normal.  (Plus, as 
others here have pointed out, be sure to use the commas in these 
expressions.)  IOW:

      difference {
         sphere { 0, 1 }
         plane { y, 0.8 }
         texture { Whatever }
      }

gives you the top "cap" of the sphere, and plane { -y, 0.8 } gives the 
same "cap" but from the bottom of the sphere.  What you're looking for 
is plane { -y, -0.8 }.  See the attached illustration.

Hope this clarifies things.    :-)

      -=- Larry -=-


Post a reply to this message


Attachments:
Download 'diff.png' (19 KB)

Preview of image 'diff.png'
diff.png


 

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