X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_bspline.h;h=edc00a7cc7d1f9a0016bde53c914fb7826355661;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=da045764e3fdd7724ab75736e12b99533b09f5e5;hpb=b3016b249333ac0ab0008d8c6c4d9029b2ff30c9;p=synfig.git diff --git a/ETL/trunk/ETL/_bspline.h b/ETL/trunk/ETL/_bspline.h index da04576..edc00a7 100644 --- a/ETL/trunk/ETL/_bspline.h +++ b/ETL/trunk/ETL/_bspline.h @@ -1,7 +1,7 @@ /*! ======================================================================== ** Extended Template and Library ** B-Spline Class Implementation -** $Id: _bspline.h,v 1.1.1.1 2005/01/04 01:31:46 darco Exp $ +** $Id$ ** ** Copyright (c) 2002 Robert B. Quattlebaum Jr. ** @@ -48,31 +48,31 @@ public: typedef T value_type; typedef K knot_type; typedef std::vector knot_container; - typedef std::vector cpoint_container; + typedef std::vector cpoint_container; typedef typename knot_container::iterator knot_iterator; typedef typename cpoint_container::iterator cpoint_iterator; typedef C affine_func_type; typedef D distance_func_type; - + protected: affine_func_type affine_func; distance_func_type distance_func; - + private: int m; knot_container _knots; cpoint_container _cpoints; bool _loop; - -public: + +public: bspline():m(2),_loop(false) { } - + int get_m()const { return m-1; }; int set_m(int new_m) { m=new_m+1; return m-1; }; - + bool set_loop(bool x) { _loop=x; reset_knots(); return _loop; } - + knot_container & knots() { return _knots; }; cpoint_container & cpoints() { return _cpoints; }; @@ -82,7 +82,7 @@ public: void reset_knots() { int i; - + if(!_loop) { _knots.clear(); @@ -95,7 +95,7 @@ public: for(i=1;i<(signed)_cpoints.size()-m+1;i++) *_knots.insert(_knots.end())=i; for(i=0;i=_knots.back()) t=_knots.back()-0.0001; - for(k=0;_knots[k]>t || _knots[k+1]<=t;k++); - - return k; + for(k=0;_knots[k]>t || _knots[k+1]<=t;k++) + ; + + return k; } knot_container get_segment_knots(int i)const @@ -137,7 +138,7 @@ public: return knot_container(_knots.begin()+i-m+1, _knots.begin()+i+m); } - cpoint_container get_segment_cpoints(int i)const + cpoint_container get_segment_cpoints(int i)const { if(i+1