KiCad PCB EDA Suite
CDUMMYBLOCK2D Class Reference

This dummy block will be defined by a 2d box size. More...

#include <cpolygon2d.h>

Inheritance diagram for CDUMMYBLOCK2D:
COBJECT2D

Public Member Functions

 CDUMMYBLOCK2D (const SFVEC2F &aPbMin, const SFVEC2F &aPbMax, const BOARD_ITEM &aBoardItem)
 
 CDUMMYBLOCK2D (const CBBOX2D &aBBox, const BOARD_ITEM &aBoardItem)
 
bool Overlaps (const CBBOX2D &aBBox) const override
 Function Overlaps. More...
 
bool Intersects (const CBBOX2D &aBBox) const override
 Function Intersects. More...
 
bool Intersect (const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
 Function Intersect. More...
 
INTERSECTION_RESULT IsBBoxInside (const CBBOX2D &aBBox) const override
 Function IsBBoxInside. More...
 
bool IsPointInside (const SFVEC2F &aPoint) const override
 
const BOARD_ITEMGetBoardItem () const
 
const CBBOX2DGetBBox () const
 
const SFVEC2FGetCentroid () const
 
OBJECT2D_TYPE GetObjectType () const
 

Protected Attributes

CBBOX2D m_bbox
 
SFVEC2F m_centroid
 
OBJECT2D_TYPE m_obj_type
 
const BOARD_ITEMm_boardItem
 

Detailed Description

This dummy block will be defined by a 2d box size.

If the point is inside the bounding box it will return allways true. However, the intersection with a ray will return allways false. This is used as a sub block extrated from polygon (pcb polygon areas) and represents an area that is full filled.

Definition at line 117 of file cpolygon2d.h.

Constructor & Destructor Documentation

◆ CDUMMYBLOCK2D() [1/2]

CDUMMYBLOCK2D::CDUMMYBLOCK2D ( const SFVEC2F aPbMin,
const SFVEC2F aPbMax,
const BOARD_ITEM aBoardItem 
)

Definition at line 223 of file cpolygon2d.cpp.

225  : COBJECT2D( OBJECT2D_TYPE::DUMMYBLOCK, aBoardItem )
226 {
227  m_bbox.Set( aPbMin, aPbMax );
230 }
COBJECT2D(OBJECT2D_TYPE aObjType, const BOARD_ITEM &aBoardItem)
Definition: cobject2d.cpp:37
void Set(const SFVEC2F &aPbMin, const SFVEC2F &aPbMax)
Function Set Set bounding box with new parameters.
Definition: cbbox2d.cpp:61
void ScaleNextUp()
Function ScaleNextUp scales a bounding box to the next float representation making it larger.
Definition: cbbox2d.cpp:164
CBBOX2D m_bbox
Definition: cobject2d.h:65
SFVEC2F m_centroid
Definition: cobject2d.h:66
SFVEC2F GetCenter() const
Function GetCenter return the center point of the bounding box.
Definition: cbbox2d.cpp:121

References DUMMYBLOCK, CBBOX2D::GetCenter(), COBJECT2D::m_bbox, COBJECT2D::m_centroid, CBBOX2D::ScaleNextUp(), and CBBOX2D::Set().

◆ CDUMMYBLOCK2D() [2/2]

CDUMMYBLOCK2D::CDUMMYBLOCK2D ( const CBBOX2D aBBox,
const BOARD_ITEM aBoardItem 
)

Definition at line 233 of file cpolygon2d.cpp.

234  : COBJECT2D( OBJECT2D_TYPE::DUMMYBLOCK, aBoardItem )
235 {
236  m_bbox.Set( aBBox );
239 }
COBJECT2D(OBJECT2D_TYPE aObjType, const BOARD_ITEM &aBoardItem)
Definition: cobject2d.cpp:37
void Set(const SFVEC2F &aPbMin, const SFVEC2F &aPbMax)
Function Set Set bounding box with new parameters.
Definition: cbbox2d.cpp:61
void ScaleNextUp()
Function ScaleNextUp scales a bounding box to the next float representation making it larger.
Definition: cbbox2d.cpp:164
CBBOX2D m_bbox
Definition: cobject2d.h:65
SFVEC2F m_centroid
Definition: cobject2d.h:66
SFVEC2F GetCenter() const
Function GetCenter return the center point of the bounding box.
Definition: cbbox2d.cpp:121

References DUMMYBLOCK, CBBOX2D::GetCenter(), COBJECT2D::m_bbox, COBJECT2D::m_centroid, CBBOX2D::ScaleNextUp(), and CBBOX2D::Set().

Member Function Documentation

◆ GetBBox()

◆ GetBoardItem()

const BOARD_ITEM& COBJECT2D::GetBoardItem ( ) const
inlineinherited

Definition at line 75 of file cobject2d.h.

75 { return m_boardItem; }
const BOARD_ITEM & m_boardItem
Definition: cobject2d.h:69

References COBJECT2D::m_boardItem.

Referenced by C3D_RENDER_RAYTRACING::reload().

◆ GetCentroid()

const SFVEC2F& COBJECT2D::GetCentroid ( ) const
inlineinherited

◆ GetObjectType()

◆ Intersect()

bool CDUMMYBLOCK2D::Intersect ( const RAYSEG2D aSegRay,
float *  aOutT,
SFVEC2F aNormalOut 
) const
overridevirtual

Function Intersect.

Intersect

Parameters
aSegRay
aOutTa value between 0.0 and 1.0 in relation to the time of the hit of the segment
aNormalOut
Returns

Implements COBJECT2D.

Definition at line 255 of file cpolygon2d.cpp.

258 {
259  // The dummy block will be never intersected because it have no edges,
260  // only it have a plan surface of the size of the bounding box
261  return false;
262 }

◆ Intersects()

bool CDUMMYBLOCK2D::Intersects ( const CBBOX2D aBBox) const
overridevirtual

Function Intersects.

Intersects - a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅) It intersects if the result intersection is not null

