package Shapes;
import java.awt.Graphics;

/**
 * OurEllipse
 * <p><b>History</b> :<ul>
 *   <li>Version 0.1 : Initial version</li>
 * </ul></p>
 * @author Pierrick Calvet & Florian Delclaux
 */
public class OurEllipse extends OurShape{
/**
 * Constructs a new OurEllipse whose top-left corner of the bounding box is specified as (x, y)
 * and whose width and height are specified by the arguments of the same name.
 * @param x The specified x coordinate
 * @param y The specified y coordinate
 * @param width The width of OurEllipse
 * @param height The height of OurEllipse
 */
  public OurEllipse(int x, int y, int width, int height){
    super(x, y, width, height);
  }

/**
 * Draw OurEllipse on Graphics g
 * @param g Graphics where OurEllipse will be draw
 */
  public void draw(Graphics g){
    g.setColor(color);
    if(filled())
      g.fillOval(x, y, width, height);                    /* Filled OurEllipse */
    else
      g.drawOval(x, y, width, height);                    /* Unfilled OurEllipse */
  }

/**
 * Compute perimeter of OurEllipse
 * @return Value of perimeter
 */
  public double perimeter(){
    return (Math.PI * (double)(height + width)) / 2;
  }

/**
 * Compute area of OurEllipse
 * @return Value of area
 */
  public double area(){
    return Math.PI * Math.pow((height + width) / 4, 2);
  }

/**
 * Scale OurEllipse
 * @param factor Factor of scale
 */
  public void scale(double factor){
    width *= factor;
    height *= factor;
  }
}
