#ifndef VIEWSPLINE_H_
#define VIEWSPLINE_H_
#include <Stuff\FCurve.hpp>
#include <Stuff\Scalar.hpp>

#define MAXCPOINTS 100

class SplineLoop
{
private:
protected:
	Stuff::DynamicArrayOf<Stuff::Vector3D>   CtrlVector;
	Stuff::DynamicArrayOf<Stuff::Point3D>    CtrlPoint;
	Stuff::FCurve XCurve,YCurve,ZCurve;
	Stuff::Scalar DefRadius;
	Stuff::Point3D DefCenter;
	
	int noc;
	
	void RebuildCurve(int crv=-1);
public:
	
	
	SplineLoop(int pnts=2,Stuff::Scalar radius=1.0f,Stuff::Point3D &pos=Stuff::Point3D(0.0f,0.0f,0.0f));
	void GetCPoint(int pn,Stuff::Point3D  *cp,Stuff::Vector3D *cv);
	void SetCPoint(int pn,Stuff::Point3D  &cp,Stuff::Vector3D &cv);
	int GetClosestCPoint(Stuff::Point3D &cp);
	
	void ResetCurve(Stuff::Scalar radius,Stuff::Point3D &pos=Stuff::Point3D(0.0f,0.0f,0.0f));
	void ResetCurve() {ResetCurve(DefRadius,DefCenter);}
	
	int GetCurveCount() {return noc;}
	void Evaluate(Stuff::Scalar t,Stuff::Point3D *pnt,Stuff::Vector3D *vct);
	~SplineLoop(); 
};


#endif 