Attempting to draw hypotochoid in Java

Viewed 17

I am stuck trying to draw one of these. I have this code, but all it draws is a circle. I am not really sure where I should be going with this.

public class FancyTest {

    public static void main(String[] args) {
        Display fancyWindow = new Display(600, 5);

        int centerX = fancyWindow.getWidth() / 2;
        int centerY = fancyWindow.getHeight() / 2;

        double degreeAngle = 0;
        double radiusR = 50;
        double innerRadius = 25;
        double distance = 10;
        double deltaR = radiusR - innerRadius;
        double t = 20;

        while(true) {
            double radianAngle = Math.toRadians(degreeAngle);

            double x = centerX + ((deltaR) * Math.cos(radianAngle) + distance * Math.cos((deltaR * radianAngle) / innerRadius));
            double y = centerY + ((deltaR) * Math.sin(radianAngle) + distance * Math.sin((deltaR * radianAngle) / innerRadius));

            fancyWindow.drawNextPoint((int)x, (int)y);
            degreeAngle +=.5;


        }
    }
}
0 Answers
Related