#ifndef FORCESPR_H
#define FORCESPR_H

#include "force.h"
#include <cassert>

class ForceSpr : public Force
{
public:
    // constant force of g in direction d
    ForceSpr(int p, int q, double k, double r);

    // Evaluate force function wrt x,v,m
    SparseVecd eval(const Vecd &x, const Vecd &v, const Vecd &m) const;
    
    // Evaluate force Jacobians
    DblSparse_t evalDx(const Vecd &x, const Vecd &v, const Vecd &m) const;
    DblSparse_t evalDv(const Vecd &x, const Vecd &v, const Vecd &m) const;

    // relative displacement of spring
  double Displacement(const Vecd &x) const;

private:
	// two points
	int _p;
	int _q;

	// spring constant
	double _k;

	// rest length
	double _r;

};

#endif
