agg_vcgen_bspline.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //----------------------------------------------------------------------------
  2. // Anti-Grain Geometry - Version 2.4
  3. // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
  4. //
  5. // Permission to copy, use, modify, sell and distribute this software
  6. // is granted provided this copyright notice appears in all copies.
  7. // This software is provided "as is" without express or implied
  8. // warranty, and with no claim as to its suitability for any purpose.
  9. //
  10. //----------------------------------------------------------------------------
  11. // Contact: mcseem@antigrain.com
  12. // mcseemagg@yahoo.com
  13. // http://www.antigrain.com
  14. //----------------------------------------------------------------------------
  15. #ifndef AGG_VCGEN_BSPLINE_INCLUDED
  16. #define AGG_VCGEN_BSPLINE_INCLUDED
  17. #include "agg_basics.h"
  18. #include "agg_array.h"
  19. #include "agg_bspline.h"
  20. namespace agg
  21. {
  22. //==========================================================vcgen_bspline
  23. class vcgen_bspline
  24. {
  25. enum status_e
  26. {
  27. initial,
  28. ready,
  29. polygon,
  30. end_poly,
  31. stop
  32. };
  33. public:
  34. typedef pod_bvector<point_d, 6> vertex_storage;
  35. vcgen_bspline();
  36. void interpolation_step(double v) { m_interpolation_step = v; }
  37. double interpolation_step() const { return m_interpolation_step; }
  38. // Vertex Generator Interface
  39. void remove_all();
  40. void add_vertex(double x, double y, unsigned cmd);
  41. // Vertex Source Interface
  42. void rewind(unsigned path_id);
  43. unsigned vertex(double* x, double* y);
  44. private:
  45. vcgen_bspline(const vcgen_bspline&);
  46. const vcgen_bspline& operator = (const vcgen_bspline&);
  47. vertex_storage m_src_vertices;
  48. bspline m_spline_x;
  49. bspline m_spline_y;
  50. double m_interpolation_step;
  51. unsigned m_closed;
  52. status_e m_status;
  53. unsigned m_src_vertex;
  54. double m_cur_abscissa;
  55. double m_max_abscissa;
  56. };
  57. }
  58. #endif