curvedraw

diff src/curve.h @ 2:ce7aa9a0594c

improved curve editing
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Dec 2015 05:13:25 +0200
parents 8e524989c904
children 9f75208b81cd
line diff
     1.1 --- a/src/curve.h	Wed Dec 16 04:49:16 2015 +0200
     1.2 +++ b/src/curve.h	Thu Dec 17 05:13:25 2015 +0200
     1.3 @@ -15,8 +15,6 @@
     1.4  	std::vector<Vector3> cp;
     1.5  	CurveType type;
     1.6  
     1.7 -	float map_param(float x) const;
     1.8 -
     1.9  public:
    1.10  	Curve(CurveType type = CURVE_HERMITE);
    1.11  
    1.12 @@ -28,17 +26,26 @@
    1.13  
    1.14  	int nearest_point(const Vector2 &p);
    1.15  
    1.16 -	int get_point_count() const;
    1.17 +	bool empty() const;
    1.18 +	int size() const;
    1.19 +	Vector3 &operator [](int idx);
    1.20 +	const Vector3 &operator [](int idx) const;
    1.21 +
    1.22  	const Vector3 &get_homo_point(int idx) const;	// homogeneous point
    1.23  	Vector2 get_point(int idx) const;
    1.24  	float get_weight(int idx) const;
    1.25  
    1.26  	bool set_point(int idx, const Vector2 &p, float weight = 1.0f);
    1.27  	bool set_weight(int idx, float weight);
    1.28 +	// move point without changing its weight
    1.29 +	bool move_point(int idx, const Vector2 &p);
    1.30  
    1.31  	Vector2 interpolate(float t, CurveType type) const;
    1.32  	Vector2 interpolate(float t) const;
    1.33  	Vector2 operator ()(float t) const;
    1.34 +
    1.35 +	void draw(int res = -1) const;
    1.36 +	void draw_cp(float sz = -1.0f) const;
    1.37  };
    1.38  
    1.39  #endif	// CURVE_H_