/*
 * Circle.java
 *
 * Created on 22 grudzień 2004, 12:00
 */

package JSciDraw.physics.forces.constraints;

import JSci.maths.*;
import JSci.physics.*;
import JSciDraw.*;
import JSciDraw.physics.*;
import JSciDraw.physics.forces.*;
import java.awt.*;

/**
 *
 * @author  Barbara 
 */
public class Circle extends PolarChartConstraints{
    
    /** Creates a new instance of Circle */
    public Circle(double radius, AbstractDoubleVector cent)
    {
      super(cent);
      params=new double[1];
      params[0]=radius;
    }
    
    public void draw(ClassicalParticleV2D p, java.awt.Graphics2D g2D) {
      if (draw){
       double x0=center.getComponent(0)-params[0];
       double y0=center.getComponent(1)-params[0];
       g2D.setColor(Color.black);
       g2D.drawOval((int)x0,(int)y0,(int)(2*params[0]),(int)(2*params[0]));
      }
    }
    public void erase(ClassicalParticleV2D p, java.awt.Graphics2D g2D) {
      if (draw){ 
       double x0=center.getComponent(0)-params[0];
       double y0=center.getComponent(1)-params[0];
       g2D.setColor(Color.white);
       g2D.drawOval((int)x0,(int)y0,(int)(2*params[0]),(int)(2*params[0]));
      }
    }
    public AbstractDoubleVector getTangent(AbstractDoubleVector x0) {
      return getAngularVersor(toGeneric(x0));
    }
    
   public double getRadius(double ang) {
      return params[0];
   }
}
