POV-Ray : Newsgroups : povray.text.scene-files : Biquadratic interpolation of height field data Server Time
8 Jul 2024 11:51:40 EDT (-0400)
  Biquadratic interpolation of height field data (Message 1 to 1 of 1)  
From: John VanSickle
Subject: Biquadratic interpolation of height field data
Date: 20 Oct 2000 17:24:13
Message: <39F0B937.1A287925@erols.com>
Here is the scene file I used.  An MP can be found in p.b.animations.

//START OF SCENE CODE

#macro BiQuadric(iA,iB,iC,iD,sE,iF,iG,iH,iI)

#local sA=(iA+iB+iD+sE)/4;
#local sB=(iB+sE)/2;
#local sC=(iB+iC+sE+iF)/4;
#local sD=(iD+sE)/2;
#local sF=(sE+iF)/2;
#local sG=(iD+sE+iG+iH)/4;
#local sH=(sE+iH)/2;
#local sI=(sE+iF+iH+iI)/4;

#local yL=min(min(min(min(min(min(min(min(sA,sB),sC),sD),sE),sF),sG),sH),sI);
#local yH=max(max(max(max(max(max(max(max(sA,sB),sC),sD),sE),sF),sG),sH),sI);

#local K22=sA+sC+sG+sI-2*(sB+sD+sF+sH)+4*sE;
#local K21=-2*sA+4*sB-2*sC + 2*sD-4*sE+2*sF;
#local K12=-2*sA+4*sD-2*sG + 2*sB-4*sE+2*sH;
#local K11=(sA-sB-sD+sE)*4;
#local K20=sA-2*sB+sC;
#local K02=sA-2*sD+sG;
#local K01=(sD-sA)*2;
#local K10=(sB-sA)*2;
#local K00=sA;

#if(K22=0)
  #if(K21=0 & K12=0)
    //quadric
  quadric {
<
  K20, // 200
  0, // 020
  K02>, // 002
< 0, // 110
  K11, // 101
  0>, // 011
< K10, // 100
  -1, // 010
  K01>, // 001
  K00 // 000
  #else
  cubic {
< 0, // 300
  0, // 210
  K21, // 201
  K20, // 200
  0, // 120
  0, // 111
  0, // 110
  K12, // 102
  K11, // 101
  K10, // 100
  0, // 030
  0, // 021
  0, // 020
  0, // 012
  0, // 011
  -1, // 010
  0, // 003
  K02, // 002
  K01, // 001
  K00> // 000
  #end
#else
  quartic {
< 0, // 400
  0, // 310
  0, // 301
  0, // 300
  0, // 220
  0, // 211
  0, // 210
  K22, // 202
  K21, // 201
  K20, // 200
  0, // 130
  0, // 121
  0, // 120
  0, // 112
  0, // 111
  0, // 110
  0, // 103
  K12, // 102
  K11, // 101
  K10, // 100
  0, // 040
  0, // 031
  0, // 030
  0, // 022
  0, // 021
  0, // 020
  0, // 013
  0, // 012
  0, // 011
  -1, // 010
  0, // 004
  0, // 003
  K02, // 002
  K01, // 001
  K00> // 000
#end
  clipped_by { box { <0,yL,0>,<1,yH,1> } }
  bounded_by { clipped_by }
}
#end

#local W=16;

#local H=array[W][W]

#local S=seed(0);

#local iI=0; #while(iI<W)
#local iJ=0; #while(iJ<W)

#local H[iI][iJ]=rand(S)*cos(clock*pi)+rand(S)*sin(clock*pi);

#local iJ=iJ+1; #end
#local iI=iI+1; #end

#local iI=0; #while(iI<W-2)
#local iJ=0; #while(iJ<W-2)

object {
  BiQuadric(
    H[iI  ][iJ  ],H[iI+1][iJ  ],H[iI+2][iJ  ],
    H[iI  ][iJ+1],H[iI+1][iJ+1],H[iI+2][iJ+1],
    H[iI  ][iJ+2],H[iI+1][iJ+2],H[iI+2][iJ+2]
  )
  translate <iI-W/2+1,0,iJ-W/2+1>
  pigment { rgb .75 }
}
  
#local iJ=iJ+1; #end
#local iI=iI+1; #end

#local iI=0; #while(iI<W)
#local iJ=0; #while(iJ<W)

#if(iI<W-1)
  cylinder { <iI-W/2+.5,H[iI][iJ],iJ-W/2+.5>,<iI-W/2+1.5,H[iI+1][iJ],iJ-W/2+.5>,.05
    pigment { rgb <1,0,0> } }
#end
#if(iJ<W-1)
  cylinder { <iI-W/2+.5,H[iI][iJ],iJ-W/2+.5>,<iI-W/2+.5,H[iI][iJ+1],iJ-W/2+1.5>,.05
    pigment { rgb <0,.75,0> } }
#end
  
#local iJ=iJ+1; #end
#local iI=iI+1; #end

#local CamE=<1,0,-.2>*W/14;
#local CamL=CamE+<8,6,1.6>*W/14*2.5;
camera {
  location CamL
  right x*4/3
  up y
  direction z*2.5
  look_at CamE
}

light_source { <1e4,3e4,1e4> rgb 1 }

-- 
ICQ: 46085459


Post a reply to this message

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