Draw circle with a line by only changing y2 coordonate ?
in
Programming Questions
•
10 months ago
First I want to tell you that i'm french... so it's a little bit difficult to express myself...
I will explain my projet in details... I'm in my last class before my studies in france, in my school there is a special class with programming speciality.
My project is to build a robot and control it with arduino. The robot will be build with two independant motors and only 2 wheels. My goal is to control each motor independantly. Then when the left one move forward, and the second don't move the trajectory of the first motor will be a circle. My professor asked me to "draw" it on processing so i began to draw only a line with respectives coordonates (x1,y1 (first point coordonates) ,x2,y2 (second point coordonates).
x1 and y1 dont change but what i want is that when i press a key, 'b' for example y2 decrease.
But i don't know how to make x2,y2 draw an arc circle...
Then i request your knowledges....
Thank You very much.. i post my code to help you to know what i mean...
sorry for my english..
int x1 = 10;
int y1 = 10;
int x2 = 100;
int y2 = 10;
void setup(){
size(600, 500);
}
void draw(){
background(255,255,255);
line(x1, y1, x2, y2);
}
void keyPressed (){
if (key=='b'){ y2++;}
if (key=='h'){ y2--;}
}
I will explain my projet in details... I'm in my last class before my studies in france, in my school there is a special class with programming speciality.
My project is to build a robot and control it with arduino. The robot will be build with two independant motors and only 2 wheels. My goal is to control each motor independantly. Then when the left one move forward, and the second don't move the trajectory of the first motor will be a circle. My professor asked me to "draw" it on processing so i began to draw only a line with respectives coordonates (x1,y1 (first point coordonates) ,x2,y2 (second point coordonates).
x1 and y1 dont change but what i want is that when i press a key, 'b' for example y2 decrease.
But i don't know how to make x2,y2 draw an arc circle...
Then i request your knowledges....
Thank You very much.. i post my code to help you to know what i mean...
sorry for my english..
int x1 = 10;
int y1 = 10;
int x2 = 100;
int y2 = 10;
void setup(){
size(600, 500);
}
void draw(){
background(255,255,255);
line(x1, y1, x2, y2);
}
void keyPressed (){
if (key=='b'){ y2++;}
if (key=='h'){ y2--;}
}
1