package clothSimulator;

public class ZPinnedConstraint extends PinnedConstraint {

	//the desired value oft he z coord of the pinned particle
	double zPinPos;
		
	public ZPinnedConstraint(Particle p, double pos) {
		super(p, pos);
		// TODO Auto-generated constructor stub
		this.p1=p;
		this.zPinPos=pos;
		this.ParticleList().add(p1);
	}

	@Override
	public void updateCurrent_g() {
		// TODO Auto-generated method stub
		this.g= this.p1.p.z-zPinPos;
	}
	
	@Override
	public void updateCurrent_G(){
		Gp1x=0;
		Gp1y=0;
		Gp1z=1;
	}
	
	@Override
	public double GiDot(double[] in) {
		// TODO Auto-generated method stub
		return in[this.p1.getIndex()*3+2];
	}
	
	@Override
	public void GtransiDot(double[] in, double[] out){
		out[this.p1.getIndex()*3+2]+=this.Gp1z*in[this.getCLIndex()];
	}
	
}
