POV-Ray : Newsgroups : povray.text.scene-files : Re: Announce: IsoCSG include file 0.2.1 : Re: Announce: IsoCSG include file 0.2.1 Server Time
29 Jul 2024 04:33:28 EDT (-0400)
  Re: Announce: IsoCSG include file 0.2.1  
From:
Date: 14 Mar 2002 11:14:16
Message: <i0j19u4tb02n2dkmc7qv3np7vkoo5k703h@4ax.com>
On Thu, 14 Mar 2002 15:06:20 +0100, Christoph Hormann <chr### [at] gmxde> wrote:
> now you just need the same for cylinders 

#macro IC_Cylinder (Start, End, Radius)
  #local Center = <0,0,0>+(Start+End)/2;

  #local Cx=Center.x;
  #local Cy=Center.y;
  #local Cz=Center.z;

  #local Len=vlength(End-Center);

  #if (Len=0)
    #error "iso_csg.inc: Error: zero height cylinder"
  #end

  #local fn_T=function { Reorient_Trans(End-Center, x)  }

  #local fn_X=
  function(x, y){
    select(x,max(x,y),select(y,max(x,y),f_r(x,y,0)))
  }
  #local fn_Y=
  function(x, y, z){
    fn_X( abs(fn_T(x, y, z).x)-Len, f_r(0,fn_T(x, y, z).y,fn_T(x, y, z).z)-Radius)
  }

  function(x, y, z){
    (fn_Y((x-Cx),(y-Cy),(z-Cz)))
  }
#end

ABX


Post a reply to this message

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