Spiral.java
public class Spiral
{
public static void main(String[] args)
{
int N = Integer.parseInt(args[0]);
double decay = Double.parseDouble(args[1]);
double angle
= 360.0 / N;
double step = Math.sin(Math.toRadians(angle/2.0));
Turtle turtle = new Turtle(0.5, 0.0,
angle/2.0);
for (int i = 0; i < 10*N; i++)
{
step /= decay;
turtle.goForward(step);
turtle.turnLeft(angle);
}
}
}
No comments:
Post a Comment