topical media & game development

talk show tell print

graphic-processing-algorithm-Ch02-p48-p48.pde / pde



  float P0x = 10., P0y = 10.;
  float P1x = 10., P1y = 40.;
  float P2x = 40., P2y = 60.;
  float P3x = 80., P3y = 20.;
  for(float t=0.; t<1.; t+=0.01){
    float x = pow((1 - t),3)*P0x + 3*t*pow((1 - t),2)*P1x + 3*pow(t,2)*(1 - t)*P2x + pow(t,3)*P3x;
    float y = pow((1 - t),3)*P0y + 3*t*pow((1 - t),2)*P1y + 3*pow(t,2)*(1 - t)*P2y + pow(t,3)*P3y;
    point(x,y);
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.