Hm; OK. For a second let's just forget about the mouse.
How about a way to just draw the triangle? I don't want to use all of the built-in functions; I'm really looking to learn more about the math involved.
I'm not looking for someone to do this for me, but I really thought it would be something closer to:
Code:float prevx, prevy, nextx, nexty, radius, angle;
int deg, midx, midy;
void setup()
{
size(400,400);
fill(200);
midx = width/2;
midy = height/2;
radius = 80;
}
void draw()
{
background(100);
translate(midx, midy);
beginShape();
for(deg = 0; deg < 360; deg += 120)
{
angle = deg * PI / 180;
nextx = cos(angle) * radius;
nexty = sin(angle) * radius;
vertex(nextx, nexty);
}
endShape(CLOSE);
}
... but I want the triangle to sit pointing directly upwards (north).
For ex., if I add the code...
Code: rotate(radians(30));
...after the shape has been ended, it seems to be sorta straight; but I know that there is more to this; I would like to know what I need to do to have the for loop draw the correct vertices...
Thanks