Generating Darwin’s Galapagos Finches

BirdFaceGeneratorDarwinFinch

For the face generator project, I decided to create a program that generates finches, based off of the beak permutations found in Darwin’s finches of the Galapagos Islands (see images below). I pretty much eyeballed the parameters for the finches’ basic beak shapes, but I think this project would be worth revisiting with accurate mathematical data reflecting each beak’s dimensions. With regards to my completed program, I’d like to find a way to make the curvature of the beak less prominent in the smaller beak permutations.

Darwin's Finches Darwin's_finches_by_Gould

//Miranda Jacoby
//majacoby@andrew.cmu.edu
//EMS INTERACTIVITY SECTION A
//Copyright Miranda Jacoby 2014

//Variable Bird Faces

float headX = 25;
float headY = -50;
float headBeakAnchorX1 = random(100, 110);
float headBeakAnchorY1 = random(175, 200); //range of randdomness to atleast 200
float headBeakAnchorX2 = 150;
float headBeakAnchorY2 = 350; //Throat control. Currently unused, see headBeakAnchors

//Anchor the eye x and y pos to some dimension of the beak
float eyeX = 200 + headBeakAnchorX1/10;
float eyeY = 140 + headBeakAnchorY1/10;
float eyeH = 30;
float eyeW = 35;

float beakX = 0;
float beakY = 0;
float beakHeight = 100; //Currently unsued, see headbeakAnchors
float beakWidth = random(25, 60); //10 is a long beak, 100 is a short beak
float beakAnchorX = 200;
float beakAnchorY = 200;

void setup() {

  size(400, 400);
  //Values for messing about with tweak
  headX = 25;
  headY = -50;
  headBeakAnchorX1 = 99;
  headBeakAnchorY1 = 175; //range of randdomness to atleast 200
  headBeakAnchorX2 = 138;
  headBeakAnchorY2 = 333; //Currently unused, see headBeakAnchors
  beakHeight = 100; //Currently unsued, see headbeakAnchors
  beakWidth = 49; //25 is a long beak, 70 is a short beak
  beakAnchorX = 200;
  beakAnchorY = 200;
}

void draw() {



  background(255);

  //birdhead  
  noStroke();
  fill(0);
  beginShape();
  curveVertex(headX + 50, headY + 275);
  curveVertex(headX + 150, headY + 350);
  curveVertex(headX + 350, headY + 375);
  curveVertex(headX + 250, headY + 175);
  curveVertex(headX + headBeakAnchorX1, headY + headBeakAnchorY1); //Link this to the top of the beak
  curveVertex(headX + headBeakAnchorX2, headY + headBeakAnchorY2);
  curveVertex(headX + 200, headY + 400);
  endShape(CLOSE);
  
  //birdbody
  fill(0);
  ellipse(310, 340, 300, 250);

  //birdbeak
  //Change headbeakAnchors, subtract beakHeight from them
  fill(234, 188, 152);
  beginShape();
  vertex(beakX + beakAnchorX, beakY + beakAnchorY    );
  
  vertex(headX + headBeakAnchorX1, headY + headBeakAnchorY1);
  
  //curveVertex(819, 572);
    curveVertex(beakAnchorX + 639, beakAnchorY + 185);
    curveVertex(beakX + beakAnchorX, beakY + beakAnchorY    );
    curveVertex(beakX + beakWidth, beakY + beakAnchorY);
    curveVertex(beakAnchorX + 58, beakAnchorY + -43);
  //vertex(beakX + beakWidth, beakY + beakAnchorY    );
  
  
  //vertex(beakX + headBeakAnchorX2, beakY + headBeakAnchorY2);//(beakAnchorY + beakWidth/3));
  vertex(beakX + headBeakAnchorX2, beakY + (beakAnchorY + beakWidth/3));
  endShape(CLOSE);

  //Line seperating top and bottom of beak
  //Averages highest and lowest point, connects to beak tip and beak anchor
  stroke(245, 229, 210);
  strokeJoin(ROUND);
  strokeWeight(2);
  line(beakX + beakAnchorX, beakY + beakAnchorY, (beakWidth/2)+(headBeakAnchorX1 + headBeakAnchorX2)/2, (beakHeight/5) + (headBeakAnchorY1 + headBeakAnchorY2)/3 );
  line( (beakWidth/2) + (headBeakAnchorX1 + headBeakAnchorX2)/2, (beakHeight/5) + (headBeakAnchorY1 + headBeakAnchorY2)/3, beakX + beakWidth, beakY + beakAnchorY);
  noStroke();

  //birdeye
  fill(255);
  //Eye Ring
  ellipse(eyeX, eyeY, eyeW, eyeH);
  //Eye Iris
  fill(88, 48, 18);
  ellipse(eyeX, eyeY, eyeW - 5, eyeH - 5);
  //Eye Pupil
  fill(0);
  ellipse(eyeX, eyeY, eyeW - 20, eyeH - 15);
  //Highlight
  fill(255);
  ellipse(eyeX - 5, eyeY - 5, eyeW -28, eyeH -27);

  
}
////Make Bird's beak change randomly by clicking
void mousePressed(){
  
  headBeakAnchorX1 = random(100, 110);
  headBeakAnchorY1 = random(175, 220);
  beakWidth = random(35, 80);
  eyeX = 200 + headBeakAnchorX1/8;
  eyeY = 140 + headBeakAnchorY1/8;
}

Comments are closed.