POV-Ray : Newsgroups : povray.general : Suggestion for new object : Re: Suggestion for new object Server Time
14 Aug 2024 01:15:27 EDT (-0400)
  Re: Suggestion for new object  
From: Ron Parker
Date: 16 Jul 1998 15:52:13
Message: <35ae4bdd.0@news.povray.org>
/*
On Thu, 16 Jul 1998 16:24:24 +0100, Dylan Beattie 
  <dmb### [at] ecssotonacuk-NOSPAM> wrote:
>I've always thought when making 'warped' boxes that if you could define
>a plane in terms of three points that lie *on* the plane and one that
>lies outside it, it would be a lot easier to use CSG's of six planes or
>more to create complex solid shapes. 
*/

////////////////////////////
//
//   File: plane3.inc
// Author: Ronald L. Parker
//   Date: 16 July 1998
// 
// Requires POV Version 3.1 or newer
//
// This macro creates a plane that passes through points A, B, and C and
// has a normal such that Outside is outside the plane.  If you know a
// point inside the plane instead, use the inverse keyword in your object
// definition.
//
// Use of collinear points for A, B, and C will cause a degenerate normal.
// 
// To use this macro, create an object like so:
//   object {plane3(Q1,Q2,Q3,Q4) texture{ ... } }
//
// If you're not going to specify a texture or other modifiers such as
// inverse or hollow, you may leave off the enclosing object{}.
//
////////////////////////////

#macro plane3( A, B, C, Outside ) 
  #local N=vnormalize(vcross(B-A,C-A));
  #if ( vdot( Outside-A, N ) < 0 )
    #declare N=-N;
  #end
  plane { N, vdot(A,N) }
#end


Post a reply to this message

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