/*
 * DrawableClassicalParticle.java
 *
 * Created on November 7, 2004, 7:16 AM
 */

package JSciDraw.physics;

import JSciDraw.physics.*;
import JSciDraw.physics.fields.*;
import JSciDraw.physics.forces.constraints.*;
import JSciDraw.physics.forces.*;
import JSciDraw.interfaces.*;
import JSci.maths.*;
import JSci.physics.*;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
/**
 *
 * @author  arturo, modified by przemek 16.12.2004; 0:15 , modified by barbara,
 * applied constraints in a simple form
 */
public class ExternalOscillator extends ClassicalParticleV2D implements Drawable2D, Moveable2D{
    
//    protected GeneralLine line; 
    protected Constraints someline; 
    protected AttachedSpring Engine;
    
    public ExternalOscillator(AbstractDoubleVector ZP, 
               AbstractDoubleVector OscDir, double k)
    {
      super();
      if (OscDir.getComponent(0)!=0) {
          someline=new GeneralLine(OscDir.getComponent(1)/OscDir.getComponent(0));
      }
      else {
          someline=new VerticalLine();
      }
      someline.setDrawable(false);
      applyConstraints(someline);
      Engine = new AttachedSpring(ZP.add(OscDir),this,k,OscDir.norm());
      setPosition(ZP.add(OscDir.scalarMultiply(0.97)));
      hide=false;
    }
    public void setCharge(double Charge) {}
    public void applyGravity(){
    }
   public void addToSumForce(AbstractDoubleVector t){
       //this.sumForce=new Double2Vector(0,0);
    }

    
    
    
    
}