| 
    KiCad PCB EDA Suite
    
   | 
 
Manage a bounding box defined by two SFVEC2F min max points. More...
#include <bbox_2d.h>
Public Member Functions | |
| BBOX_2D () | |
| Create with default values a bounding box (not initialized).   | |
| BBOX_2D (const SFVEC2F &aPbInit) | |
| Initialize a bounding box with a given point.   | |
| BBOX_2D (const SFVEC2F &aPbMin, const SFVEC2F &aPbMax) | |
| Initialize a bounding box with a minimum and a maximum point.   | |
| ~BBOX_2D () | |
| void | Set (const SFVEC2F &aPbMin, const SFVEC2F &aPbMax) | 
| Set bounding box with new parameters.   | |
| void | Set (const BBOX_2D &aBBox) | 
| Set bounding box based on another bounding box.   | |
| void | Union (const SFVEC2F &aPoint) | 
| Recalculate the bounding box adding a point.   | |
| void | Union (const BBOX_2D &aBBox) | 
| Recalculate the bounding box adding other bounding box.   | |
| void | Scale (float aScale) | 
| Scale a bounding box by its center.   | |
| void | ScaleNextUp () | 
| Scale a bounding box to the next float representation making it larger.   | |
| void | ScaleNextDown () | 
| Scale a bounding box to the next float representation making it smaller.   | |
| bool | Intersects (const BBOX_2D &aBBox) const | 
| Test if a bounding box intersects this box.   | |
| bool | Intersects (const SFVEC2F &aCenter, float aRadiusSquared) const | 
| Test if a circle intersects this box.   | |
| bool | Inside (const SFVEC2F &aPoint) const | 
| Check is a point is inside this bounding box.   | |
| bool | Inside (const BBOX_2D &aBBox) const | 
| Check if a bounding box is inside this bounding box.   | |
| float | Area () const | 
| Calculate the area of a bounding box.   | |
| bool | IsInitialized () const | 
| Check if this bounding box is already initialized.   | |
| void | Reset () | 
| Reset the bounding box to zero and uninitialize it.   | |
| SFVEC2F | GetCenter () const | 
| SFVEC2F | GetExtent () const | 
| const SFVEC2F & | Min () const | 
| const SFVEC2F & | Max () const | 
| unsigned int | MaxDimension () const | 
| float | Perimeter () const | 
| bool | Intersect (const RAY2D &aRay, float *t) const | 
| bool | Intersect (const RAY2D &aRay, float *aOutHitT0, float *aOutHitT1) const | 
| bool | Intersect (const RAYSEG2D &aRaySeg) const | 
Private Attributes | |
| SFVEC2F | m_min | 
| point of the lower position of the bounding box   | |
| SFVEC2F | m_max | 
| point of the higher position of the bounding box   | |
Manage a bounding box defined by two SFVEC2F min max points.
| BBOX_2D::BBOX_2D | ( | ) | 
Create with default values a bounding box (not initialized).
Definition at line 37 of file bbox_2d.cpp.
References Reset().
Referenced by Inside(), Intersects(), Set(), and Union().
      
  | 
  explicit | 
