POV-Ray : Newsgroups : povray.advanced-users : Q: smooth union of bezier patches : Q: smooth union of bezier patches Server Time
30 Jul 2024 14:29:47 EDT (-0400)
  Q: smooth union of bezier patches  
From: ingo
Date: 23 Apr 1999 16:48:19
Message: <3720ce83.0@news.povray.org>
While exploring the bezier patches, I can not find a way to attatch two, non
flat, patches without a seam. To get an idea of what I'm trying run the included
scene.

Have been looking at the output of sPatch, but I'm still clueless.

ingo
--
Met dank aan de muze met het glazen oog.

#version 3.1;
global_settings{assumed_gamma 1.0}
light_source{<500,500,-500> rgb 1}
camera{
   location<0.0,3.5,-5.0>
   look_at<0.0,1.0, 0.0>
}
#macro GetRadius(R)
   #local Range=R*0.1;
   #local Variation=Range+((-Range)-Range)*rand(S);
   #declare Rr=R+Variation;
#end

#macro BuildArray(H,R,NrBPH,NrBPC)
// H= height; R= radius
// NrBPH= number of patches in height
// NrBPC= number of patches in circumference
   #local PH=((NrBPH*4)-NrBPH)+1;
   #local PC=((NrBPC*4)-NrBPC)+1;
   #local Ystep=H/PH;
   #local BP_arr=array[PH][PC]
   #local Ypos=0;
   #local I=0;
   #local J=0;
   #while (I<PH)
      #while (J<PC-1)
         #local Phi=J*(360/PC);
         GetRadius (R)
         #declare BP_arr[I][J]=vrotate(<Rr,Ypos,0>,<0,Phi,0>);
         #local J=J+1;
      #end
// closed shape so last point is first point.
      #local BP_arr[I][J]= BP_arr[I][0];
      #local J=0;
      #local Ypos=Ypos+Ystep;
      #local I=I+1;
   #end
   #declare OutArray= BP_arr
#end

#macro BuildPatch(InArray)
   #local PH= dimension_size (InArray,1);
   #local PC= dimension_size (InArray,2);
   #local I= 0;
   #local J= 0;
   #while (I<PH-1)
      #while (J<PC-1)
         bicubic_patch {
            type 1
            u_steps 4
            v_steps 4,
InArray[I][J],InArray[I][J+1],InArray[I][J+2],InArray[I][J+3],
InArray[I+1][J],InArray[I+1][J+1],InArray[I+1][J+2],InArray[I+1][J+3],
InArray[I+2][J],InArray[I+2][J+1],InArray[I+2][J+2],InArray[I+2][J+3],
InArray[I+3][J],InArray[I+3][J+1],InArray[I+3][J+2],InArray[I+3][J+3]
            pigment {rgb 1}
         }
         #local J=J+3;
      #end
      #local J=0;
      #local I=I+3;
   #end
#end

#declare S=seed(7);
BuildArray(3,2,5,10)
BuildPatch(OutArray)


Post a reply to this message

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