KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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.
 
virtual bool Intersects (const BBOX_2D &aBBox) const =0
 a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
 
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.
 
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 31 of file object_2d.cpp.

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.

Member Function Documentation

◆ GetBBox()

◆ GetBoardItem()

const BOARD_ITEM & OBJECT_2D::GetBoardItem ( ) const
inline

Definition at line 66 of file object_2d.h.

References m_boardItem.

Referenced by RENDER_3D_RAYTRACE_BASE::createItemsFromContainer().

◆ GetCentroid()

const SFVEC2F & OBJECT_2D::GetCentroid ( ) const
inline

Definition at line 105 of file object_2d.h.

References m_centroid.

Referenced by LAYER_ITEM::LAYER_ITEM(), 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 POLYGON_4PT_2D, FILLED_CIRCLE_2D, LAYER_ITEM_2D, POLYGON_2D, DUMMY_BLOCK_2D, RING_2D, ROUND_SEGMENT_2D, and TRIANGLE_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 POLYGON_4PT_2D, FILLED_CIRCLE_2D, LAYER_ITEM_2D, POLYGON_2D, DUMMY_BLOCK_2D, RING_2D, ROUND_SEGMENT_2D, and TRIANGLE_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 POLYGON_4PT_2D, FILLED_CIRCLE_2D, LAYER_ITEM_2D, POLYGON_2D, DUMMY_BLOCK_2D, RING_2D, ROUND_SEGMENT_2D, and TRIANGLE_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: