You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
  5. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file ring_2d.h
  26. */
  27. #ifndef _RING_2D_H_
  28. #define _RING_2D_H_
  29. #include "object_2d.h"
  30. class RING_2D : public OBJECT_2D
  31. {
  32. public:
  33. RING_2D( const SFVEC2F& aCenter, float aInnerRadius, float aOuterRadius,
  34. const BOARD_ITEM& aBoardItem );
  35. bool Overlaps( const BBOX_2D& aBBox ) const override;
  36. bool Intersects( const BBOX_2D& aBBox ) const override;
  37. bool Intersect( const RAYSEG2D& aSegRay, float* aOutT, SFVEC2F* aNormalOut ) const override;
  38. INTERSECTION_RESULT IsBBoxInside( const BBOX_2D& aBBox ) const override;
  39. bool IsPointInside( const SFVEC2F& aPoint ) const override;
  40. const SFVEC2F& GetCenter() const { return m_center; }
  41. float GetInnerRadius() const { return m_inner_radius; }
  42. float GetOuterRadius() const { return m_outer_radius; }
  43. float GetInnerRadiusSquared() const { return m_inner_radius_squared; }
  44. float GetOuterRadiusSquared() const { return m_outer_radius_squared; }
  45. private:
  46. SFVEC2F m_center;
  47. float m_inner_radius;
  48. float m_outer_radius;
  49. float m_inner_radius_squared;
  50. float m_outer_radius_squared;
  51. };
  52. #endif // _RING_2D_H_