/**
 *
 * Beschreibung
 *
 * @version 1.0 vom 04.10.2012
 * @author 
 */

import java.awt.Graphics;

public class GCircle extends GLine {

    // Anfang Attribute
    // Ende Attribute

    public GCircle(GPoint point1, GPoint point2) {
        super(point1, point2);
    }

    // Anfang Methoden
    private int getRadius() {
        int dx = point2.getX() - point1.getX();
        int dy = point2.getY() - point1.getY();
        double r = Math.sqrt(dx * dx + dy * dy);
        return (int) Math.round(r);
    }

    public void draw(Graphics gr) {
        int r = getRadius();
        int mx = point1.getX();
        int my = point1.getY();
        gr.setColor(getColor());
        gr.drawOval(mx - r, my - r, 2*r, 2*r);
    }

    // Ende Methoden
} // end of GCircle
