Here you can find the source of drawEllipseOld(Graphics g, double xCenter, double yCenter, double semiMA, double semiMI, double angle)
static private void drawEllipseOld(Graphics g, double xCenter, double yCenter, double semiMA, double semiMI, double angle)
//package com.java2s; //License from project: Open Source License import java.awt.*; public class Main { static private void drawEllipseOld(Graphics g, double xCenter, double yCenter, double semiMA, double semiMI, double angle) { // convert the angle into radians angle = angle * Math.PI / 180.0; // number of iterations int nbIt = 30; Point[] p = new Point[nbIt]; double x, y, tmpX, tmpY; double curAngle; // first, we fill the array for (int i = 0; i < nbIt; i++) { curAngle = 2.0 * i / nbIt * Math.PI; tmpX = semiMA * Math.cos(curAngle); tmpY = semiMI * Math.sin(curAngle); // rotation x = tmpX * Math.cos(angle) - tmpY * Math.sin(angle) + xCenter; y = tmpX * Math.sin(angle) + tmpY * Math.cos(angle) + yCenter; //System.out.println(x+" "+y); p[i] = new Point((int) x, (int) y); }// w w w .j a v a 2 s.co m // then we draw for (int i = 0; i < nbIt - 1; i++) { g.drawLine(p[i].x, p[i].y, p[i + 1].x, p[i + 1].y); } // complete the ellipse g.drawLine(p[nbIt - 1].x, p[nbIt - 1].y, p[0].x, p[0].y); } }