Parameters
aBBox
Returns

Implements COBJECT2D.

Definition at line 242 of file cpolygon2d.cpp.

243 {
244  return m_bbox.Intersects( aBBox );
245 }
bool Intersects(const CBBOX2D &aBBox) const
Function Intersects test if a bounding box intersects this box.
Definition: cbbox2d.cpp:213
CBBOX2D m_bbox
Definition: cobject2d.h:65

References CBBOX2D::Intersects(), and COBJECT2D::m_bbox.

◆ IsBBoxInside()

INTERSECTION_RESULT CDUMMYBLOCK2D::IsBBoxInside ( const CBBOX2D aBBox) const
overridevirtual

Function IsBBoxInside.

Tests if the bounding is out, intersects or is complety inside

Returns
INTERSECTION_RESULT

TODO:

Implements COBJECT2D.

Definition at line 265 of file cpolygon2d.cpp.

References MISSES.

◆ IsPointInside()

bool CDUMMYBLOCK2D::IsPointInside ( const SFVEC2F aPoint) const
overridevirtual

Implements COBJECT2D.

Definition at line 272 of file cpolygon2d.cpp.

273 {
274  // The dummy is filled in all his bounding box, so if it hit the bbox
275  // it will hit this dummy
276  if( m_bbox.Inside( aPoint ) )
277  return true;
278 
279  return false;
280 }
bool Inside(const SFVEC2F &aPoint) const
Function Inside check is a point is inside this bounding box.
Definition: cbbox2d.cpp:225
CBBOX2D m_bbox
Definition: cobject2d.h:65

References CBBOX2D::Inside(), and COBJECT2D::m_bbox.

◆ Overlaps()

bool CDUMMYBLOCK2D::Overlaps ( const CBBOX2D aBBox) const
overridevirtual

Function Overlaps.

Test if the box overlaps the object Conformance The function overlaps implements function Overlaps from the OGC Simple Feature Specification. http://www.opengeospatial.org/standards/sfa a.Overlaps(b) ⇔ ( dim(I(a)) = dim(I(b)) = dim(I(a)I(b))) ∧ (a ∩ b ≠ a) ∧ (a ∩ b ≠ b) It means that the result dimension of an overlap is the same dimentions of the bounding box (so the overlap cannot be a point or a line) and one of the boxes cannot full contain the other box.

Parameters
aBBox- The bounding box to test
Returns
true if the BBox intersects the object or is inside it

Implements COBJECT2D.

Definition at line 248 of file cpolygon2d.cpp.

249 {
250  // Not implemented
251  return false;
252 }

Member Data Documentation

◆ m_bbox

◆ m_boardItem

const BOARD_ITEM& COBJECT2D::m_boardItem
protectedinherited

Definition at line 69 of file cobject2d.h.

Referenced by COBJECT2D::GetBoardItem().

◆ m_centroid

◆ m_obj_type

OBJECT2D_TYPE COBJECT2D::m_obj_type
protectedinherited

Definition at line 67 of file cobject2d.h.

Referenced by COBJECT2D::COBJECT2D(), and COBJECT2D::GetObjectType().


The documentation for this class was generated from the following files: