void draw() {
switch (hStroke) {
case 1:
draw1stStrokeH();
break;
case 2:
draw2ndStrokeH();
break;
case 3:
draw3rdStrokeH();
break;
}
switch (cStroke) {
case 1:
draw1stStrokeC();
break;
}
}
void draw1stStrokeH() {
if (bInit) { // initialize
bInit = false;
x = 100;
y = 100;
}
else { // draw
ellipse(x, y, cSize, cSize);
y = y + change;
if (y > 300) {
hStroke++;
bInit = true;
}
}
}
void draw2ndStrokeH() {
if (bInit) { // initialize
bInit = false;
x = 250;
y = 100;
}
else { // draw
ellipse(x, y, cSize, cSize);
y = y + change;
if (y > 300) {
hStroke++;
bInit = true;
}
}
}
void draw3rdStrokeH() {
if (bInit) { // initialize
bInit = false;
x = 100;
y = 185;
}
else { // draw
ellipse(x, y, cSize, cSize);
x = x + change;
y = 185;
if (x > 250) {
hStroke++;
bInit = true;
}
}
}
void draw1stStrokeC() {
if (bInit) { // initialize
bInit = false;
}
else { // draw
float x; // local variable
float y;
x=xCenter+radius * cos(radians(angle));
y=yCenter+radius * sin(radians(angle));
ellipse(x, y, cSize, cSize);
angle = angle + change;
if (angle>310)
cStroke++; {
bInit = true;
}
}
}
i was taught how to do an letter N but since the Y axis is inverted i couldn't calculate the slope for V.
this is the code for a Letter N
// initial N
int x;
float y;
float slope;
float b;
int cSize;
int change;
boolean bInit;
int nStroke;
void draw() {
switch (nStroke) {
case 1:
draw1stStrokeN();
break;
case 2:
draw2ndStrokeN();
break;
case 3:
draw3rdStrokeN();
break;
}
}
void draw1stStrokeN() {
if (bInit) { // initialize
bInit = false;
x = 100;
y = 100;
}
else { // draw
ellipse(x, y, cSize, cSize);
y = y + change;
if (y > 300) {
nStroke++;
bInit = true;
}
}
}
void draw2ndStrokeN() {
if (bInit) { // initialize
bInit = false;
x = 250;
y = 100;
}
else { // draw
ellipse(x, y, cSize, cSize);
y = y + change;
if (y > 300) {
nStroke++;
bInit = true;
}
}
}
void draw3rdStrokeN() {
if (bInit) { // initialize
bInit = false;
slope = 200.0 / 150.0; // do not use 1.33
b = -100.0 / 3.0; // do not use -33.3
x = 100;
y = slope * x + b;
}
else { // draw
ellipse(x, y, cSize, cSize);
x = x + change;
y = slope * x + b;
if (x > 250) {
nStroke++;
bInit = true;
}
}
}