KiCad PCB EDA Suite
OBJECT_2D Class Referenceabstract

#include <object_2d.h>

Inheritance diagram for OBJECT_2D:
DUMMY_BLOCK_2D FILLED_CIRCLE_2D LAYER_ITEM_2D POLYGON_2D POLYGON_4PT_2D RING_2D ROUND_SEGMENT_2D TRIANGLE_2D

Public Member Functions

 OBJECT_2D (OBJECT_2D_TYPE aObjType, const BOARD_ITEM &aBoardItem)
 
virtual ~OBJECT_2D ()
 
const BOARD_ITEMGetBoardItem () const
 
virtual bool Overlaps (const BBOX_2D &aBBox) const =0
 Test if the box overlaps the object. More...
 
virtual bool Intersects (const BBOX_2D &aBBox) const =0
 a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅) More...
 
virtual bool Intersect (const RAYSEG2D &aSegRay, float *aOutT, SFVEC2F *aNormalOut) const =0
 
virtual INTERSECTION_RESULT IsBBoxInside (const BBOX_2D &aBBox) const =0
 Test this object if it's completely outside, intersects, or is completely inside aBBox. More...
 
virtual bool IsPointInside (const SFVEC2F &aPoint) const =0
 
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

Definition at line 60 of file object_2d.h.

Constructor & Destructor Documentation

◆ OBJECT_2D()

OBJECT_2D::OBJECT_2D ( OBJECT_2D_TYPE  aObjType,
const BOARD_ITEM aBoardItem 
)

Definition at line 36 of file object_2d.cpp.

37  : m_boardItem(aBoardItem)
38 {
39  m_obj_type = aObjType;
40  OBJECT_2D_STATS::Instance().AddOne( aObjType );
41 }
OBJECT_2D_TYPE m_obj_type
Definition: object_2d.h:112
const BOARD_ITEM & m_boardItem
Definition: object_2d.h:114
static OBJECT_2D_STATS & Instance()
Definition: object_2d.h:139
void AddOne(OBJECT_2D_TYPE aObjType)
Definition: object_2d.h:132

References OBJECT_2D_STATS::AddOne(), OBJECT_2D_STATS::Instance(), and m_obj_type.

◆ ~OBJECT_2D()

virtual OBJECT_2D::~OBJECT_2D ( )
inlinevirtual

Definition at line 64 of file object_2d.h.

64 {}

Member Function Documentation

◆ GetBBox()

◆ GetBoardItem()

const BOARD_ITEM& OBJECT_2D::GetBoardItem ( ) const
inline

Definition at line 66 of file object_2d.h.

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

References m_boardItem.

Referenced by RENDER_3D_RAYTRACE::createItemsFromContainer(), and RENDER_3D_RAYTRACE::Reload().

◆ GetCentroid()

const SFVEC2F& OBJECT_2D::GetCentroid ( ) const
inline

Definition at line 105 of file object_2d.h.

105 { return m_centroid; }
SFVEC2F m_centroid
Definition: object_2d.h:111

References m_centroid.

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

◆ GetObjectType()

◆ Intersect()

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

Implemented in DUMMY_BLOCK_2D, POLYGON_2D, LAYER_ITEM_2D, ROUND_SEGMENT_2D, POLYGON_4PT_2D, TRIANGLE_2D, FILLED_CIRCLE_2D, and RING_2D.

Referenced by LAYER_ITEM::Intersect(), LAYER_ITEM_2D::Intersect(), LAYER_ITEM::IntersectP(), and BVH_CONTAINER_2D::recursiveIntersectAny().

◆ Intersects()

virtual bool OBJECT_2D::Intersects ( const BBOX_2D aBBox) const
pure virtual

◆ IsBBoxInside()

virtual INTERSECTION_RESULT OBJECT_2D::IsBBoxInside ( const BBOX_2D aBBox) const
pure virtual

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

Returns
INTERSECTION_RESULT

Implemented in DUMMY_BLOCK_2D, POLYGON_2D, LAYER_ITEM_2D, ROUND_SEGMENT_2D, POLYGON_4PT_2D, TRIANGLE_2D, FILLED_CIRCLE_2D, and RING_2D.

◆ IsPointInside()

◆ Overlaps()

virtual bool OBJECT_2D::Overlaps ( const BBOX_2D aBBox) const
pure virtual

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.

Implemented in DUMMY_BLOCK_2D, POLYGON_2D, LAYER_ITEM_2D, ROUND_SEGMENT_2D, POLYGON_4PT_2D, TRIANGLE_2D, FILLED_CIRCLE_2D, and RING_2D.

Member Data Documentation

◆ m_bbox

◆ m_boardItem

const BOARD_ITEM& OBJECT_2D::m_boardItem
protected

Definition at line 114 of file object_2d.h.

Referenced by GetBoardItem().

◆ m_centroid

◆ m_obj_type

OBJECT_2D_TYPE OBJECT_2D::m_obj_type
protected

Definition at line 112 of file object_2d.h.

Referenced by GetObjectType(), and OBJECT_2D().


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