import java.awt.Point;

public class Spirale implements ProducteurDePoints {
    private static final int centreX = 100;
    private static final int centreY = 100;
    private static final double rayon = 90.0;
    private static final double radiusIncrement = -0.1;
    private static final double angleDepart = 0.0;
    private static final double angleIncrement = Math.PI / 30;

    private double angle;
    private double curRadius;
    public Spirale() {
        angle = angleDepart;
        curRadius = rayon;
    }

    public Point suivant() {
        Point p = null;
        angle += angleIncrement;
        curRadius += radiusIncrement;

        if (curRadius > 0.0) {
            p = new Point(
                (int)(Math.cos(angle) * curRadius),
                (int)(Math.sin(angle) * curRadius)
            );

            p.translate(centreX, centreY);
        }

        return p;
    }
}