POV-Ray : Newsgroups : povray.text.scene-files : Proximity Pattern and 3.5 : Re: Proximity Pattern and 3.5 Server Time
3 Jul 2024 01:55:48 EDT (-0400)
  Re: Proximity Pattern and 3.5  
From:
Date: 8 Feb 2002 07:11:44
Message: <upf76ugdq6dlluklhiib1umos8qsk8k7hc@4ax.com>

> 1) additional select() to perform tests only inside/outside object
> 2) additional calculations to perform tests in direction of bounding box

Ok, I've made simple form of above.
New parameter Inside with yes/no value.
- no - leave inside of object empty
- yes - leave inside of object solid
To achive proximity pattern of both - inside and outside - it requires combination
of patterns with normal and inverted object.
Here is new version of macro:

#macro Proximity_Pattern(Object,Range,Count,Inside)
  #local P=function{pattern{object{Object}}};
  #local N=function{2*f_noise_generator(x,y,z,2)-1};
  #local Range=Range+0*x;
  #local X=abs(Range.x);
  #local Y=abs(Range.y);
  #local Z=abs(Range.z);
  #local Inside=(Inside?1:0);
  #local
B=function{pattern{object{box{min_extent(Object)-<X,Y,Z>max_extent(Object)+<X,Y,Z>}}}};
  #local C=max(int(Count)0);
  #local Proximity=function{
    (1/C)*(
    #while(C)
      P(
        x+X*N(x+C,y,z),
        y+Y*N(x,y+C,z),
        z+Z*N(x,y,z+C)
      )
      #local C=C-1;
      #if(C)+#end
    #end
    )
  };
  function{select(B(x,y,z),0,0,select(P(x,y,z),0,Proximity(x,y,z),Inside))}
#end

ABX


Post a reply to this message

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