agg_arc.h 2.0 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. //
  16. // Arc vertex generator
  17. //
  18. //----------------------------------------------------------------------------
  19. #ifndef AGG_ARC_INCLUDED
  20. #define AGG_ARC_INCLUDED
  21. #include <math.h>
  22. #include "agg_basics.h"
  23. namespace agg
  24. {
  25. //=====================================================================arc
  26. //
  27. // See Implementation agg_arc.cpp
  28. //
  29. class arc
  30. {
  31. public:
  32. arc() : m_scale(1.0), m_initialized(false) {}
  33. arc(double x, double y,
  34. double rx, double ry,
  35. double a1, double a2,
  36. bool ccw=true);
  37. void init(double x, double y,
  38. double rx, double ry,
  39. double a1, double a2,
  40. bool ccw=true);
  41. void approximation_scale(double s);
  42. double approximation_scale() const { return m_scale; }
  43. void rewind(unsigned);
  44. unsigned vertex(double* x, double* y);
  45. private:
  46. void normalize(double a1, double a2, bool ccw);
  47. double m_x;
  48. double m_y;
  49. double m_rx;
  50. double m_ry;
  51. double m_angle;
  52. double m_start;
  53. double m_end;
  54. double m_scale;
  55. double m_da;
  56. bool m_ccw;
  57. bool m_initialized;
  58. unsigned m_path_cmd;
  59. };
  60. }
  61. #endif