Initialize a bounding box with a given point.
| aPbInit | a point for the bounding box initialization. | 
Definition at line 43 of file bbox_2d.cpp.
Initialize a bounding box with a minimum and a maximum point.
| aPbMin | the minimum point to initialize the bounding box. | 
| aPbMax | the maximum point to initialize the bounding box. | 
Definition at line 50 of file bbox_2d.cpp.
References Set().
| BBOX_2D::~BBOX_2D | ( | ) | 
Definition at line 56 of file bbox_2d.cpp.
| float BBOX_2D::Area | ( | ) | const | 
Calculate the area of a bounding box.
Definition at line 242 of file bbox_2d.cpp.
References GetExtent().
| SFVEC2F BBOX_2D::GetCenter | ( | ) | const | 
Definition at line 119 of file bbox_2d.cpp.
Referenced by Scale().
| SFVEC2F BBOX_2D::GetExtent | ( | ) | const | 
Definition at line 125 of file bbox_2d.cpp.
Referenced by Area(), ConvertPolygonToBlocks(), MaxDimension(), and Perimeter().
| bool BBOX_2D::Inside | ( | const BBOX_2D & | aBBox | ) | const | 
Check if a bounding box is inside this bounding box.
| aBBox | the bounding box to test if it is inside | 
Definition at line 232 of file bbox_2d.cpp.
References BBOX_2D(), Inside(), IsInitialized(), Max(), and Min().
| bool BBOX_2D::Inside | ( | const SFVEC2F & | aPoint | ) | const | 
Check is a point is inside this bounding box.
| aPoint | point to test. | 
Definition at line 223 of file bbox_2d.cpp.
References IsInitialized(), m_max, and m_min.
Referenced by extractPathsFrom(), Inside(), and BVH_CONTAINER_2D::recursiveIntersectAny().
| bool BBOX_2D::Intersect | ( | const RAY2D & | aRay, | 
| float * | aOutHitT0, | ||
| float * | aOutHitT1 ) const | 
Definition at line 300 of file bbox_2d.cpp.
References RAY2D::m_InvDir, m_max, m_min, and RAY2D::m_Origin.
| bool BBOX_2D::Intersect | ( | const RAY2D & | aRay, | 
| float * | t ) const | 
| aRay | is a ray to intersect the box. | 
| t | is the distance point of the ray of the intersection (if true). | 
Definition at line 250 of file bbox_2d.cpp.
References RAY2D::m_InvDir, m_max, m_min, and RAY2D::m_Origin.
Referenced by BVH_CONTAINER_2D::recursiveIntersectAny().
| bool BBOX_2D::Intersect | ( | const RAYSEG2D & | aRaySeg | ) | const | 
Definition at line 275 of file bbox_2d.cpp.
References RAYSEG2D::m_InvDir, RAYSEG2D::m_Length, m_max, m_min, and RAYSEG2D::m_Start.
| bool BBOX_2D::Intersects | ( | const BBOX_2D & | aBBox | ) | const | 
Test if a bounding box intersects this box.
| aBBox | the bounding box to check if it intersects. | 
Definition at line 211 of file bbox_2d.cpp.
References BBOX_2D(), IsInitialized(), m_max, and m_min.
Referenced by extractPathsFrom(), FILLED_CIRCLE_2D::Intersects(), RING_2D::Intersects(), ROUND_SEGMENT_2D::Intersects(), and BVH_CONTAINER_2D::recursiveGetListObjectsIntersects().
| bool BBOX_2D::Intersects | ( | const SFVEC2F & | aCenter, | 
| float | aRadiusSquared ) const | 
Test if a circle intersects this box.
| aBBox | the bounding box to check if it intersects. | 
Definition at line 184 of file bbox_2d.cpp.
| bool BBOX_2D::IsInitialized | ( | ) | const | 
Check if this bounding box is already initialized.
Definition at line 79 of file bbox_2d.cpp.
Referenced by BVH_CONTAINER_2D::GetIntersectingObjects(), Inside(), Inside(), Intersects(), BVH_CONTAINER_2D::recursiveBuild_MIDDLE_SPLIT(), BVH_CONTAINER_2D::recursiveGetListObjectsIntersects(), Scale(), and Set().
      
  | 
  inline | 
Definition at line 180 of file bbox_2d.h.
References m_max.
Referenced by ConvertPolygonToBlocks(), RENDER_3D_RAYTRACE_BASE::createObject(), extractPathsFrom(), Inside(), ROUND_SEGMENT_2D::Intersects(), FILLED_CIRCLE_2D::IsBBoxInside(), ROUND_SEGMENT_2D::IsBBoxInside(), LAYER_ITEM::LAYER_ITEM(), and Set().
| unsigned int BBOX_2D::MaxDimension | ( | ) | const | 
Definition at line 131 of file bbox_2d.cpp.
References GetExtent(), and result.
Referenced by BVH_CONTAINER_2D::recursiveBuild_MIDDLE_SPLIT().
      
  | 
  inline | 
