KiCad PCB EDA Suite
DUMMY_BLOCK_2D Class Reference

A dummy block defined by a 2d box size. More...

#include <polygon_2d.h>

Inheritance diagram for DUMMY_BLOCK_2D:
OBJECT_2D

Public Member Functions

 DUMMY_BLOCK_2D (const SFVEC2F &aPbMin, const SFVEC2F &aPbMax, const BOARD_ITEM &aBoardItem)
 
 DUMMY_BLOCK_2D (const BBOX_2D &aBBox, const BOARD_ITEM &aBoardItem)
 
bool Overlaps (const BBOX_2D &aBBox) const override
 Test if the box overlaps the object. More...
 
bool Intersects (const BBOX_2D &aBBox) const override
 a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅) More...
 
bool Intersect (const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const override
 
INTERSECTION_RESULT IsBBoxInside (const BBOX_2D &aBBox) const override
 Test this object if it's completely outside, intersects, or is completely inside aBBox. More...
 
bool IsPointInside (const SFVEC2F &aPoint) const override
 
const BOARD_ITEMGetBoardItem () const
 
const BBOX_2DGetBBox () const
 
const SFVEC2FGetCentroid () const
 
OBJECT_2D_TYPE GetObjectType () const
 

Protected Attributes

BBOX_2D m_bbox
 
SFVEC2F m_centroid
 
OBJECT_2D_TYPE m_obj_type
 
const BOARD_ITEMm_boardItem
 

Detailed Description

A dummy block defined by a 2d box size.

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

Definition at line 126 of file polygon_2d.h.

Constructor & Destructor Documentation

◆ DUMMY_BLOCK_2D() [1/2]

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

Definition at line 210 of file polygon_2d.cpp.

213{
214 m_bbox.Set( aPbMin, aPbMax );
217}
BBOX_2D m_bbox
Definition: object_2d.h:110
SFVEC2F m_centroid
Definition: object_2d.h:111
OBJECT_2D(OBJECT_2D_TYPE aObjType, const BOARD_ITEM &aBoardItem)
Definition: object_2d.cpp:31
SFVEC2F GetCenter() const
Definition: bbox_2d.cpp:119
void Set(const SFVEC2F &aPbMin, const SFVEC2F &aPbMax)
Set bounding box with new parameters.
Definition: bbox_2d.cpp:61
void ScaleNextUp()
Scale a bounding box to the next float representation making it larger.
Definition: bbox_2d.cpp:162

References DUMMYBLOCK, BBOX_2D::GetCenter(), OBJECT_2D::m_bbox, OBJECT_2D::m_centroid, BBOX_2D::ScaleNextUp(), and BBOX_2D::Set().

◆ DUMMY_BLOCK_2D() [2/2]

DUMMY_BLOCK_2D::DUMMY_BLOCK_2D ( const BBOX_2D aBBox,
const BOARD_ITEM aBoardItem 
)

Member Function Documentation

◆ GetBBox()

◆ GetBoardItem()

const BOARD_ITEM & OBJECT_2D::GetBoardItem ( ) const
inlineinherited

Definition at line 66 of file object_2d.h.

66{ return m_boardItem; }
const BOARD_ITEM & m_boardItem
Definition: object_2d.h:114

References OBJECT_2D::m_boardItem.

Referenced by RENDER_3D_RAYTRACE::createItemsFromContainer().

◆ GetCentroid()

const SFVEC2F & OBJECT_2D::GetCentroid ( ) const
inlineinherited

Definition at line 105 of file object_2d.h.

105{ return m_centroid; }

References OBJECT_2D::m_centroid.

Referenced by LAYER_ITEM::LAYER_ITEM(), sortByCentroidX(), sortByCentroidY(), and sortByCentroidZ().

◆ GetObjectType()

◆ Intersect()

bool DUMMY_BLOCK_2D::Intersect ( const RAYSEG2D aSegRay,
float *  aOutT,
SFVEC2F aNormalOut 
) const
overridevirtual
Parameters
aOutTa value between 0.0 and 1.0 in relation to the time of the hit of the segment.

Implements OBJECT_2D.

Definition at line 242 of file polygon_2d.cpp.

243{
244 // The dummy block will be never intersected because it have no edges,
245 // only it have a plan surface of the size of the bounding box
246 return false;
247}

◆ Intersects()

bool DUMMY_BLOCK_2D::Intersects ( const BBOX_2D aBBox) const
overridevirtual

a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)

Implements OBJECT_2D.

Definition at line 229 of file polygon_2d.cpp.

230{
231 return m_bbox.Intersects( aBBox );
232}
bool Intersects(const BBOX_2D &aBBox) const
Test if a bounding box intersects this box.
Definition: bbox_2d.cpp:211

References BBOX_2D::Intersects(), and OBJECT_2D::m_bbox.

◆ IsBBoxInside()

INTERSECTION_RESULT DUMMY_BLOCK_2D::IsBBoxInside ( const BBOX_2D aBBox) const
overridevirtual

Test this object if it's completely outside, intersects, or is completely inside aBBox.

Returns
INTERSECTION_RESULT

TODO:

Implements OBJECT_2D.

Definition at line 250 of file polygon_2d.cpp.

References MISSES.

◆ IsPointInside()

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

Implements OBJECT_2D.

Definition at line 257 of file polygon_2d.cpp.

258{
259 // The dummy is filled in all his bounding box, so if it hit the bbox
260 // it will hit this dummy
261 if( m_bbox.Inside( aPoint ) )
262 return true;
263
264 return false;
265}
bool Inside(const SFVEC2F &aPoint) const
Check is a point is inside this bounding box.
Definition: bbox_2d.cpp:223

References BBOX_2D::Inside(), and OBJECT_2D::m_bbox.

◆ Overlaps()

bool DUMMY_BLOCK_2D::Overlaps ( const BBOX_2D aBBox) const
overridevirtual

Test if the box overlaps the object.

Conformance Implements the Overlaps function from the OGC Simple Feature Specification at 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 dimensions 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
aBBoxis the bounding box to test.
Returns
true if the BBox intersects the object or is inside it.

Implements OBJECT_2D.

Definition at line 235 of file polygon_2d.cpp.

236{
237 // Not implemented
238 return false;
239}

Member Data Documentation

◆ m_bbox

◆ m_boardItem

const BOARD_ITEM& OBJECT_2D::m_boardItem
protectedinherited

Definition at line 114 of file object_2d.h.

Referenced by OBJECT_2D::GetBoardItem().

◆ m_centroid

◆ m_obj_type

OBJECT_2D_TYPE OBJECT_2D::m_obj_type
protectedinherited

Definition at line 112 of file object_2d.h.

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


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