POV-Ray : Newsgroups : povray.general : Announce: IsoCSG include file 0.2.1 : Re: Announce: IsoCSG include file 0.2.1 Server Time
19 Nov 2024 11:25:45 EST (-0500)
  Re: Announce: IsoCSG include file 0.2.1  
From:
Date: 14 Mar 2002 08:31:23
Message: <4a919u88sccs10t78e21ssgf4aimjlm1s0@4ax.com>
On Wed, 13 Mar 2002 14:36:39 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> I fixed a few problems since i posted the first version in p.b.s-f.  Also
> wrote some documentation and an add-on for the Povray 3.5 insert menu.
>
> http://www.tu-bs.de/~y0013390/pov/ic/index.html

Here is proposition of IC_Box macro with function returning linear distance to
the box shape.

#macro IC_Box( Start , End )
  #local Start=Start+<0,0,0>;
  #local End=End+<0,0,0>;

  #local Cx=max(Start.x, End.x);
  #local Cy=max(Start.y, End.y);
  #local Cz=max(Start.z, End.z);
  #local Dx=min(Start.x, End.x);
  #local Dy=min(Start.y, End.y);
  #local Dz=min(Start.z, End.z);

  #local Inside=function{pattern{object{box{ Start , End }}}};
    
  function(x, y, z){
    select(
      Inside(x,y,z),
      0,
      f_r(min(x-Dx,max(x-Cx,0)),min(y-Dy,max(y-Cy,0)),min(z-Dz,max(z-Cz,0))),
      max(x-Cx, y-Cy, z-Cz, Dx-x, Dy-y, Dz-z)
    )
  }
#end

ABX


Post a reply to this message

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