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 118 of file cpolygon2d.h.

Constructor & Destructor Documentation

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

Definition at line 224 of file cpolygon2d.cpp.

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

225  :
226  COBJECT2D( OBJ2D_DUMMYBLOCK, aBoardItem )
227 {
228  m_bbox.Set( aPbMin, aPbMax );
231 }
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 GetCenter() const
Function GetCenter return the center point of the bounding box.
Definition: cbbox2d.cpp:121
SFVEC2F m_centroid
Definition: cobject2d.h:66
CDUMMYBLOCK2D::CDUMMYBLOCK2D ( const CBBOX2D aBBox,
const BOARD_ITEM aBoardItem 
)

Definition at line 234 of file cpolygon2d.cpp.

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

235  :
236  COBJECT2D( OBJ2D_DUMMYBLOCK, aBoardItem )
237 {
238  m_bbox.Set( aBBox );
241 }
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 GetCenter() const
Function GetCenter return the center point of the bounding box.
Definition: cbbox2d.cpp:121
SFVEC2F m_centroid
Definition: cobject2d.h:66

Member Function Documentation

const BOARD_ITEM& COBJECT2D::GetBoardItem ( ) const
inlineinherited

Definition at line 75 of file cobject2d.h.

References COBJECT2D::m_boardItem.

Referenced by C3D_RENDER_RAYTRACING::reload().

75 { return m_boardItem; }
const BOARD_ITEM & m_boardItem
Definition: cobject2d.h:69
const SFVEC2F& COBJECT2D::GetCentroid ( ) const
inlineinherited
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 257 of file cpolygon2d.cpp.

260 {
261  // The dummy block will be never intersected because it have no edges,
262  // only it have a plan surface of the size of the bounding box
263  return false;
264 }
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 244 of file cpolygon2d.cpp.

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

245 {
246  return m_bbox.Intersects( aBBox );
247 }
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
INTERSECTION_RESULT CDUMMYBLOCK2D::IsBBoxInside ( const CBBOX2D aBBox) const
overridevirtual

Function IsBBoxInside.

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

Parameters
aBBox- The bounding box to test
Returns
INTERSECTION_RESULT

TODO:

Implements COBJECT2D.

Definition at line 267 of file cpolygon2d.cpp.

References INTR_MISSES.

268 {
270  return INTR_MISSES;
271 }
bool CDUMMYBLOCK2D::IsPointInside ( const SFVEC2F aPoint) const
overridevirtual

Implements COBJECT2D.

Definition at line 274 of file cpolygon2d.cpp.

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

275 {
276  // The dummy is filled in all his bounding box, so if it hit the bbox
277  // it will hit this dummy
278  if( m_bbox.Inside( aPoint ) )
279  return true;
280 
281  return false;
282 }
CBBOX2D m_bbox
Definition: cobject2d.h:65
bool Inside(const SFVEC2F &aPoint) const
Function Inside check is a point is inside this bounding box.
Definition: cbbox2d.cpp:225
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 250 of file cpolygon2d.cpp.

251 {
252  // Not implemented
253  return false;
254 }

Member Data Documentation

const BOARD_ITEM& COBJECT2D::m_boardItem
protectedinherited

Definition at line 69 of file cobject2d.h.

Referenced by COBJECT2D::GetBoardItem().

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: