CircleT.tcc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimage - An image/template for new NICE libraries
  4. * See file License for license information.
  5. */
  6. #include "core/image/CircleT.h"
  7. #include "core/image/EllipseT.h"
  8. namespace NICE {
  9. // Constructors:
  10. // -------------
  11. template<class P>
  12. CircleT<P>::CircleT(const Coord &center, const int radius)
  13. {
  14. this->center=center;
  15. this->radius=radius;
  16. }
  17. template<class P>
  18. CircleT<P>::CircleT(const Coord &center, const int radius,
  19. const ColorT<P>& _defaultColor)
  20. : Drawable<P>(_defaultColor)
  21. {
  22. this->center=center;
  23. this->radius=radius;
  24. }
  25. template<class P>
  26. CircleT<P>::CircleT()
  27. {
  28. }
  29. template<class P>
  30. CircleT<P>::CircleT(const CircleT<P>& ex) : Drawable<P>(ex)
  31. {
  32. *this=ex;
  33. }
  34. // Operators:
  35. // ----------
  36. template<class P>
  37. CircleT<P>& CircleT<P>::operator=(const CircleT<P>& ex)
  38. {
  39. center=ex.center;
  40. radius=ex.radius;
  41. this->defaultColor=ex.defaultColor;
  42. return *this;
  43. }
  44. template<class P>
  45. bool CircleT<P>::operator==(const CircleT<P>& ex) const
  46. {
  47. if(center==ex.center &&
  48. radius==ex.radius&&
  49. this->defaultColor==ex.defaultColor)
  50. return true;
  51. return false;
  52. }
  53. template<class P>
  54. bool CircleT<P>::operator!=(const CircleT<P>& ex) const {
  55. return !(this->operator==(ex));
  56. }
  57. // Methods:
  58. // --------
  59. template<class P>
  60. void CircleT<P>::doDraw(ColorImageT<P> &image, const ColorT<P>& color) const
  61. {
  62. Coord axis(radius,radius);
  63. EllipseT<P> e(center,axis,0);
  64. e.draw(image, color);
  65. }
  66. template<class P>
  67. void CircleT<P>::doDraw(ImageT<P> &image, const P& gray) const
  68. {
  69. Coord axis(radius,radius);
  70. EllipseT<P> e(center,axis,0);
  71. e.draw(image, gray);
  72. }
  73. // Destructor:
  74. // -----------
  75. template<class P>
  76. CircleT<P>::~CircleT()
  77. {
  78. }
  79. }; // namespace NICE