import java.awt.*;
import java.awt.geom.*;
import java.lang.Math;

public class Cruz extends Forma
{
  Cruz ()
    {
      center = new Point();
      size = 5;
    }
  
  public void setPoint(Point c)
    {
      center=new Point(c);
    }

  public void paintComponent(Graphics2D g2d)
    {
      g2d.draw(new Line2D.Double(center.getX()-size,center.getY()-size,
                                 center.getX()+size,center.getY()+size));
      g2d.draw(new Line2D.Double(center.getX()+size,center.getY()-size,
                                 center.getX()-size,center.getY()+size));
    }
  
  public void escalar (Point c, double factor)
    {
      if (!center.equals(c)) {
        center.translate((int)(factor*(center.getX()-c.getX())),
                        (int) (factor*(center.getY()-c.getY())));
        size*=factor;
      }
    }
  
  public void rotar (Point c, double deltaAngulo)
    {
      if (!center.equals(c)) {
        double x=center.getX()-c.getX();
        double y=center.getY()-c.getY();
        double distancia = Math.sqrt(x*x+y*y);
        double anguloInicial=Math.atan2(y, x);
        x = distancia*Math.cos(anguloInicial+deltaAngulo);
        y = distancia*Math.sin(anguloInicial+deltaAngulo);
        center.setLocation(c.getX()+x, c.getY()+y);
      }
    }
  
  public void trasladar (double dx, double dy)
    {
        center.translate((int)dx, (int) dy);
    }
  
  public boolean isOn(Point punto){return true;}

  public void setManipulable(boolean b){}
  
  private Point center;
  private int size;
}
