I have a program which essential makes a triangular spiral. Does anyone know how I can change this program to rather have one entire line makes the spiral, have it made from straight line segments? The following is the code i have thus far…
void setup(){
int len=100;
int startx =250;
int starty= 250;
float angle = PI;
size (500,500);
spiral_triangle(len, startx,starty,angle);
}
void spiral_triangle(int len, int startx, int starty, float angle){
if (len>1)
{line( startx, starty ,int(startx+len*cos(angle)),int(starty + len*sin(angle)) );
int new_startx = int(startx+len*cos(angle));
int new_starty = int(starty+len*sin(angle));
int new_len = len -10;
float new_angle = angle + PI/1.5;
spiral_triangle(new_len, new_startx,new_starty,new_angle);
}
}
Example… Instead of one line per side, i need this ——– per side… Individual line segments (kinda like a dotted line, or a broken line)
If I understand you correctly, you want a circular spiral instead of a triangular spiral. The following code should achieve this.