Hypocycloid

Previous Next
Processing Sketches

Your browser does not support the canvas tag.

interface Inputs {
float getAValue();
float getBValue();
boolean getCanClear();
}
Inputs inputs;
void setup(){
size(400, 400);
background(255);
}
float theta = 0.0;
void draw(){
if (inputs != null) {
if (inputs.getCanClear()) {
theta = 0.0;
background(255);
}
theta = theta + .05;
float a = inputs.getAValue();
float b = inputs.getBValue();
stroke(100,0,0);
float x = (a-b)*cos(theta) + (b*cos(((a-b)/b)*theta));
float y = (a-b)*sin(theta) - (b*sin(((a-b)/b)*theta));
translate(150, 150);
point(x, y);
}
}
void bindInputsJS(Inputs inputs){
this.inputs = inputs;
}