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 10:28:02 EDT (-0400)
  Re: Announce: IsoCSG include file 0.2.1  
From:
Date: 25 Mar 2002 05:42:01
Message: <7fvt9u0qv5357ile4c5a638ku65dd69c2g@4ax.com>

> Here is proposition of ...

IC_Cylinder_Hole which in fact is shape of intersection of two cylinders
along one axis. Note that this macro has proper inside/outside behaviour and
is compatible with "sharp/rounded" strategy becouse internally use IC_Box.

#macro IC_Cylinder_Hole (Start, End, Radius, Hole)
  #local Cx=Start.x;
  #local Cy=Start.y;
  #local Cz=Start.z;

  #local Len=vlength(End-Start);

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

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

  #local fn_X = IC_Box( <0,Hole,-2*max(Len,Radius,Hole)> ,
<Len,Radius,2*max(Len,Radius,Hole)> );

  #local fn_Y = function(x, y, z){
    fn_X( fn_T(x, y, z).x , f_r( 0 , fn_T(x, y, z).y , fn_T(x, y, z).z ) , 0 )
  }
  
  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.