/*
 * ForceField.java
 *
 * Created on 14 styczeń 2005, 00:58
 */

package JSciDraw.physics.fields;

import JSci.maths.*;
import JSci.physics.*;
import JSciDraw.interfaces.*;
import JSciDraw.physics.*;
import java.util.*;
/*
 *
 * @author  Barbara
 */
public class SqDumping extends ForceField{
    /** Creates a new instance of ForceField */
    
    private class DForce extends ProdForce 
    {
        public DForce(ClassicalParticleV2D p){
           super(p);
       }
       public AbstractDoubleVector getVector(double t) {
           AbstractDoubleVector vel = p.getVelocity();
         return vel.scalarMultiply(-1.*params[0]*vel.norm());
       }
       
    }

    public SqDumping(double coeff) {
        params = new double[1];
        params[0]=coeff;
    }
    public ProdForce getForce(ClassicalParticleV2D p){
        return new DForce(p);
    }
   
}