Definition at line 175 of file bbox_2d.h.
References m_min.
Referenced by ConvertPolygonToBlocks(), RENDER_3D_RAYTRACE_BASE::createObject(), extractPathsFrom(), Inside(), ROUND_SEGMENT_2D::Intersects(), FILLED_CIRCLE_2D::IsBBoxInside(), ROUND_SEGMENT_2D::IsBBoxInside(), LAYER_ITEM::LAYER_ITEM(), and Set().
| float BBOX_2D::Perimeter | ( | ) | const | 
Definition at line 142 of file bbox_2d.cpp.
References GetExtent().
| void BBOX_2D::Reset | ( | ) | 
Reset the bounding box to zero and uninitialize it.
Definition at line 86 of file bbox_2d.cpp.
Referenced by BBOX_2D(), ConvertPolygonToBlocks(), and BVH_CONTAINER_2D::recursiveBuild_MIDDLE_SPLIT().
| void BBOX_2D::Scale | ( | float | aScale | ) | 
Scale a bounding box by its center.
| aScale | scale factor to apply | 
Definition at line 150 of file bbox_2d.cpp.
References GetCenter(), IsInitialized(), m_max, and m_min.
| void BBOX_2D::ScaleNextDown | ( | ) | 
Scale a bounding box to the next float representation making it smaller.
Definition at line 172 of file bbox_2d.cpp.
References m_max, m_min, NextFloatDown(), and NextFloatUp().
| void BBOX_2D::ScaleNextUp | ( | ) | 
Scale a bounding box to the next float representation making it larger.
Definition at line 162 of file bbox_2d.cpp.
References m_max, m_min, NextFloatDown(), and NextFloatUp().
Referenced by ConvertPolygonToBlocks(), and LAYER_ITEM::LAYER_ITEM().
| void BBOX_2D::Set | ( | const BBOX_2D & | aBBox | ) | 
Set bounding box based on another bounding box.
| BBOX_2D | a bounding box to initialize this one. | 
Definition at line 71 of file bbox_2d.cpp.
References BBOX_2D(), IsInitialized(), Max(), Min(), and Set().
| void BBOX_2D::Union | ( | const BBOX_2D & | aBBox | ) | 
Recalculate the bounding box adding other bounding box.
| aBBox | the bounding box to be bounded. | 
Definition at line 105 of file bbox_2d.cpp.
| void BBOX_2D::Union | ( | const SFVEC2F & | aPoint | ) | 
Recalculate the bounding box adding a point.
| aPoint | the point to be bounded | 
Definition at line 93 of file bbox_2d.cpp.
Referenced by ConvertPolygonToBlocks(), and BVH_CONTAINER_2D::recursiveBuild_MIDDLE_SPLIT().
      
  | 
  private | 
point of the higher position of the bounding box
Definition at line 206 of file bbox_2d.h.
Referenced by BBOX_2D(), GetCenter(), GetExtent(), Inside(), Intersect(), Intersect(), Intersect(), Intersects(), Intersects(), IsInitialized(), Max(), Reset(), Scale(), ScaleNextDown(), ScaleNextUp(), Set(), Union(), and Union().
      
  | 
  private | 
point of the lower position of the bounding box
Definition at line 205 of file bbox_2d.h.
Referenced by BBOX_2D(), GetCenter(), GetExtent(), Inside(), Intersect(), Intersect(), Intersect(), Intersects(), Intersects(), IsInitialized(), Min(), Reset(), Scale(), ScaleNextDown(), ScaleNextUp(), Set(), Union(), and Union().