According to our teacher, this image is an archimidean spiral:
The problem is that on internet I search methods to draw an archimidean spiral and I only find something like this:
So I have no clue of how to draw something like the first image, what I already tried is to build an spiral in a way and then put the same spiral but on the other way, but it didn´t worked,the code I used is from Java: Draw a circular spiral using drawArc
public class ArchimideanSpiral extends JFrame {
public ArchimideanSpiral()
{
super("Archimidean Spiral");
setSize(500,500);
setVisible(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
public void paint(Graphics g)
{
int x = getSize().width / 2 - 10;
int y = getSize().height/ 2 - 10;
int width = 20;
int height = 20;
int startAngle = 0;
int arcAngle = 180;
int depth = 10;
for (int i = 0; i < 10; i++) {
width = width + 2 * depth;
y = y - depth;
height = height + 2 * depth;
if (i % 2 == 0) {
g.drawArc(x, y, width, height, startAngle, -arcAngle);
} else {
x = x - 2 * depth;
g.drawArc(x, y, width, height, startAngle, arcAngle);
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new ArchimideanSpiral();
}
}
But If I try to put the same spiral in a reverse way it doesnt work so I´m lost.