KiCad PCB EDA Suite
Loading...
Searching...
No Matches
LAYER_ITEM_2D Class Reference

Make solid geometry for objects on layers. More...

#include <layer_item_2d.h>

Inheritance diagram for LAYER_ITEM_2D:
OBJECT_2D

Public Member Functions

 LAYER_ITEM_2D (const OBJECT_2D *aObjectA, std::vector< const OBJECT_2D * > *aObjectB, const OBJECT_2D *aObjectC, const BOARD_ITEM &aBoardItem)
 
 ~LAYER_ITEM_2D ()
 
bool Overlaps (const BBOX_2D &aBBox) const override
 Test if the box overlaps the object.
 
bool Intersects (const BBOX_2D &aBBox) const override
 a.Intersects(b) ⇔ !a.Disjoint(b) ⇔ !(a ∩ b = ∅)
 
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.
 
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
 

Private Attributes

const OBJECT_2Dm_objectA
 
std::vector< const OBJECT_2D * > * m_objectB
 
const OBJECT_2Dm_objectC
 

Detailed Description

Make solid geometry for objects on layers.

The operation is in the form (A - B) /\ C For almost all of the layers it translate something like: A (a via, a track, pad, polygon), B (a via hole, a THT hole, .. ), C the board (epoxy) For layers like Solder mask that are negative: A ( epoxy ), B( pads, polygons, ..), C=1

Some notes: BODY = PCB_outlines - PCB_holes - (Modules_THT_holes + VIA_THT_holes)

Plated_vias_and_holes = Tracks.Vias + Modules.PlatedHoles

Layer.cu = ( Tracks.cu + Modules_Pads.cu + Modules_Graphics.cu + Layer_zones.cu + PCB_drawings.cu - Layer_VIA_holes ) & BODY

Layer.Mask = BODY - (PCB_drawing.Mask + Modules_Graphics.Mask + Modules_Pads.Mask + Layer_zones.Mask ) Layer.Paste = (PCB_drawing.Paste + Modules_Graphics.Paste + Modules_Pads.Paste + Layer_zones.Paste) & BODY Layer.Silk = (PCB_drawing.Silk + Modules_Graphics.Silk + Modules_Pads.Silk + Layer_zones.Paste) & BODY

BODY = A - B /\ 1 Layer.cu = A - B /\ C Layer.mask = A - B /\ 1 Layers.Paste = A - 0 /\ C Layers.Silk = A - 0 /\ C

BODY = P - T /\ 1 Layer.cu = T - H /\ BODY Layer.mask = BODY - M /\ 1 Layers.Paste = P - 0 /\ BODY Layers.Silk = S - 0 /\ BODY

Definition at line 79 of file layer_item_2d.h.

Constructor & Destructor Documentation

◆ LAYER_ITEM_2D()

LAYER_ITEM_2D::LAYER_ITEM_2D ( const OBJECT_2D aObjectA,
std::vector< const OBJECT_2D * > *  aObjectB,
const OBJECT_2D aObjectC,
const BOARD_ITEM aBoardItem 
)

◆ ~LAYER_ITEM_2D()

LAYER_ITEM_2D::~LAYER_ITEM_2D ( )

Definition at line 53 of file layer_item_2d.cpp.

References CSGITEM_EMPTY, CSGITEM_FULL, and m_objectB.

Member Function Documentation

◆ GetBBox()

◆ GetBoardItem()

const BOARD_ITEM & OBJECT_2D::GetBoardItem ( ) const
inlineinherited

Definition at line 66 of file object_2d.h.

References OBJECT_2D::m_boardItem.

Referenced by RENDER_3D_RAYTRACE_BASE::createItemsFromContainer().

◆ GetCentroid()

const SFVEC2F & OBJECT_2D::GetCentroid ( ) const
inlineinherited

◆ GetObjectType()

◆ Intersect()

bool LAYER_ITEM_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 80 of file layer_item_2d.cpp.

References RAYSEG2D::atNormalized(), OBJECT_2D::GetObjectType(), OBJECT_2D::Intersect(), OBJECT_2D::IsPointInside(), RAYSEG2D::m_End, RAYSEG2D::m_Length, m_objectA, m_objectB, and RAYSEG2D::m_Start.

◆ Intersects()

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

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

Implements OBJECT_2D.

Definition at line 63 of file layer_item_2d.cpp.

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

◆ IsBBoxInside()

INTERSECTION_RESULT LAYER_ITEM_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

Implements OBJECT_2D.

Definition at line 156 of file layer_item_2d.cpp.

◆ IsPointInside()

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

Implements OBJECT_2D.

Definition at line 165 of file layer_item_2d.cpp.

References CSGITEM_EMPTY, OBJECT_2D::IsPointInside(), IsPointInside(), m_objectA, and m_objectB.

Referenced by IsPointInside().

◆ Overlaps()

bool LAYER_ITEM_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 71 of file layer_item_2d.cpp.

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().

◆ m_objectA

const OBJECT_2D* LAYER_ITEM_2D::m_objectA
private

Definition at line 95 of file layer_item_2d.h.

Referenced by Intersect(), and IsPointInside().

◆ m_objectB

std::vector<const OBJECT_2D*>* LAYER_ITEM_2D::m_objectB
private

Definition at line 96 of file layer_item_2d.h.

Referenced by Intersect(), IsPointInside(), and ~LAYER_ITEM_2D().

◆ m_objectC

const OBJECT_2D* LAYER_ITEM_2D::m_objectC
private

Definition at line 97 of file layer_item_2d.h.


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