absence_thelab
annotate src/common/curves.h @ 1:4d5933c261c3
todo and .hgignore
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 23 Oct 2014 02:18:43 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #ifndef _CURVES_H_ |
nuclear@0 | 2 #define _CURVES_H_ |
nuclear@0 | 3 |
nuclear@0 | 4 #include <string> |
nuclear@0 | 5 #include "n3dmath.h" |
nuclear@0 | 6 #include "linkedlist.h" |
nuclear@0 | 7 |
nuclear@0 | 8 class Curve { |
nuclear@0 | 9 protected: |
nuclear@0 | 10 LinkedList<Vector3> ControlPoints; |
nuclear@0 | 11 Vector2 *Samples; // used for parametrizing by arc length |
nuclear@0 | 12 int SampleCount; |
nuclear@0 | 13 bool ArcParametrize; |
nuclear@0 | 14 |
nuclear@0 | 15 Curve *ease_curve; // ease in/out curve (1D, x&z discarded) |
nuclear@0 | 16 int ease_sample_count, ease_step; |
nuclear@0 | 17 |
nuclear@0 | 18 void SampleArcLengths(); |
nuclear@0 | 19 float Parametrize(float t); |
nuclear@0 | 20 float Ease(float t); |
nuclear@0 | 21 |
nuclear@0 | 22 public: |
nuclear@0 | 23 std::string name; |
nuclear@0 | 24 |
nuclear@0 | 25 Curve(); |
nuclear@0 | 26 ~Curve(); |
nuclear@0 | 27 virtual void AddControlPoint(const Vector3 &cp); |
nuclear@0 | 28 |
nuclear@0 | 29 virtual int GetSegmentCount() const = 0; |
nuclear@0 | 30 virtual void SetArcParametrization(bool state); |
nuclear@0 | 31 virtual void SetEaseCurve(Curve *curve); |
nuclear@0 | 32 virtual void SetEaseSampleCount(int count); |
nuclear@0 | 33 |
nuclear@0 | 34 virtual Vector3 Interpolate(float t) = 0; |
nuclear@0 | 35 }; |
nuclear@0 | 36 |
nuclear@0 | 37 class BSpline : public Curve { |
nuclear@0 | 38 public: |
nuclear@0 | 39 virtual int GetSegmentCount() const; |
nuclear@0 | 40 virtual Vector3 Interpolate(float t); |
nuclear@0 | 41 }; |
nuclear@0 | 42 |
nuclear@0 | 43 class CatmullRomSpline : public Curve { |
nuclear@0 | 44 public: |
nuclear@0 | 45 virtual int GetSegmentCount() const; |
nuclear@0 | 46 virtual Vector3 Interpolate(float t); |
nuclear@0 | 47 }; |
nuclear@0 | 48 |
nuclear@0 | 49 |
nuclear@0 | 50 #endif // _CURVES_H_ |