Skip to content

Instantly share code, notes, and snippets.

@jkwok91
Created March 13, 2014 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkwok91/fdc1a588e6ebc03a8022 to your computer and use it in GitHub Desktop.
Save jkwok91/fdc1a588e6ebc03a8022 to your computer and use it in GitHub Desktop.
something simple to draft something else i want to do
/*
includes Point, Triangl, EqTri1 classes, as well as the drawLine method
*/
int w = 200;
int h = 200;
color c = color(255,255,0); //yellow!
Point apex;
int rad;
double halfside;
double altitude;
void setup() {
size(w,h);
background(0);
frameRate(12);
apex = new Point(w/2,h/2);
rad = 30;
}
void draw() {
clear();
EqTri1 t1 = new EqTri1(apex,rad);
t1.drawT();
rad = (int)(Math.random()*10+10);
halfside = rad*(Math.sin(Math.PI/3));
altitude = rad*3/2;
apex.xcor = (int)(Math.random()*(width-2*(halfside+1))+(halfside+1));
apex.ycor = (int)(Math.random()*(height-2*(altitude+1))+(altitude+1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment