00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __GEOMETRY_SPLINE_H_
00025 #define __GEOMETRY_SPLINE_H_
00026
00027 #include <geometry/transformable.h>
00028 #include <geometry/hom_point.h>
00029 #include <geometry/bezier.h>
00030 #include <vector>
00031
00032 namespace fawkes {
00033
00034 class SplineDrawer;
00035
00036 class Spline : public Transformable
00037 {
00038 friend class fawkes::SplineDrawer;
00039
00040 public:
00041 Spline();
00042 Spline(const std::vector<HomPoint>& control_points);
00043 virtual ~Spline();
00044
00045 void set_control_points(const std::vector<HomPoint>& control_points);
00046 void set_control_point(unsigned int i, const HomPoint& p);
00047
00048 const std::vector<HomPoint>& get_control_points() const;
00049 const std::vector<Bezier>& get_bezier_curves() const;
00050
00051 HomPoint eval(unsigned int bezier_index, float t);
00052 HomVector tangent(unsigned int bezier_index, float t);
00053 HomVector tangent(unsigned int point_index);
00054 std::vector<HomPoint> approximate(unsigned int num_subdivisions = 4);
00055
00056 protected:
00057
00058 virtual void register_primitives();
00059 virtual void post_transform();
00060
00061 private:
00062 void construct_bezier_curves();
00063
00064 std::vector<HomPoint> m_control_points;
00065 std::vector<Bezier> m_bezier_curves;
00066
00067 unsigned int m_num_subdivisions;
00068 };
00069
00070 }
00071
00072 #endif