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

Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc segments. More...

#include <shape_line_chain.h>

Inheritance diagram for SHAPE_LINE_CHAIN:
SHAPE_LINE_CHAIN_BASE SHAPE SHAPE_BASE

Classes

struct  compareOriginDistance
 
struct  INTERSECTION
 Represent an intersection between two line segments. More...
 
class  POINT_INSIDE_TRACKER
 A dynamic state checking if a point lies within polygon with a dynamically built outline ( with each piece of the outline added by AddPolyline () More...
 

Public Types

typedef std::vector< VECTOR2I >::iterator point_iter
 
typedef std::vector< VECTOR2I >::const_iterator point_citer
 
typedef std::vector< INTERSECTIONINTERSECTIONS
 

Public Member Functions

 SHAPE_LINE_CHAIN ()
 Initialize an empty line chain.
 
 SHAPE_LINE_CHAIN (const SHAPE_LINE_CHAIN &aShape)
 
 SHAPE_LINE_CHAIN (const std::vector< int > &aV)
 
 SHAPE_LINE_CHAIN (const std::vector< VECTOR2I > &aV, bool aClosed=false)
 
 SHAPE_LINE_CHAIN (const SHAPE_ARC &aArc, bool aClosed=false)
 
 SHAPE_LINE_CHAIN (const ClipperLib::Path &aPath, const std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, const std::vector< SHAPE_ARC > &aArcBuffer)
 
 SHAPE_LINE_CHAIN (const Clipper2Lib::Path64 &aPath, const std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, const std::vector< SHAPE_ARC > &aArcBuffer)
 
virtual ~SHAPE_LINE_CHAIN ()
 
virtual bool Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
 Check if point aP lies closer to us than aClearance.
 
virtual bool Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
 Check if segment aSeg lies closer to us than aClearance.
 
bool ClosestPoints (const SHAPE_LINE_CHAIN &aOther, VECTOR2I &aPt0, VECTOR2I &aPt1) const
 Finds closest points between this and the other line chain.
 
bool ClosestSegmentsFast (const SHAPE_LINE_CHAIN &aOther, VECTOR2I &aPt0, VECTOR2I &aPt1) const
 Finds closest points between segments of this and the other line chain.
 
SHAPE_LINE_CHAINoperator= (const SHAPE_LINE_CHAIN &)=default
 
SHAPEClone () const override
 Return a dynamically allocated copy of the shape.
 
void Clear ()
 Remove all points from the line chain.
 
void SetClosed (bool aClosed)
 Mark the line chain as closed (i.e.
 
bool IsClosed () const override
 
void SetWidth (int aWidth)
 Set the width of all segments in the chain.
 
int Width () const
 Get the current width of the segments in the chain.
 
int SegmentCount () const
 Return the number of segments in this line chain.
 
int ShapeCount () const
 Return the number of shapes (line segments or arcs) in this line chain.
 
void RemoveDuplicatePoints ()
 Remove the duplicate points from the line chain.
 
void Simplify (int aMaxError=0)
 Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
 
SHAPE_LINE_CHAINSimplify2 (bool aRemoveColinear=true)
 
int PointCount () const
 Return the number of points (vertices) in this line chain.
 
SEG Segment (int aIndex) const
 Return a copy of the aIndex-th segment in the line chain.
 
const SEG CSegment (int aIndex) const
 Return a constant copy of the aIndex segment in the line chain.
 
int NextShape (int aPointIndex) const
 Return the vertex index of the next shape in the chain, or -1 if aPointIndex is the last shape.
 
void SetPoint (int aIndex, const VECTOR2I &aPos)
 Move a point to a specific location.
 
const VECTOR2ICPoint (int aIndex) const
 Return a reference to a given point in the line chain.
 
const std::vector< VECTOR2I > & CPoints () const
 
const VECTOR2ICLastPoint () const
 Return the last point in the line chain.
 
const std::vector< SHAPE_ARC > & CArcs () const
 
const std::vector< std::pair< ssize_t, ssize_t > > & CShapes () const
 
const BOX2I BBox (int aClearance=0) const override
 Compute a bounding box of the shape, with a margin of aClearance a collision.
 
void GenerateBBoxCache () const
 
BOX2IGetCachedBBox () const override
 
const SHAPE_LINE_CHAIN Reverse () const
 Reverse point order in the line chain.
 
void ClearArcs ()
 Remove all arc references in the line chain, resulting in a chain formed only of straight segments.
 
long long int Length () const
 Return length of the line chain in Euclidean metric.
 
void ReservePoints (size_t aSize)
 Allocate a number of points all at once (for performance).
 
void Append (int aX, int aY, bool aAllowDuplication=false)
 Append a new point at the end of the line chain.
 
void Append (const VECTOR2I &aP, bool aAllowDuplication=false)
 Append a new point at the end of the line chain.
 
void Append (const SHAPE_LINE_CHAIN &aOtherLine)
 Append another line chain at the end.
 
void Append (const SHAPE_ARC &aArc)
 
void Append (const SHAPE_ARC &aArc, double aAccuracy)
 
void Insert (size_t aVertex, const VECTOR2I &aP)
 
void Insert (size_t aVertex, const SHAPE_ARC &aArc)
 
void Replace (int aStartIndex, int aEndIndex, const VECTOR2I &aP)
 Replace points with indices in range [start_index, end_index] with a single point aP.
 
void Replace (int aStartIndex, int aEndIndex, const SHAPE_LINE_CHAIN &aLine)
 Replace points with indices in range [start_index, end_index] with the points from line chain aLine.
 
void Remove (int aStartIndex, int aEndIndex)
 Remove the range of points [start_index, end_index] from the line chain.
 
void Remove (int aIndex)
 Remove the aIndex-th point from the line chain.
 
void RemoveShape (int aPointIndex)
 Remove the shape at the given index from the line chain.
 
int Split (const VECTOR2I &aP, bool aExact=false)
 Insert the point aP belonging to one of the our segments, splitting the adjacent segment in two.
 
int Find (const VECTOR2I &aP, int aThreshold=0) const
 Search for point aP.
 
int FindSegment (const VECTOR2I &aP, int aThreshold=1) const
 Search for segment containing point aP.
 
const SHAPE_LINE_CHAIN Slice (int aStartIndex, int aEndIndex=-1) const
 Return a subset of this line chain containing the [start_index, end_index] range of points.
 
bool Intersects (const SHAPE_LINE_CHAIN &aChain) const
 
int Intersect (const SEG &aSeg, INTERSECTIONS &aIp) const
 Find all intersection points between our line chain and the segment aSeg.
 
int Intersect (const SHAPE_LINE_CHAIN &aChain, INTERSECTIONS &aIp, bool aExcludeColinearAndTouching=false, BOX2I *aChainBBox=nullptr) const
 Find all intersection points between our line chain and the line chain aChain.
 
int PathLength (const VECTOR2I &aP, int aIndex=-1) const
 Compute the walk path length from the beginning of the line chain and the point aP belonging to our line.
 
bool CheckClearance (const VECTOR2I &aP, const int aDist) const
 Check if point aP is closer to (or on) an edge or vertex of the line chain.
 
const std::optional< INTERSECTIONSelfIntersecting () const
 Check if the line chain is self-intersecting.
 
const std::optional< INTERSECTIONSelfIntersectingWithArcs () const
 Check if the line chain is self-intersecting.
 
int NearestSegment (const VECTOR2I &aP) const
 Find the segment nearest the given point.
 
const VECTOR2I NearestPoint (const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
 Find a point on the line chain that is closest to point aP.
 
const VECTOR2I NearestPoint (const SEG &aSeg, int &dist) const
 Find a point on the line chain that is closest to the line defined by the points of segment aSeg, also returns the distance.
 
const std::string Format (bool aCplusPlus=true) const override
 
bool Parse (std::stringstream &aStream) override
 
bool operator!= (const SHAPE_LINE_CHAIN &aRhs) const
 
bool CompareGeometry (const SHAPE_LINE_CHAIN &aOther) const
 
void Move (const VECTOR2I &aVector) override
 
void Mirror (const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection)
 Mirror the line points about y or x (or both).
 
void Mirror (const SEG &axis)
 Mirror the line points using an given axis.
 
void Rotate (const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
 Rotate all vertices by a given angle.
 
bool IsSolid () const override
 
const VECTOR2I PointAlong (int aPathLength) const
 
double Area (bool aAbsolute=true) const
 Return the area of this chain.
 
void Split (const VECTOR2I &aStart, const VECTOR2I &aEnd, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aMid, SHAPE_LINE_CHAIN &aPost) const
 Extract parts of this line chain, depending on the starting and ending points.
 
bool OffsetLine (int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, SHAPE_LINE_CHAIN &aLeft, SHAPE_LINE_CHAIN &aRight, bool aSimplify=false) const
 Creates line chains aLeft and aRight offset to this line chain.
 
size_t ArcCount () const
 
ssize_t ArcIndex (size_t aSegment) const
 Return the arc index for the given segment index.
 
const SHAPE_ARCArc (size_t aArc) const
 
bool IsSharedPt (size_t aIndex) const
 Test if a point is shared between multiple shapes.
 
bool IsPtOnArc (size_t aPtIndex) const
 
bool IsArcSegment (size_t aSegment) const
 
bool IsArcStart (size_t aIndex) const
 
bool IsArcEnd (size_t aIndex) const
 
int Distance (const VECTOR2I &aP, bool aOutlineOnly) const
 
virtual const VECTOR2I GetPoint (int aIndex) const override
 
virtual const SEG GetSegment (int aIndex) const override
 
virtual size_t GetPointCount () const override
 
virtual size_t GetSegmentCount () const override
 
void TransformToPolygon (SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override
 Fills a SHAPE_POLY_SET with a polygon representation of this shape.
 
virtual int Distance (const VECTOR2I &aP) const
 Returns the minimum distance from a given point to this shape.
 
virtual bool Collide (const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const
 Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
 
virtual bool Collide (const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
 
SEG::ecoord SquaredDistance (const VECTOR2I &aP, bool aOutlineOnly=false) const override
 
bool PointInside (const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
 Check if point aP lies inside a closed shape.
 
bool PointOnEdge (const VECTOR2I &aP, int aAccuracy=0) const
 Check if point aP lies on an edge or vertex of the line chain.
 
int EdgeContainingPoint (const VECTOR2I &aP, int aAccuracy=0) const
 Check if point aP lies on an edge or vertex of the line chain.
 
int GetClearance (const SHAPE *aOther) const
 Return the actual minimum distance between two shapes.
 
bool IsNull () const
 Return true if the shape is a null shape.
 
virtual VECTOR2I Centre () const
 Compute a center-of-mass of the shape.
 
FACETNewFacet ()
 
SGNODECalcShape (SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false)
 
SHAPE_TYPE Type () const
 Return the type of the shape.
 
wxString TypeName () const
 
virtual bool HasIndexableSubshapes () const
 
virtual size_t GetIndexableSubshapeCount () const
 
virtual void GetIndexableSubshapes (std::vector< const SHAPE * > &aSubshapes) const
 

Static Public Member Functions

static bool ClosestPoints (const point_citer &aMyStart, const point_citer &aMyEnd, const point_citer &aOtherStart, const point_citer &aOtherEnd, VECTOR2I &aPt0, VECTOR2I &aPt1, int64_t &aDistSq)
 
static bool ClosestSegments (const VECTOR2I &aMyPrevPt, const point_citer &aMyStart, const point_citer &aMyEnd, const VECTOR2I &aOtherPrevPt, const point_citer &aOtherStart, const point_citer &aOtherEnd, VECTOR2I &aPt0, VECTOR2I &aPt1, int64_t &aDistSq)
 

Static Public Attributes

static const int MIN_PRECISION_IU = 4
 This is the minimum precision for all the points in a shape.
 

Protected Types

typedef VECTOR2I::extended_type ecoord
 

Protected Member Functions

void convertArc (ssize_t aArcIndex)
 Convert an arc to only a point chain by removing the arc and references.
 
void splitArc (ssize_t aPtIndex, bool aCoincident=false)
 Splits an arc into two arcs at aPtIndex.
 
void amendArc (size_t aArcIndex, const VECTOR2I &aNewStart, const VECTOR2I &aNewEnd)
 
void amendArcStart (size_t aArcIndex, const VECTOR2I &aNewStart)
 
void amendArcEnd (size_t aArcIndex, const VECTOR2I &aNewEnd)
 
ssize_t reversedArcIndex (size_t aSegment) const
 Return the arc index for the given segment index, looking backwards.
 
ClipperLib::Path convertToClipper (bool aRequiredOrientation, std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, std::vector< SHAPE_ARC > &aArcBuffer) const
 Create a new Clipper path from the SHAPE_LINE_CHAIN in a given orientation.
 
Clipper2Lib::Path64 convertToClipper2 (bool aRequiredOrientation, std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, std::vector< SHAPE_ARC > &aArcBuffer) const
 Create a new Clipper2 path from the SHAPE_LINE_CHAIN in a given orientation.
 
void fixIndicesRotation ()
 Fix indices of this chain to ensure arcs are not split between the end and start indices.
 
void mergeFirstLastPointIfNeeded ()
 Merge the first and last point if they are the same and this chain is closed.
 

Protected Attributes

SHAPE_TYPE m_type
 < type of our shape
 

Private Attributes

std::vector< VECTOR2Im_points
 array of vertices
 
std::vector< std::pair< ssize_t, ssize_t > > m_shapes
 Array of indices that refer to the index of the shape if the point is part of a larger shape, e.g.
 
std::vector< SHAPE_ARCm_arcs
 
bool m_closed
 is the line chain closed?
 
int m_width
 Width of the segments (for BBox calculations in RTree) TODO Adjust usage of SHAPE_LINE_CHAIN to account for where we need a width and where not Alternatively, we could split the class into a LINE_CHAIN (no width) and SHAPE_LINE_CHAIN that derives from SHAPE as well that does have a width.
 
BOX2I m_bbox
 cached bounding box
 
std::list< FACET * > facets
 

Static Private Attributes

static const ssize_t SHAPE_IS_PT = -1
 
static const std::pair< ssize_t, ssize_t > SHAPES_ARE_PT = { SHAPE_IS_PT, SHAPE_IS_PT }
 

Friends

class SHAPE_POLY_SET
 

Detailed Description

Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc segments.

The arc shapes are piecewise approximated for the purpose of boolean operations but are used as arcs when doing collision checks.

It is purposely not named "polyline" to avoid confusion with the existing CPolyLine in Pcbnew.

Note
The SHAPE_LINE_CHAIN class shall not be used for polygons!

Definition at line 82 of file shape_line_chain.h.

Member Typedef Documentation

◆ ecoord

typedef VECTOR2I::extended_type SHAPE::ecoord
protectedinherited

Definition at line 284 of file shape.h.

◆ INTERSECTIONS

Definition at line 151 of file shape_line_chain.h.

◆ point_citer

typedef std::vector<VECTOR2I>::const_iterator SHAPE_LINE_CHAIN::point_citer

Definition at line 86 of file shape_line_chain.h.

◆ point_iter

typedef std::vector<VECTOR2I>::iterator SHAPE_LINE_CHAIN::point_iter

Definition at line 85 of file shape_line_chain.h.

Constructor & Destructor Documentation

◆ SHAPE_LINE_CHAIN() [1/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( )
inline

Initialize an empty line chain.

Definition at line 157 of file shape_line_chain.h.

Referenced by Clone(), and Slice().

◆ SHAPE_LINE_CHAIN() [2/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( const SHAPE_LINE_CHAIN aShape)
inline

Definition at line 163 of file shape_line_chain.h.

◆ SHAPE_LINE_CHAIN() [3/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( const std::vector< int > &  aV)

Definition at line 51 of file shape_line_chain.cpp.

References Append().

◆ SHAPE_LINE_CHAIN() [4/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( const std::vector< VECTOR2I > &  aV,
bool  aClosed = false 
)

Definition at line 61 of file shape_line_chain.cpp.

References m_points, m_shapes, SetClosed(), and SHAPES_ARE_PT.

◆ SHAPE_LINE_CHAIN() [5/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( const SHAPE_ARC aArc,
bool  aClosed = false 
)

Definition at line 72 of file shape_line_chain.cpp.

References Append(), and SetClosed().

◆ SHAPE_LINE_CHAIN() [6/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( const ClipperLib::Path &  aPath,
const std::vector< CLIPPER_Z_VALUE > &  aZValueBuffer,
const std::vector< SHAPE_ARC > &  aArcBuffer 
)

Definition at line 82 of file shape_line_chain.cpp.

References Append(), fixIndicesRotation(), m_arcs, m_points, m_shapes, SHAPE_IS_PT, and X.

◆ SHAPE_LINE_CHAIN() [7/7]

SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN ( const Clipper2Lib::Path64 &  aPath,
const std::vector< CLIPPER_Z_VALUE > &  aZValueBuffer,
const std::vector< SHAPE_ARC > &  aArcBuffer 
)

Definition at line 126 of file shape_line_chain.cpp.

References Append(), fixIndicesRotation(), m_arcs, m_points, m_shapes, and SHAPE_IS_PT.

◆ ~SHAPE_LINE_CHAIN()

virtual SHAPE_LINE_CHAIN::~SHAPE_LINE_CHAIN ( )
inlinevirtual

Definition at line 187 of file shape_line_chain.h.

Member Function Documentation

◆ amendArc()

void SHAPE_LINE_CHAIN::amendArc ( size_t  aArcIndex,
const VECTOR2I aNewStart,
const VECTOR2I aNewEnd 
)
protected

◆ amendArcEnd()

void SHAPE_LINE_CHAIN::amendArcEnd ( size_t  aArcIndex,
const VECTOR2I aNewEnd 
)
inlineprotected

Definition at line 907 of file shape_line_chain.h.

References amendArc(), and m_arcs.

◆ amendArcStart()

void SHAPE_LINE_CHAIN::amendArcStart ( size_t  aArcIndex,
const VECTOR2I aNewStart 
)
inlineprotected

Definition at line 902 of file shape_line_chain.h.

References amendArc(), and m_arcs.

◆ Append() [1/5]

void SHAPE_LINE_CHAIN::Append ( const SHAPE_ARC aArc)

Definition at line 1652 of file shape_line_chain.cpp.

References Append(), and SHAPE_ARC::DefaultAccuracyForPCB().

◆ Append() [2/5]

void SHAPE_LINE_CHAIN::Append ( const SHAPE_ARC aArc,
double  aAccuracy 
)

◆ Append() [3/5]

void SHAPE_LINE_CHAIN::Append ( const SHAPE_LINE_CHAIN aOtherLine)

Append another line chain at the end.

Parameters
aOtherLineis the line chain to be appended.

Definition at line 1586 of file shape_line_chain.cpp.

References ArcIndex(), CPoint(), CShapes(), IsArcSegment(), m_arcs, m_bbox, m_points, m_shapes, BOX2< Vec >::Merge(), mergeFirstLastPointIfNeeded(), PointCount(), alg::run_on_pair(), SHAPE_IS_PT, and SHAPES_ARE_PT.

◆ Append() [4/5]

void SHAPE_LINE_CHAIN::Append ( const VECTOR2I aP,
bool  aAllowDuplication = false 
)
inline

Append a new point at the end of the line chain.

Parameters
aPis the new point.
aAllowDuplicationset to true to append the new point even it is the same as the last entered point or false (default) to skip it if it is the same as the last entered point.

Definition at line 523 of file shape_line_chain.h.

References CPoint(), m_bbox, m_points, m_shapes, BOX2< Vec >::Merge(), and SHAPES_ARE_PT.

◆ Append() [5/5]

void SHAPE_LINE_CHAIN::Append ( int  aX,
int  aY,
bool  aAllowDuplication = false 
)
inline

Append a new point at the end of the line chain.

Parameters
aXis X coordinate of the new point.
aYis Y coordinate of the new point.
aAllowDuplicationset to true to append the new point even if it is the same as the last entered point, false (default) to skip it if it is the same as the last entered point.

Definition at line 509 of file shape_line_chain.h.

References Append().

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PNS_PCBNEW_DEBUG_DECORATOR::AddPoint(), PNS_TEST_DEBUG_DECORATOR::AddPoint(), SCH_SHAPE::AddPoint(), POLYGON_GEOM_MANAGER::AddPoint(), ZONE::AddPolygon(), PNS_PCBNEW_DEBUG_DECORATOR::AddShape(), PNS::DEBUG_DECORATOR::AddShape(), PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), PNS::DIFF_PAIR::Append(), SHAPE_SIMPLE::Append(), Append(), CADSTAR_ARCHIVE_PARSER::VERTEX::AppendToChain(), approximateLineChainWithArcs(), PNS::ArcHull(), PNS::NODE::AssembleLine(), EDA_SHAPE::beginEdit(), BOOST_AUTO_TEST_CASE(), buildBoardBoundingBoxPoly(), PNS::DP_GATEWAYS::buildDpContinuation(), PAD::buildEffectiveShape(), BuildFootprintPolygonOutlines(), PNS::DIFF_PAIR::BuildInitial(), DIRECTION_45::BuildInitialTrace(), SHAPE_POLY_SET::BuildPolysetFromOrientedPaths(), ZONE_FILLER::buildThermalSpokes(), SHAPE_POLY_SET::chamferFilletPolygon(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS::OPTIMIZER::circleBreakouts(), collide(), KI_TEST::CommonTestData::CommonTestData(), PCB_GRID_HELPER::computeAnchors(), SCH_SHEET_PIN::ConstrainOnEdge(), EDA_SHAPE::continueEdit(), ConvertArcToPolyline(), ConvertImageToPolygons(), convertPolygon(), KIGEOM::ConvertToChain(), SHAPE_ARC::ConvertToPolyline(), PNS::ConvexHull(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), PNS::OPTIMIZER::customBreakouts(), doConvertOutlineToPolygon(), PNS::MEANDER_PLACER::doMove(), PNS::LINE::dragSegment45(), PNS::MEANDER_SHAPE::forward(), fractureSingleCacheFriendly(), fractureSingleSlow(), PNS::MEANDER_SHAPE::genMeanderShape(), CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes(), PCB_TUNING_PATTERN::getOutline(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), KIFONT::OUTLINE_FONT::getTextAsGlyphsUnlocked(), HelperShapeLineChainFromAltiumVertices(), Insert(), TEST_EE_ITEM_FIXTURE::Instantiate(), POLYGON_GEOM_MANAGER::IsSelfIntersecting(), PNS::ROUTER::isStartingPointRoutable(), IteratorFixture::IteratorFixture(), PNS::TOPOLOGY::LeadingRatLine(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), FABMASTER::loadFootprints(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), FABMASTER::loadShapePolySet(), FABMASTER::loadZone(), PNS::MEANDER_SHAPE::MakeArc(), PNS::MEANDER_SHAPE::MakeCorner(), PNS::MEANDER_SHAPE::makeMiterShape(), CONVERT_TOOL::makePolysFromChainedSegs(), PNS::LINE_PLACER::mergeHead(), PNS::OPTIMIZER::mergeObtuse(), PNS::MEANDER_SHAPE::miter(), PNS::DP_MEANDER_PLACER::Move(), PNS::NODE::NearestObstacle(), PNS::OctagonalHull(), OffsetLine(), RULE_AREA_CREATE_HELPER::OnComplete(), ZONE_CREATE_HELPER::OnComplete(), PNS::LINE_PLACER::optimizeTailHeadTransition(), SHAPE_RECT::Outline(), CADSTAR_ARCHIVE_PARSER::SHAPE::OutlineAsChain(), SHAPE_POLY_SET::Parse(), PCB_IO_EASYEDAPRO_PARSER::ParseContour(), EASYEDA_PARSER_BASE::ParseLineChains(), PCB_IO_KICAD_SEXPR_PARSER::parseOutlinePoints(), PCB_IO_EASYEDAPRO_PARSER::ParsePoly(), ALTIUM_PCB::ParseRegions6Data(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSymbolShapes(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), partitionPolyIntoRegularCellGrid(), OUTSET_ROUTINE::ProcessItem(), PNS::VIA::PushoutForce(), KIGEOM::RectifyPolygon(), PCB_TUNING_PATTERN::removeToBaseline(), PCB_TUNING_PATTERN::resetToBaseline(), PNS::LINE_PLACER::rhWalkBase(), PNS::LINE_PLACER::routeStep(), PNS::SegmentHull(), SHAPE_LINE_CHAIN(), MARKER_BASE::ShapeToPolygon(), PNS::WALKAROUND::singleStep(), SLC_CASES::SLC_CASES(), Slice(), PNS::OPTIMIZER::smartPadsSingle(), PNS::MEANDER_SHAPE::start(), TestConcaveSquareFillet(), PNS::tightenSegment(), PNS::LINE_PLACER::Trace(), TransformCircleToPolygon(), ROUNDRECT::TransformToPolygon(), SHAPE_RECT::TransformToPolygon(), unfracture(), SHAPE_POLY_SET::unfractureSingle(), kiapi::common::UnpackPolyLine(), and PNS::LINE::Walkaround().

◆ Arc()

◆ ArcCount()

◆ ArcIndex()

◆ Area()

double SHAPE_LINE_CHAIN::Area ( bool  aAbsolute = true) const

Return the area of this chain.

Parameters
aAbsoluteIf true, returns a positive value. Otherwise the value depends on the orientation of the chain

Definition at line 2506 of file shape_line_chain.cpp.

References m_closed, and m_points.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), SHAPE_POLY_SET::Area(), TEARDROP_MANAGER::computeAnchorPoints(), convertToClipper(), convertToClipper2(), ZONE_FILLER::Fill(), FOOTPRINT::GetCoverageArea(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), unfracture(), and SHAPE_POLY_SET::unfractureSingle().

◆ BBox()

const BOX2I SHAPE_LINE_CHAIN::BBox ( int  aClearance = 0) const
inlineoverridevirtual

◆ CalcShape()

◆ CArcs()

const std::vector< SHAPE_ARC > & SHAPE_LINE_CHAIN::CArcs ( ) const
inline
Returns
the vector of stored arcs.

Definition at line 433 of file shape_line_chain.h.

References m_arcs.

Referenced by ROUTER_PREVIEW_ITEM::drawLineChain(), PNS::LINE_PLACER::handlePullback(), Length(), and PNS::LINE_PLACER::mergeHead().

◆ Centre()

virtual VECTOR2I SHAPE::Centre ( ) const
inlinevirtualinherited

Compute a center-of-mass of the shape.

Returns
the center-of-mass point

Definition at line 232 of file shape.h.

References SHAPE::BBox(), and BOX2< Vec >::Centre().

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), Collide(), SCH_EASYEDA_PARSER::ParseSchematic(), and pickSegment().

◆ CheckClearance()

bool SHAPE_LINE_CHAIN::CheckClearance ( const VECTOR2I aP,
const int  aDist 
) const

Check if point aP is closer to (or on) an edge or vertex of the line chain.

Parameters
aPis the point to check.
aDistis the distance in internal units.
Returns
true if the point is equal to or closer than aDist to the line chain.

Definition at line 2017 of file shape_line_chain.cpp.

References SEG::A, SEG::B, CSegment(), SEG::Distance(), m_points, PointCount(), and SegmentCount().

◆ CLastPoint()

const VECTOR2I & SHAPE_LINE_CHAIN::CLastPoint ( ) const
inline

◆ Clear()

◆ ClearArcs()

void SHAPE_LINE_CHAIN::ClearArcs ( )

Remove all arc references in the line chain, resulting in a chain formed only of straight segments.

Any arcs in the chain are removed and only the piecewise linear approximation remains.

Definition at line 996 of file shape_line_chain.cpp.

References convertArc(), and m_arcs.

Referenced by doConvertOutlineToPolygon().

◆ Clone()

SHAPE * SHAPE_LINE_CHAIN::Clone ( ) const
overridevirtual

Return a dynamically allocated copy of the shape.

Return values
copyof the shape

Reimplemented from SHAPE.

Definition at line 2427 of file shape_line_chain.cpp.

References SHAPE_LINE_CHAIN().

Referenced by PCB_TUNING_PATTERN::recoverBaseline().

◆ ClosestPoints() [1/2]

bool SHAPE_LINE_CHAIN::ClosestPoints ( const point_citer aMyStart,
const point_citer aMyEnd,
const point_citer aOtherStart,
const point_citer aOtherEnd,
VECTOR2I aPt0,
VECTOR2I aPt1,
int64_t &  aDistSq 
)
static

◆ ClosestPoints() [2/2]

bool SHAPE_LINE_CHAIN::ClosestPoints ( const SHAPE_LINE_CHAIN aOther,
VECTOR2I aPt0,
VECTOR2I aPt1 
) const

Finds closest points between this and the other line chain.

Doesn't test segments or arcs.

Parameters
aOtherthe line chain to test against.
aPt0closest point on this line chain (output).
aPt1closest point on the other line chain (output).
aDistancedistance between points (output).
Returns
true, if the operation was successful.

Definition at line 798 of file shape_line_chain.cpp.

References ClosestPoints(), and m_points.

Referenced by ClosestPoints().

◆ ClosestSegments()

bool SHAPE_LINE_CHAIN::ClosestSegments ( const VECTOR2I aMyPrevPt,
const point_citer aMyStart,
const point_citer aMyEnd,
const VECTOR2I aOtherPrevPt,
const point_citer aOtherStart,
const point_citer aOtherEnd,
VECTOR2I aPt0,
VECTOR2I aPt1,
int64_t &  aDistSq 
)
static

Definition at line 713 of file shape_line_chain.cpp.

References VECTOR2< int32_t >::ECOORD_MAX, and SEG::NearestPoints().

Referenced by ClosestSegmentsFast().

◆ ClosestSegmentsFast()

bool SHAPE_LINE_CHAIN::ClosestSegmentsFast ( const SHAPE_LINE_CHAIN aOther,
VECTOR2I aPt0,
VECTOR2I aPt1 
) const

Finds closest points between segments of this and the other line chain.

Doesn't guarantee that the points are the absolute closest (use ClosestSegments for that) as there might be edge cases, but it is much faster.

Parameters
aOtherthe line chain to test against.
aPt0closest point on this line chain (output).
aPt1closest point on the other line chain (output).
aDistancedistance between points (output).
Returns
true, if the operation was successful.

Definition at line 552 of file shape_line_chain.cpp.

References ClosestSegments(), VECTOR2< int32_t >::ECOORD_MAX, and m_points.

Referenced by RN_NET::OptimizeRNEdges().

◆ Collide() [1/4]

bool SHAPE_LINE_CHAIN::Collide ( const SEG aSeg,
int  aClearance = 0,
int *  aActual = nullptr,
VECTOR2I aLocation = nullptr 
) const
overridevirtual

Check if segment aSeg lies closer to us than aClearance.

Note: This is overridden as we want to ensure we test collisions with the arcs in this chain as true arcs rather than segment approximations.

Parameters
aSegthe segment to check for collisions with
aClearanceminimum distance that does not qualify as a collision.
aActualan optional pointer to an int to store the actual distance in the event of a collision.
Returns
true, when a collision has been found

Reimplemented from SHAPE_LINE_CHAIN_BASE.

Definition at line 862 of file shape_line_chain.cpp.

References SEG::A, Arc(), ArcCount(), SHAPE_ARC::Collide(), VECTOR2< int32_t >::ECOORD_MAX, GetSegment(), GetSegmentCount(), SHAPE_ARC::GetWidth(), IsArcSegment(), IsClosed(), SEG::NearestPoint(), SHAPE_LINE_CHAIN_BASE::PointInside(), SEG::Square(), and SEG::SquaredDistance().

◆ Collide() [2/4]

bool SHAPE::Collide ( const SHAPE aShape,
int  aClearance,
VECTOR2I aMTV 
) const
virtualinherited

Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.

Parameters
aShapeshape to check collision against
aClearanceminimum clearance
aMTV[out] minimum translation vector
aActual[out] an optional pointer to an int to store the actual distance in the event of a collision.
aLocation[out] an option pointer to a point to store a nearby location in the event of a collision.
Returns
true, if there is a collision.

Reimplemented in SHAPE_COMPOUND, SHAPE_RECT, and SHAPE_SEGMENT.

Definition at line 1172 of file shape_collisions.cpp.

References collideShapes().

◆ Collide() [3/4]

bool SHAPE::Collide ( const SHAPE aShape,
int  aClearance = 0,
int *  aActual = nullptr,
VECTOR2I aLocation = nullptr 
) const
virtualinherited

Reimplemented in SHAPE_ARC, SHAPE_COMPOUND, SHAPE_POLY_SET, SHAPE_RECT, and SHAPE_SEGMENT.

Definition at line 1178 of file shape_collisions.cpp.

References collideShapes().

◆ Collide() [4/4]

bool SHAPE_LINE_CHAIN::Collide ( const VECTOR2I aP,
int  aClearance = 0,
int *  aActual = nullptr,
VECTOR2I aLocation = nullptr 
) const
overridevirtual

Check if point aP lies closer to us than aClearance.

Note: This is overridden as we want to ensure we test collisions with the arcs in this chain as true arcs rather than segment approximations.

Parameters
aPthe point to check for collisions with
aClearanceminimum distance that does not qualify as a collision.
aActualan optional pointer to an int to store the actual distance in the event of a collision.
Returns
true, when a collision has been found

Reimplemented from SHAPE_LINE_CHAIN_BASE.

Definition at line 473 of file shape_line_chain.cpp.

References Arc(), ArcCount(), SHAPE_ARC::Collide(), VECTOR2< int32_t >::ECOORD_MAX, GetSegment(), GetSegmentCount(), SHAPE_ARC::GetWidth(), IsArcSegment(), IsClosed(), SEG::NearestPoint(), SHAPE_LINE_CHAIN_BASE::PointInside(), and SEG::Square().

Referenced by PNS::MEANDERED_LINE::CheckSelfIntersections(), SHAPE_SIMPLE::Collide(), collide(), PCB_TUNING_PATTERN::HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), DRC_RTREE::QueryColliding(), and DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer().

◆ CompareGeometry()

bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN aOther) const

Definition at line 2401 of file shape_line_chain.cpp.

References CPoint(), m_points, and Simplify().

Referenced by PNS::LINE::CompareGeometry().

◆ convertArc()

void SHAPE_LINE_CHAIN::convertArc ( ssize_t  aArcIndex)
protected

Convert an arc to only a point chain by removing the arc and references.

Parameters
aArcIndexindex of the arc to convert to points

Definition at line 293 of file shape_line_chain.cpp.

References m_arcs, m_shapes, alg::run_on_pair(), and SHAPE_IS_PT.

Referenced by ClearArcs(), Remove(), and SetPoint().

◆ convertToClipper()

ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper ( bool  aRequiredOrientation,
std::vector< CLIPPER_Z_VALUE > &  aZValueBuffer,
std::vector< SHAPE_ARC > &  aArcBuffer 
) const
protected

Create a new Clipper path from the SHAPE_LINE_CHAIN in a given orientation.

Definition at line 170 of file shape_line_chain.cpp.

References Area(), CPoint(), m_arcs, m_shapes, PointCount(), Reverse(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ convertToClipper2()

Clipper2Lib::Path64 SHAPE_LINE_CHAIN::convertToClipper2 ( bool  aRequiredOrientation,
std::vector< CLIPPER_Z_VALUE > &  aZValueBuffer,
std::vector< SHAPE_ARC > &  aArcBuffer 
) const
protected

Create a new Clipper2 path from the SHAPE_LINE_CHAIN in a given orientation.

Definition at line 204 of file shape_line_chain.cpp.

References Area(), CPoint(), m_arcs, m_shapes, PointCount(), Reverse(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SHAPE_POLY_SET::inflateLine2().

◆ CPoint()

const VECTOR2I & SHAPE_LINE_CHAIN::CPoint ( int  aIndex) const
inline

Return a reference to a given point in the line chain.

Parameters
aIndexis the index of the point. Negative indexes are from the back.
Returns
a const reference to the point.

Definition at line 407 of file shape_line_chain.h.

References m_points, and PointCount().

Referenced by LABEL_MANAGER::Add(), POLYGON_GEOM_MANAGER::AddPoint(), SHAPE_LINE_CHAIN::POINT_INSIDE_TRACKER::AddPolyline(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyline(), Append(), PNS::LINE::AppendVia(), approximateLineChainWithArcs(), ArePolylineEndPointsNearCircle(), ArePolylineMidPointsNearCircle(), PNS::NODE::AssembleLine(), PNS::TOPOLOGY::AssembleTuningPath(), BOOST_AUTO_TEST_CASE(), boost_test_print_type(), build45DegLeader(), BuildBoardPolygonOutlines(), BuildConvexHull(), PAD::BuildEffectivePolygon(), PAD::buildEffectiveShape(), PNS::LINE_PLACER::buildInitialLine(), SHAPE_POLY_SET::chamferFilletPolygon(), PNS::LINE::ChangedArea(), PNS::AREA_CONSTRAINT::Check(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), CN_VISITOR::checkZoneZoneConnection(), collide(), CompareGeometry(), ZONE_FILLER::connect_nearby_polys(), EDA_SHAPE::continueEdit(), convertPolygon(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItemOnLayer(), convertToClipper(), convertToClipper2(), PNS::coupledBypass(), PNS::LINE::CPoint(), SHAPE_SIMPLE::CPoint(), VERTEX_SET::createList(), GENCAD_EXPORTER::CreatePadsShapesSection(), PNS::LINE_PLACER::cursorDistMinimum(), doConvertOutlineToPolygon(), PNS::LINE::dragCorner45(), PNS::dragCornerInternal(), KIGFX::PCB_PAINTER::draw(), KIGFX::CAIRO_GAL_BASE::drawPoly(), KIGFX::OPENGL_GAL::DrawPolygon(), KIGFX::OPENGL_GAL::DrawPolyline(), KIGFX::CAIRO_GAL_BASE::DrawSegmentChain(), KIGFX::OPENGL_GAL::DrawSegmentChain(), EDA_SHAPE::endEdit(), EXPORTER_PCB_VRML::ExportVrmlBoard(), EXPORTER_PCB_VRML::ExportVrmlPolygonSet(), DSN::SPECCTRA_DB::fillBOUNDARY(), AR_AUTOPLACER::fillMatrix(), Find(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), PNS::LINE_PLACER::FixRoute(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), GERBER_PLOTTER::FlashPadChamferRoundRect(), DXF_PLOTTER::FlashPadCustom(), HPGL_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), DXF_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadRoundRect(), HPGL_PLOTTER::FlashPadRoundRect(), PSLIKE_PLOTTER::FlashPadRoundRect(), PNS::TOPOLOGY::followTrivialPath(), PCB_IO_KICAD_SEXPR::formatPolyPts(), APERTURE_MACRO::GetApertureMacroShape(), BOARD::GetBoardPolygonOutlines(), PCB_SHAPE::GetFocusPosition(), GetPoint(), SHAPE_SIMPLE::GetPoint(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), PNS::MOUSE_TRAIL_TRACER::GetTrailLeadVector(), PNS::LINE_PLACER::handleSelfIntersections(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), GEOM_TEST::IsOutlineValid(), POLYGON_GEOM_MANAGER::IsSelfIntersecting(), PNS::LINE::LinkVia(), FABMASTER::loadZone(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), makeWireFromChain(), PNS::LINE_PLACER::mergeHead(), PNS::MEANDER_SHAPE::miter(), PNS::DP_MEANDER_PLACER::Move(), PNS::LINE_PLACER::Move(), NearestPoint(), POLYGON_GEOM_MANAGER::NewPointClosesOutline(), OffsetLine(), RULE_AREA_CREATE_HELPER::OnComplete(), ZONE_CREATE_HELPER::OnComplete(), operator!=(), CADSTAR_ARCHIVE_PARSER::SHAPE::OutlineAsChain(), BITMAPCONV_INFO::outputOnePolygon(), kiapi::common::PackPolyLine(), SCH_IO_KICAD_SEXPR_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSymbolShapes(), PlotDrawingSheet(), PLOTTER::PlotPoly(), GERBER_PLOTTER::PlotPoly(), PointAlong(), PNS::pointInside2(), polygon_Convert(), GERBER_DRAW_ITEM::PrintGerberPoly(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DRC_RTREE::QueryColliding(), SHAPE_POLY_SET::RebuildHolesFromContours(), KIGEOM::RectifyPolygon(), RemoveDuplicatePoints(), PNS::LINE_PLACER::removeLoops(), PCB_TUNING_PATTERN::removeToBaseline(), PCB_TUNING_PATTERN::resetToBaseline(), PNS::LINE_PLACER::rhWalkBase(), PNS::DIFF_PAIR_PLACER::routeHead(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), PNS::OPTIMIZER::runSmartPads(), KIGFX::PREVIEW::POLYGON_ITEM::SetPoints(), PNS::shovedArea(), PNS::SHOVE::shoveLineFromLoneVia(), PNS::SHOVE::shoveLineToHullSet(), Simplify2(), PNS::OPTIMIZER::smartPadsSingle(), PNS::COMPONENT_DRAGGER::Start(), PNS::LINE_PLACER::UnfixRoute(), unfracture(), SHAPE_POLY_SET::unfractureSingle(), PNS::MEANDER_SHAPE::updateBaseSegment(), PNS::LINE_PLACER::updatePStart(), PNS::LINE::Walkaround(), HYPERLYNX_EXPORTER::writeNetObjects(), GBR_TO_PCB_EXPORTER::writePcbPolygon(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().

◆ CPoints()

◆ CSegment()

const SEG SHAPE_LINE_CHAIN::CSegment ( int  aIndex) const
inline

Return a constant copy of the aIndex segment in the line chain.

Parameters
aIndexis the index of the segment in the line chain. Negative values are counted from the end (i.e. -1 means the last segment in the line chain).
Returns
a segment at aIndex in the line chain.

Definition at line 377 of file shape_line_chain.h.

References Segment().

Referenced by PNS::NODE::Add(), FEATURES_MANAGER::AddShape(), PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), PNS::ArcHull(), PNS::LINE_PLACER::buildInitialLine(), PNS::LINE::ChangedArea(), PNS::AREA_CONSTRAINT::Check(), PNS::PRESERVE_VERTEX_CONSTRAINT::Check(), CheckClearance(), PNS::NODE::CheckColliding(), PNS::DIFF_PAIR::CheckConnectionAngle(), PNS::checkGap(), PNS::MEANDERED_LINE::CheckSelfIntersections(), PNS::LINE::ClipToNearestObstacle(), collide(), PNS::COST_ESTIMATOR::CornerCost(), PNS::LINE::CountCorners(), PNS::coupledBypass(), PNS::DIFF_PAIR::CoupledLength(), PNS::LINE::CSegment(), PNS::LINE_PLACER::cursorDistMinimum(), PNS::MEANDER_PLACER::doMove(), PNS::dragCornerInternal(), PNS::findCoupledVertices(), PNS::LINE::FindSegment(), FindSegment(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::LINE_PLACER::FixRoute(), EDA_SHAPE::GetLength(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), GetSegment(), SHAPE_SIMPLE::GetSegment(), PNS::LINE_PLACER::handlePullback(), PNS::LINE_PLACER::handleSelfIntersections(), PNS::HullIntersection(), Intersect(), isLine45Degree(), Length(), EDA_SHAPE::makeEffectiveShapes(), SCH_RULE_AREA::MakeEffectiveShapes(), makeWireFromChain(), PNS::OPTIMIZER::mergeColinear(), PNS::OPTIMIZER::mergeDpStep(), PNS::LINE_PLACER::mergeHead(), PNS::OPTIMIZER::mergeObtuse(), PNS::OPTIMIZER::mergeStep(), PNS::NODE::NearestObstacle(), NearestPoint(), NearestSegment(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSchematic(), PathLength(), PointAlong(), KIGFX::VIEW_OVERLAY::Polyline(), KIGEOM::RectifyPolygon(), PNS::LINE_PLACER::reduceTail(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), PNS::SegmentHull(), SelfIntersecting(), SelfIntersectingWithArcs(), PNS::OPTIMIZER::smartPadsSingle(), PNS::LINE::snapDraggedCorner(), PNS::LINE::snapToNeighbourSegments(), Split(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), PNS::tightenSegment(), SHAPE_POLY_SET::unfractureSingle(), and HYPERLYNX_EXPORTER::writeBoardInfo().

◆ CShapes()

const std::vector< std::pair< ssize_t, ssize_t > > & SHAPE_LINE_CHAIN::CShapes ( ) const
inline
Returns
the vector of values indicating shape type and location.

Definition at line 441 of file shape_line_chain.h.

References m_shapes.

Referenced by Append(), BOOST_AUTO_TEST_CASE(), and GEOM_TEST::IsOutlineValid().

◆ Distance() [1/2]

int SHAPE::Distance ( const VECTOR2I aP) const
virtual

Returns the minimum distance from a given point to this shape.

Always returns zero if the point is inside a closed shape and aOutlineOnly is false.

Parameters
aPis the point to test
Returns
the distance from the shape to aP

Reimplemented from SHAPE.

Definition at line 244 of file shape.cpp.

◆ Distance() [2/2]

int SHAPE_LINE_CHAIN::Distance ( const VECTOR2I aP,
bool  aOutlineOnly 
) const
inline

Definition at line 863 of file shape_line_chain.h.

References SHAPE_LINE_CHAIN_BASE::SquaredDistance().

◆ EdgeContainingPoint()

int SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint ( const VECTOR2I aP,
int  aAccuracy = 0 
) const
inherited

Check if point aP lies on an edge or vertex of the line chain.

Parameters
aPpoint to check
Returns
index of the first edge containing the point, otherwise negative

Definition at line 1990 of file shape_line_chain.cpp.

References SEG::A, SEG::B, SEG::Distance(), SHAPE_LINE_CHAIN_BASE::GetPoint(), SHAPE_LINE_CHAIN_BASE::GetPointCount(), SHAPE_LINE_CHAIN_BASE::GetSegment(), SHAPE_LINE_CHAIN_BASE::GetSegmentCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SHAPE_LINE_CHAIN_BASE::PointOnEdge().

◆ Find()

int SHAPE_LINE_CHAIN::Find ( const VECTOR2I aP,
int  aThreshold = 0 
) const

Search for point aP.

Parameters
aPis the point to be looked for.
Returns
the index of the corresponding point in the line chain or negative when not found.

Definition at line 1284 of file shape_line_chain.cpp.

References CPoint(), and PointCount().

Referenced by PNS::DRAGGER::dragViaMarkObstacles(), PNS::DRAGGER::dragViaWalkaround(), PNS::NODE::FindLinesBetweenJoints(), OffsetLine(), PNS::DRAGGER::optimizeAndUpdateDraggedLine(), Split(), PNS::LINE_PLACER::splitHeadTail(), and PNS::LINE::Walkaround().

◆ FindSegment()

int SHAPE_LINE_CHAIN::FindSegment ( const VECTOR2I aP,
int  aThreshold = 1 
) const

Search for segment containing point aP.

Parameters
aPis the point to be looked for.
Returns
index of the corresponding segment in the line chain or negative when not found.

Definition at line 1304 of file shape_line_chain.cpp.

References CSegment(), SEG::Distance(), and SegmentCount().

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets().

◆ fixIndicesRotation()

void SHAPE_LINE_CHAIN::fixIndicesRotation ( )
protected

Fix indices of this chain to ensure arcs are not split between the end and start indices.

Definition at line 238 of file shape_line_chain.cpp.

References ArcIndex(), IsArcStart(), m_points, m_shapes, and SHAPE_IS_PT.

Referenced by mergeFirstLastPointIfNeeded(), and SHAPE_LINE_CHAIN().

◆ Format()

const std::string SHAPE_LINE_CHAIN::Format ( bool  aCplusPlus = true) const
overridevirtual

Reimplemented from SHAPE.

Definition at line 2372 of file shape_line_chain.cpp.

References m_closed, m_points, and PointCount().

Referenced by PNS::SHOVE::shoveLineToHullSet().

◆ GenerateBBoxCache()

void SHAPE_LINE_CHAIN::GenerateBBoxCache ( ) const
inline

◆ GetCachedBBox()

BOX2I * SHAPE_LINE_CHAIN::GetCachedBBox ( ) const
inlineoverridevirtual

Reimplemented from SHAPE_LINE_CHAIN_BASE.

Definition at line 466 of file shape_line_chain.h.

References m_bbox.

◆ GetClearance()

int SHAPE::GetClearance ( const SHAPE aOther) const
inherited

Return the actual minimum distance between two shapes.

Return values
distancein IU

POLY_SETs contain a bunch of polygons that are triangulated. But there are way more triangles than necessary for collision detection. Triangles check three vertices each but for the outline, we only need one. These are also fractured, so we don't need to worry about holes

Definition at line 54 of file shape.cpp.

References SHAPE_POLY_SET::COutline(), SHAPE_BASE::GetIndexableSubshapeCount(), SHAPE_BASE::GetIndexableSubshapes(), SHAPE_POLY_SET::OutlineCount(), and SHAPE_BASE::Type().

◆ GetIndexableSubshapeCount()

virtual size_t SHAPE_BASE::GetIndexableSubshapeCount ( ) const
inlinevirtualinherited

Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.

Definition at line 113 of file shape.h.

Referenced by SHAPE::GetClearance().

◆ GetIndexableSubshapes()

virtual void SHAPE_BASE::GetIndexableSubshapes ( std::vector< const SHAPE * > &  aSubshapes) const
inlinevirtualinherited

Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.

Definition at line 115 of file shape.h.

Referenced by SHAPE_COMPOUND::AddShape(), SHAPE::GetClearance(), and ROUTER_PREVIEW_ITEM::ViewDraw().

◆ GetPoint()

◆ GetPointCount()

◆ GetSegment()

◆ GetSegmentCount()

virtual size_t SHAPE_LINE_CHAIN::GetSegmentCount ( ) const
inlineoverridevirtual

◆ HasIndexableSubshapes()

virtual bool SHAPE_BASE::HasIndexableSubshapes ( ) const
inlinevirtualinherited

Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.

Definition at line 108 of file shape.h.

Referenced by ROUTER_PREVIEW_ITEM::ViewDraw().

◆ Insert() [1/2]

void SHAPE_LINE_CHAIN::Insert ( size_t  aVertex,
const SHAPE_ARC aArc 
)

Step 1: Find the position for the new arc in the existing arc vector

Step 2: Add the arc polyline points to the chain

Step 3: Add the vector of indices to the shape vector

Definition at line 1698 of file shape_line_chain.cpp.

References SHAPE_ARC::ConvertToPolyline(), IsPtOnArc(), m_arcs, m_points, m_shapes, alg::run_on_pair(), SHAPE_ARC::SetWidth(), SHAPES_ARE_PT, and splitArc().

◆ Insert() [2/2]

◆ Intersect() [1/2]

int SHAPE_LINE_CHAIN::Intersect ( const SEG aSeg,
INTERSECTIONS aIp 
) const

Find all intersection points between our line chain and the segment aSeg.

Parameters
aSegis the segment chain to find intersections with.
aIpis the reference to a vector to store found intersections. Intersection points are sorted with increasing distances from point aSeg.a.
Returns
the number of intersections found.

Definition at line 1764 of file shape_line_chain.cpp.

References SEG::A, CSegment(), SHAPE_LINE_CHAIN::INTERSECTION::index_our, SHAPE_LINE_CHAIN::INTERSECTION::index_their, SEG::Intersect(), SHAPE_LINE_CHAIN::INTERSECTION::is_corner_our, SHAPE_LINE_CHAIN::INTERSECTION::is_corner_their, SHAPE_LINE_CHAIN::INTERSECTION::p, SegmentCount(), and SHAPE_LINE_CHAIN::INTERSECTION::valid.

Referenced by ZONE_FILLER::buildThermalSpokes(), PNS::OPTIMIZER::customBreakouts(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), PNS::LINE_PLACER::handleSelfIntersections(), PNS::HullIntersection(), Intersects(), and CADSTAR_SCH_ARCHIVE_LOADER::loadNets().

◆ Intersect() [2/2]

int SHAPE_LINE_CHAIN::Intersect ( const SHAPE_LINE_CHAIN aChain,
INTERSECTIONS aIp,
bool  aExcludeColinearAndTouching = false,
BOX2I aChainBBox = nullptr 
) const

Find all intersection points between our line chain and the line chain aChain.

Parameters
aChainis the line chain to find intersections with.
aIpis reference to a vector to store found intersections. Intersection points are sorted with increasing path lengths from the starting point of aChain.
Returns
the number of intersections found.

Definition at line 1802 of file shape_line_chain.cpp.

References SEG::A, addIntersection(), SEG::B, BBox(), SEG::Collinear(), SEG::Contains(), CSegment(), SHAPE_LINE_CHAIN::INTERSECTION::index_our, SHAPE_LINE_CHAIN::INTERSECTION::index_their, SEG::Intersect(), BOX2< Vec >::Intersects(), SHAPE_LINE_CHAIN::INTERSECTION::is_corner_our, SHAPE_LINE_CHAIN::INTERSECTION::is_corner_their, SHAPE_LINE_CHAIN::INTERSECTION::p, PointCount(), SegmentCount(), and SHAPE_LINE_CHAIN::INTERSECTION::valid.

◆ Intersects()

bool SHAPE_LINE_CHAIN::Intersects ( const SHAPE_LINE_CHAIN aChain) const

Definition at line 2420 of file shape_line_chain.cpp.

References dummy, and Intersect().

Referenced by PNS::DIFF_PAIR::BuildInitial(), and DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run().

◆ IsArcEnd()

bool SHAPE_LINE_CHAIN::IsArcEnd ( size_t  aIndex) const

◆ IsArcSegment()

◆ IsArcStart()

◆ IsClosed()

◆ IsNull()

bool SHAPE::IsNull ( ) const
inlineinherited

Return true if the shape is a null shape.

Return values
trueif null :-)

Definition at line 166 of file shape.h.

References SHAPE_BASE::m_type, and SH_NULL.

◆ IsPtOnArc()

◆ IsSharedPt()

bool SHAPE_LINE_CHAIN::IsSharedPt ( size_t  aIndex) const

Test if a point is shared between multiple shapes.

Parameters
aIndex
Returns

Definition at line 3042 of file shape_line_chain.cpp.

References m_shapes, and SHAPE_IS_PT.

Referenced by ArcIndex(), BOOST_AUTO_TEST_CASE(), IsArcEnd(), IsArcSegment(), IsArcStart(), GEOM_TEST::IsOutlineValid(), mergeFirstLastPointIfNeeded(), Remove(), reversedArcIndex(), and splitArc().

◆ IsSolid()

bool SHAPE_LINE_CHAIN::IsSolid ( ) const
inlineoverridevirtual

Implements SHAPE.

Definition at line 785 of file shape_line_chain.h.

◆ Length()

◆ mergeFirstLastPointIfNeeded()

void SHAPE_LINE_CHAIN::mergeFirstLastPointIfNeeded ( )
protected

Merge the first and last point if they are the same and this chain is closed.

Definition at line 261 of file shape_line_chain.cpp.

References ArcIndex(), fixIndicesRotation(), IsSharedPt(), m_closed, m_points, m_shapes, and SHAPE_IS_PT.

Referenced by Append(), and SetClosed().

◆ Mirror() [1/2]

void SHAPE_LINE_CHAIN::Mirror ( const SEG axis)

Mirror the line points using an given axis.

Parameters
axisis the axis on which to mirror.

Definition at line 1036 of file shape_line_chain.cpp.

References m_arcs, m_points, and SEG::ReflectPoint().

◆ Mirror() [2/2]

void SHAPE_LINE_CHAIN::Mirror ( const VECTOR2I aRef,
FLIP_DIRECTION  aFlipDirection 
)

Mirror the line points about y or x (or both).

Parameters
aRefsets the reference point about which to mirror.
aFlipDirectionis the direction to mirror.

Definition at line 1021 of file shape_line_chain.cpp.

References m_arcs, m_points, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), and PNS::MEANDER_SHAPE::genMeanderShape().

◆ Move()

◆ NearestPoint() [1/2]

const VECTOR2I SHAPE_LINE_CHAIN::NearestPoint ( const SEG aSeg,
int &  dist 
) const

Find a point on the line chain that is closest to the line defined by the points of segment aSeg, also returns the distance.

Parameters
aSegis the segment defining the line.
distis the reference receiving the distance to the nearest point.
Returns
the nearest point.

Definition at line 2325 of file shape_line_chain.cpp.

References CPoint(), SEG::LineDistance(), and PointCount().

◆ NearestPoint() [2/2]

const VECTOR2I SHAPE_LINE_CHAIN::NearestPoint ( const VECTOR2I aP,
bool  aAllowInternalShapePoints = true 
) const

Find a point on the line chain that is closest to point aP.

Parameters
aPis the point to find.
aAllowInternalShapePointsif false will not return points internal to an arc (i.e. only the arc endpoints are possible candidates)
Returns
the nearest point.

Definition at line 2267 of file shape_line_chain.cpp.

References SEG::A, Arc(), ArcIndex(), SEG::B, CSegment(), SEG::Distance(), VECTOR2< T >::EuclideanNorm(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), IsArcEnd(), IsArcSegment(), IsArcStart(), m_points, SEG::NearestPoint(), PointCount(), and SegmentCount().

Referenced by FOOTPRINT::CheckNetTies(), PCB_GRID_HELPER::computeAnchors(), CADSTAR_SCH_ARCHIVE_LOADER::loadBusses(), PNS::MoveDiagonal(), PNS::DRAGGER::optimizeAndUpdateDraggedLine(), pickSegment(), PCB_TUNING_PATTERN::resetToBaseline(), PNS::LINE_PLACER::rhMarkObstacles(), and Split().

◆ NearestSegment()

int SHAPE_LINE_CHAIN::NearestSegment ( const VECTOR2I aP) const

Find the segment nearest the given point.

Parameters
aPis the point to compare with.
Returns
the index of the segment closest to the point.

Definition at line 2352 of file shape_line_chain.cpp.

References CSegment(), SEG::Distance(), and SegmentCount().

Referenced by PNS::LINE::ClipToNearestObstacle(), and SCH_SHEET_PIN::ConstrainOnEdge().

◆ NewFacet()

FACET * SHAPE::NewFacet ( )
inherited

◆ NextShape()

int SHAPE_LINE_CHAIN::NextShape ( int  aPointIndex) const

Return the vertex index of the next shape in the chain, or -1 if aPointIndex is the last shape.

If aPointIndex is the start of a segment, this will be ( aPointIndex + 1 ). If aPointIndex is part of an arc, this will be the index of the start of the next shape after the arc, in other words, the last point of the arc.

Parameters
aPointIndexis a vertex in the chain.
Returns
the vertex index of the start of the next shape after aPoint's shape or -1 if the end was reached.

Definition at line 1347 of file shape_line_chain.cpp.

References ArcIndex(), IsArcSegment(), m_closed, m_shapes, alg::pair_contains(), PointCount(), SHAPE_IS_PT, and SHAPES_ARE_PT.

Referenced by PNS::LINE::ClipVertexRange(), PNS::MEANDER_PLACER::doMove(), ALTIUM_PCB::HelperCreateBoardOutline(), makeWireFromChain(), PNS::DP_MEANDER_PLACER::Move(), kiapi::common::PackPolyLine(), RemoveShape(), SelfIntersectingWithArcs(), ShapeCount(), and Slice().

◆ OffsetLine()

bool SHAPE_LINE_CHAIN::OffsetLine ( int  aAmount,
CORNER_STRATEGY  aCornerStrategy,
int  aMaxError,
SHAPE_LINE_CHAIN aLeft,
SHAPE_LINE_CHAIN aRight,
bool  aSimplify = false 
) const

Creates line chains aLeft and aRight offset to this line chain.

Parameters
aAmountis the amount to offset.
aCornerStrategyis the corner rounding strategy.
aMaxErroris the max error used for rounding.
aLeftleft line chain output.
aRightright line chain output.
aSimplifyset to run Simplify on the inflated polygon.

Definition at line 2817 of file shape_line_chain.cpp.

References Append(), Clear(), SHAPE_POLY_SET::COutline(), CPoint(), Find(), SHAPE_POLY_SET::HasHoles(), IsClosed(), SHAPE_POLY_SET::OffsetLineChain(), SHAPE_POLY_SET::OutlineCount(), PointCount(), Remove(), Reverse(), SEG::Side(), and Split().

Referenced by PCB_TUNING_PATTERN::getOutline().

◆ operator!=()

bool SHAPE_LINE_CHAIN::operator!= ( const SHAPE_LINE_CHAIN aRhs) const
inline

Definition at line 735 of file shape_line_chain.h.

References CPoint(), and PointCount().

◆ operator=()

SHAPE_LINE_CHAIN & SHAPE_LINE_CHAIN::operator= ( const SHAPE_LINE_CHAIN )
default

◆ Parse()

bool SHAPE_LINE_CHAIN::Parse ( std::stringstream &  aStream)
overridevirtual

Reimplemented from SHAPE.

Definition at line 2433 of file shape_line_chain.cpp.

References DEGREES_T, m_arcs, m_closed, m_points, m_shapes, SHAPE_IS_PT, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ PathLength()

int SHAPE_LINE_CHAIN::PathLength ( const VECTOR2I aP,
int  aIndex = -1 
) const

Compute the walk path length from the beginning of the line chain and the point aP belonging to our line.

Returns
the path length in Euclidean metric or -1 if aP does not belong to the line chain.

Definition at line 1899 of file shape_line_chain.cpp.

References SEG::A, CSegment(), SEG::Length(), and SegmentCount().

Referenced by PNS::NODE::NearestObstacle().

◆ PointAlong()

const VECTOR2I SHAPE_LINE_CHAIN::PointAlong ( int  aPathLength) const

◆ PointCount()

int SHAPE_LINE_CHAIN::PointCount ( ) const
inline

Return the number of points (vertices) in this line chain.

Returns
the number of points.

Definition at line 356 of file shape_line_chain.h.

References m_points.

Referenced by LABEL_MANAGER::Add(), PCB_IO_IPC2581::addOutlineNode(), POLYGON_GEOM_MANAGER::AddPoint(), SHAPE_LINE_CHAIN::POINT_INSIDE_TRACKER::AddPolyline(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyline(), Append(), CADSTAR_ARCHIVE_PARSER::VERTEX::AppendToChain(), PNS::LINE::AppendVia(), approximateLineChainWithArcs(), ArePolylineEndPointsNearCircle(), ArePolylineMidPointsNearCircle(), PNS::NODE::AssembleLine(), PNS::TOPOLOGY::AssembleTuningPath(), BOOST_AUTO_TEST_CASE(), boost_test_print_type(), build45DegLeader(), BuildConvexHull(), PAD::BuildEffectivePolygon(), PAD::buildEffectiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), PNS::LINE::ChangedArea(), PNS::AREA_CONSTRAINT::Check(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), CheckClearance(), KI_TEST::CheckShapePolySet(), CN_VISITOR::checkZoneZoneConnection(), CLastPoint(), PNS::LINE::ClipVertexRange(), collide(), convertPolygon(), ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem(), ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItemOnLayer(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItemOnLayer(), convertToClipper(), convertToClipper2(), PNS::coupledBypass(), CPoint(), VERTEX_SET::createList(), GENCAD_EXPORTER::CreatePadsShapesSection(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), PNS::LINE_PLACER::cursorDistMinimum(), POLYGON_GEOM_MANAGER::DeleteLastCorner(), doConvertOutlineToPolygon(), PNS::LINE::dragCornerFree(), PNS::dragCornerInternal(), PNS::LINE::dragSegment45(), PNS::DRAGGER::dragWalkaround(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::CAIRO_GAL_BASE::drawPoly(), KIGFX::OPENGL_GAL::DrawPolygon(), KIGFX::OPENGL_GAL::DrawPolyline(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::CAIRO_GAL_BASE::DrawSegmentChain(), KIGFX::OPENGL_GAL::DrawSegmentChain(), EDA_SHAPE::DupPolyPointsList(), EXPORTER_PCB_VRML::ExportVrmlBoard(), EXPORTER_PCB_VRML::ExportVrmlPolygonSet(), DSN::SPECCTRA_DB::fillBOUNDARY(), AR_AUTOPLACER::fillMatrix(), Find(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), PNS::LINE_PLACER::FixRoute(), GERBER_PLOTTER::FlashPadChamferRoundRect(), DXF_PLOTTER::FlashPadCustom(), HPGL_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), DXF_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadRoundRect(), HPGL_PLOTTER::FlashPadRoundRect(), PSLIKE_PLOTTER::FlashPadRoundRect(), Format(), PCB_IO_KICAD_SEXPR::formatPolyPts(), APERTURE_MACRO::GetApertureMacroShape(), CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes(), GetPointCount(), SHAPE_SIMPLE::GetPointCount(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), SHAPE_POLY_SET::GetRelativeIndices(), PNS::MOUSE_TRAIL_TRACER::GetTrailLeadVector(), PNS::LINE_PLACER::handlePullback(), PNS::LINE_PLACER::handleSelfIntersections(), ALTIUM_PCB::HelperCreateBoardOutline(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), PNS::HullIntersection(), Intersect(), GEOM_TEST::IsOutlineValid(), POLYGON_GEOM_MANAGER::IsPolygonInProgress(), EDA_SHAPE::IsPolyShapeValid(), POLYGON_GEOM_MANAGER::IsSelfIntersecting(), PNS::LINE::LinkVia(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), FABMASTER::loadPolygon(), FABMASTER::loadZone(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), CONVERT_TOOL::makePolysFromChainedSegs(), makeWireFromChain(), PNS::LINE_PLACER::mergeHead(), PNS::OPTIMIZER::mergeObtuse(), PNS::DP_MEANDER_PLACER::Move(), NearestPoint(), POLYGON_GEOM_MANAGER::NewPointClosesOutline(), NextShape(), OffsetLine(), RULE_AREA_CREATE_HELPER::OnComplete(), ZONE_CREATE_HELPER::OnComplete(), operator!=(), PNS::LINE_PLACER::optimizeTailHeadTransition(), BITMAPCONV_INFO::outputOnePolygon(), kiapi::common::PackPolyLine(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), EASYEDA_PARSER_BASE::ParseLineChains(), PCB_IO_EASYEDAPRO_PARSER::ParsePoly(), ALTIUM_PCB::ParsePolygons6Data(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSymbolShapes(), PlotDrawingSheet(), GERBER_PLOTTER::PlotGerberRegion(), PLOTTER::PlotPoly(), GERBER_PLOTTER::PlotPoly(), SHAPE_SIMPLE::PointCount(), PNS::LINE::PointCount(), PNS::pointInside2(), polygon_Convert(), POLYGON_GEOM_MANAGER::PolygonPointCount(), PNS::SHOVE::preShoveCleanup(), GERBER_DRAW_ITEM::PrintGerberPoly(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), Remove(), RemoveDuplicatePoints(), RemoveShape(), Replace(), PNS::OPTIMIZER::runSmartPads(), SetPoint(), KIGFX::PREVIEW::POLYGON_ITEM::SetPoints(), PNS::shovedArea(), PNS::SHOVE::shoveLineFromLoneVia(), PNS::SHOVE::shoveLineToHullSet(), Simplify(), Simplify2(), PNS::TOPOLOGY::SimplifyLine(), PNS::LINE_PLACER::simplifyNewLine(), Slice(), PNS::OPTIMIZER::smartPadsSingle(), splitArc(), PNS::LINE_PLACER::Trace(), PCB_TEXTBOX::TransformShapeToPolygon(), PNS::LINE_PLACER::UnfixRoute(), PNS::LINE_PLACER::updatePStart(), POLYGON_GEOM_MANAGER::updateTemporaryLines(), PNS::LINE::Walkaround(), HYPERLYNX_EXPORTER::writeNetObjects(), GBR_TO_PCB_EXPORTER::writePcbPolygon(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().

◆ PointInside()

bool SHAPE_LINE_CHAIN_BASE::PointInside ( const VECTOR2I aPt,
int  aAccuracy = 0,
bool  aUseBBoxCache = false 
) const
overridevirtualinherited

◆ PointOnEdge()

bool SHAPE_LINE_CHAIN_BASE::PointOnEdge ( const VECTOR2I aP,
int  aAccuracy = 0 
) const
inherited

Check if point aP lies on an edge or vertex of the line chain.

Parameters
aPpoint to check
Returns
true if the point lies on the edge.

Definition at line 1984 of file shape_line_chain.cpp.

References SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint().

Referenced by getPNSLine(), PCB_TUNING_PATTERN::initBaseLine(), FABMASTER::loadZones(), SHAPE_LINE_CHAIN_BASE::PointInside(), PNS::LINE_PLACER::splitHeadTail(), and PNS::LINE::Walkaround().

◆ Remove() [1/2]

void SHAPE_LINE_CHAIN::Remove ( int  aIndex)
inline

Remove the aIndex-th point from the line chain.

Parameters
aIndexis the index of the point to be removed.

Definition at line 582 of file shape_line_chain.h.

References Remove().

◆ Remove() [2/2]

◆ RemoveDuplicatePoints()

void SHAPE_LINE_CHAIN::RemoveDuplicatePoints ( )

Remove the duplicate points from the line chain.

Definition at line 2530 of file shape_line_chain.cpp.

References CPoint(), m_arcs, m_points, m_shapes, PointCount(), Remove(), and SHAPES_ARE_PT.

Referenced by PNS::NODE::AssembleLine().

◆ RemoveShape()

void SHAPE_LINE_CHAIN::RemoveShape ( int  aPointIndex)

Remove the shape at the given index from the line chain.

If the given index is inside an arc, the entire arc will be removed. Otherwise this is equivalent to Remove( aPointIndex ).

Parameters
aPointIndexis the index of the point to remove.

Definition at line 1425 of file shape_line_chain.cpp.

References ArcIndex(), IsArcEnd(), IsArcStart(), m_shapes, NextShape(), PointCount(), Remove(), and SHAPES_ARE_PT.

Referenced by approximateLineChainWithArcs(), BOOST_AUTO_TEST_CASE(), and PNS::LINE_PLACER::handlePullback().

◆ Replace() [1/2]

void SHAPE_LINE_CHAIN::Replace ( int  aStartIndex,
int  aEndIndex,
const SHAPE_LINE_CHAIN aLine 
)

Replace points with indices in range [start_index, end_index] with the points from line chain aLine.

Parameters
aStartIndexis the start of the point range to be replaced (inclusive).
aEndIndexis the end of the point range to be replaced (inclusive).
aLineis the replacement line chain.

Definition at line 1054 of file shape_line_chain.cpp.

References m_arcs, m_points, m_shapes, PointCount(), Remove(), alg::run_on_pair(), and SHAPE_IS_PT.

◆ Replace() [2/2]

void SHAPE_LINE_CHAIN::Replace ( int  aStartIndex,
int  aEndIndex,
const VECTOR2I aP 
)

Replace points with indices in range [start_index, end_index] with a single point aP.

Parameters
aStartIndexis the start of the point range to be replaced (inclusive).
aEndIndexis the end of the point range to be replaced (inclusive).
aPis the replacement point.

Definition at line 1046 of file shape_line_chain.cpp.

References Insert(), m_points, m_shapes, and Remove().

Referenced by PNS::TOPOLOGY::AssembleTuningPath(), BOOST_AUTO_TEST_CASE(), PNS::CORNER_COUNT_LIMIT_CONSTRAINT::Check(), PNS::coupledBypass(), PNS::LINE::dragSegment45(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), PNS::OPTIMIZER::mergeDpStep(), PNS::OPTIMIZER::mergeObtuse(), PNS::LINE_PLACER::optimizeTailHeadTransition(), and PNS::Tighten().

◆ ReservePoints()

void SHAPE_LINE_CHAIN::ReservePoints ( size_t  aSize)
inline

Allocate a number of points all at once (for performance).

Definition at line 495 of file shape_line_chain.h.

References m_points.

Referenced by KIFONT::OUTLINE_FONT::getTextAsGlyphsUnlocked().

◆ Reverse()

◆ reversedArcIndex()

ssize_t SHAPE_LINE_CHAIN::reversedArcIndex ( size_t  aSegment) const
inlineprotected

Return the arc index for the given segment index, looking backwards.

Definition at line 915 of file shape_line_chain.h.

References IsSharedPt(), and m_shapes.

◆ Rotate()

void SHAPE_LINE_CHAIN::Rotate ( const EDA_ANGLE aAngle,
const VECTOR2I aCenter = { 0, 0 } 
)
overridevirtual

Rotate all vertices by a given angle.

Parameters
aCenteris the rotation center.
aAngleis the rotation angle.

Implements SHAPE.

Definition at line 542 of file shape_line_chain.cpp.

References m_arcs, m_points, and RotatePoint().

Referenced by PAD::buildEffectiveShape(), PCB_GRID_HELPER::computeAnchors(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), and PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer().

◆ Segment()

SEG SHAPE_LINE_CHAIN::Segment ( int  aIndex) const

Return a copy of the aIndex-th segment in the line chain.

Parameters
aIndexis the index of the segment in the line chain. Negative values are counted from the end (i.e. -1 means the last segment in the line chain).
Returns
a segment at the aIndex in the line chain.

Definition at line 1332 of file shape_line_chain.cpp.

References m_closed, m_points, and SegmentCount().

Referenced by BuildFootprintPolygonOutlines(), PNS::DIFF_PAIR::CoupledSegmentPairs(), BOARD_ADAPTER::createPadWithMargin(), CSegment(), findEndSegments(), ALTIUM_PCB::HelperCreateBoardOutline(), PCB_SHAPE::Normalize(), PCB_IO_EASYEDAPRO_PARSER::ParsePoly(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), unfracture(), and PCB_TUNING_PATTERN::ViewDraw().

◆ SegmentCount()

int SHAPE_LINE_CHAIN::SegmentCount ( ) const
inline

Return the number of segments in this line chain.

Returns
the number of segments.

Definition at line 314 of file shape_line_chain.h.

References m_closed, and m_points.

Referenced by PNS::NODE::Add(), PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), PNS::NODE::AssembleLine(), build45DegLeader(), BuildFootprintPolygonOutlines(), PNS::LINE_PLACER::buildInitialLine(), PNS::PRESERVE_VERTEX_CONSTRAINT::Check(), CheckClearance(), PNS::NODE::CheckColliding(), PNS::DIFF_PAIR::CheckConnectionAngle(), PNS::checkGap(), PNS::MEANDERED_LINE::CheckSelfIntersections(), collide(), PNS::COST_ESTIMATOR::CornerCost(), PNS::LINE::CountCorners(), PNS::DIFF_PAIR::CoupledLength(), PNS::DIFF_PAIR::CoupledSegmentPairs(), BOARD_ADAPTER::createPadWithMargin(), PNS::LINE_PLACER::cursorDistMinimum(), PNS::MEANDER_PLACER::doMove(), PNS::LINE::dragCorner45(), PNS::dragCornerInternal(), PNS::LINE::dragSegment45(), KIGFX::OPENGL_GAL::DrawPolygon(), DRAWING_TOOL::DrawVia(), PNS::DIFF_PAIR::Empty(), PNS::findCoupledVertices(), findEndSegments(), PNS::LINE::FindSegment(), FindSegment(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::LINE_PLACER::FixRoute(), GetSegmentCount(), SHAPE_SIMPLE::GetSegmentCount(), PNS::LINE_PLACER::handlePullback(), PNS::DIFF_PAIR_PLACER::HasPlacedAnything(), PNS::DP_MEANDER_PLACER::HasPlacedAnything(), PNS::HullIntersection(), Intersect(), isLine45Degree(), Length(), EDA_SHAPE::makeEffectiveShapes(), SCH_RULE_AREA::MakeEffectiveShapes(), PNS::OPTIMIZER::mergeColinear(), PNS::OPTIMIZER::mergeDpSegments(), PNS::OPTIMIZER::mergeDpStep(), PNS::OPTIMIZER::mergeFull(), PNS::OPTIMIZER::mergeObtuse(), PNS::OPTIMIZER::mergeStep(), NearestPoint(), NearestSegment(), PCB_SHAPE::Normalize(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParsePoly(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSchematic(), PathLength(), PointAlong(), PNS::pointInside2(), KIGFX::VIEW_OVERLAY::Polyline(), KIGEOM::RectifyPolygon(), PNS::LINE_PLACER::reduceTail(), Segment(), PNS::LINE::SegmentCount(), SelfIntersecting(), SelfIntersectingWithArcs(), Slice(), PNS::OPTIMIZER::smartPadsSingle(), PNS::LINE::snapDraggedCorner(), PNS::LINE::snapToNeighbourSegments(), Split(), STROKE_PARAMS::Stroke(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), PNS::Tighten(), EDA_SHAPE::TransformShapeToPolygon(), PCB_TEXTBOX::TransformShapeToPolygon(), SHAPE_POLY_SET::unfractureSingle(), PCB_TUNING_PATTERN::ViewDraw(), PNS::LINE::Walkaround(), and HYPERLYNX_EXPORTER::writeBoardInfo().

◆ SelfIntersecting()

const std::optional< SHAPE_LINE_CHAIN::INTERSECTION > SHAPE_LINE_CHAIN::SelfIntersecting ( ) const

Check if the line chain is self-intersecting.

Only processes line segments (not arcs).

Returns
(optional) first found self-intersection point.

Definition at line 2039 of file shape_line_chain.cpp.

References SEG::A, SEG::B, CSegment(), SHAPE_LINE_CHAIN::INTERSECTION::index_our, SHAPE_LINE_CHAIN::INTERSECTION::index_their, SEG::Intersect(), IsClosed(), SHAPE_LINE_CHAIN::INTERSECTION::p, and SegmentCount().

Referenced by PNS::DIFF_PAIR::BuildInitial(), and POLYGON_GEOM_MANAGER::IsSelfIntersecting().

◆ SelfIntersectingWithArcs()

◆ SetClosed()

void SHAPE_LINE_CHAIN::SetClosed ( bool  aClosed)
inline

Mark the line chain as closed (i.e.

with a segment connecting the last point with the first point).

Parameters
aClosedwhether the line chain is to be closed or not.

Definition at line 275 of file shape_line_chain.h.

References m_closed, and mergeFirstLastPointIfNeeded().

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), SCH_SHAPE::AddPoint(), ZONE::AddPolygon(), approximateLineChainWithArcs(), PNS::ArcHull(), EDA_SHAPE::beginEdit(), BOOST_AUTO_TEST_CASE(), buildBoardBoundingBoxPoly(), BuildFootprintPolygonOutlines(), KI_TEST::BuildRectChain(), ZONE_FILLER::buildThermalSpokes(), SHAPE_POLY_SET::chamferFilletPolygon(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), collide(), KI_TEST::CommonTestData::CommonTestData(), PCB_GRID_HELPER::computeAnchors(), ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer(), ConvertImageToPolygons(), convertPolygon(), ConvertPolygonToBlocks(), KIGEOM::ConvertToChain(), CADSTAR_ARCHIVE_PARSER::SHAPE::ConvertToPolySet(), PNS::ConvexHull(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), doConvertOutlineToPolygon(), KIGFX::GERBVIEW_PAINTER::draw(), EDA_SHAPE::endEdit(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), fractureSingleCacheFriendly(), fractureSingleSlow(), CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes(), PCB_TUNING_PATTERN::getOutline(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), KIFONT::OUTLINE_FONT::getTextAsGlyphsUnlocked(), HelperShapeLineChainFromAltiumVertices(), POLYGON_GEOM_MANAGER::IsSelfIntersecting(), IteratorFixture::IteratorFixture(), FABMASTER::loadZone(), CONVERT_TOOL::makePolysFromChainedSegs(), SHAPE_POLY_SET::NewHole(), SHAPE_POLY_SET::NewOutline(), PNS::OctagonalHull(), ZONE_CREATE_HELPER::OnComplete(), SHAPE_RECT::Outline(), CADSTAR_ARCHIVE_PARSER::SHAPE::OutlineAsChain(), PCB_IO_EAGLE::packagePolygon(), SHAPE_POLY_SET::Parse(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), EASYEDA_PARSER_BASE::ParseLineChains(), PCB_IO_EASYEDAPRO_PARSER::ParsePoly(), ALTIUM_PCB::ParseRegions6Data(), PCB_IO_KICAD_SEXPR_PARSER::parseRenderCache(), SCH_IO_KICAD_SEXPR_PARSER::parseSchRuleArea(), SCH_EASYEDA_PARSER::ParseSymbolShapes(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), PCB_IO_KICAD_SEXPR_PARSER::parseZONE(), BRDITEMS_PLOTTER::PlotShape(), polygonArea(), OUTSET_ROUTINE::ProcessItem(), KIGEOM::RectifyPolygon(), RENDER_3D_OPENGL::reload(), Remove(), DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), PNS::SegmentHull(), SHAPE_LINE_CHAIN(), SHAPE_POLY_SET::SHAPE_POLY_SET(), SHAPE_SIMPLE::SHAPE_SIMPLE(), MARKER_BASE::ShapeToPolygon(), SLC_CASES::SLC_CASES(), TestConcaveSquareFillet(), TransformCircleToPolygon(), ROUNDRECT::TransformToPolygon(), SHAPE_RECT::TransformToPolygon(), unfracture(), SHAPE_POLY_SET::unfractureSingle(), and kiapi::common::UnpackPolyLine().

◆ SetPoint()

void SHAPE_LINE_CHAIN::SetPoint ( int  aIndex,
const VECTOR2I aPos 
)

Move a point to a specific location.

Parameters
aIndexis the index of the point to move. Negative indexes are from the back.
aPosis the new absolute location of the point.

Definition at line 1407 of file shape_line_chain.cpp.

References convertArc(), m_points, m_shapes, PointCount(), alg::run_on_pair(), and SHAPE_IS_PT.

Referenced by PNS::LINE_PLACER::buildInitialLine(), EDA_SHAPE::calcEdit(), PNS::LINE::dragCornerFree(), APERTURE_MACRO::GetApertureMacroShape(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), and EE_POINT_EDITOR::removeCorner().

◆ SetWidth()

void SHAPE_LINE_CHAIN::SetWidth ( int  aWidth)
inline

◆ ShapeCount()

int SHAPE_LINE_CHAIN::ShapeCount ( ) const

Return the number of shapes (line segments or arcs) in this line chain.

This is kind of like SegmentCount() but will only count arcs as 1 segment.

Returns
ArcCount() + the number of non-arc segments.

Definition at line 1316 of file shape_line_chain.cpp.

References m_points, m_shapes, and NextShape().

Referenced by BOOST_AUTO_TEST_CASE(), PNS::LINE_PLACER::mergeHead(), PNS::LINE_PLACER::optimizeTailHeadTransition(), and PNS::LINE::ShapeCount().

◆ Simplify()

◆ Simplify2()

◆ Slice()

const SHAPE_LINE_CHAIN SHAPE_LINE_CHAIN::Slice ( int  aStartIndex,
int  aEndIndex = -1 
) const

◆ Split() [1/2]

int SHAPE_LINE_CHAIN::Split ( const VECTOR2I aP,
bool  aExact = false 
)

Insert the point aP belonging to one of the our segments, splitting the adjacent segment in two.

Parameters
aPis the point to be inserted.
aExactset to skip the split logic when an exact point match exists.
Returns
index of the newly inserted point (or a negative value if aP does not lie on our line).

Definition at line 1228 of file shape_line_chain.cpp.

References SEG::A, ArcIndex(), SEG::B, CSegment(), SEG::Distance(), Find(), GetPoint(), Insert(), IsArcSegment(), m_points, m_shapes, SegmentCount(), SHAPE_IS_PT, and splitArc().

Referenced by BOOST_AUTO_TEST_CASE(), PNS::LINE_PLACER::clipAndCheckCollisions(), PNS::LINE::ClipToNearestObstacle(), PNS::clipToOtherLine(), PNS::MEANDER_PLACER::doMove(), PCB_TUNING_PATTERN::initBaseLine(), PNS::DP_MEANDER_PLACER::Move(), OffsetLine(), PNS::DRAGGER::optimizeAndUpdateDraggedLine(), PCB_TUNING_PATTERN::removeToBaseline(), PCB_TUNING_PATTERN::resetToBaseline(), Split(), PNS::LINE_PLACER::splitHeadTail(), and PNS::LINE::Walkaround().

◆ Split() [2/2]

void SHAPE_LINE_CHAIN::Split ( const VECTOR2I aStart,
const VECTOR2I aEnd,
SHAPE_LINE_CHAIN aPre,
SHAPE_LINE_CHAIN aMid,
SHAPE_LINE_CHAIN aPost 
) const

Extract parts of this line chain, depending on the starting and ending points.

Parameters
aStartfirst split point.
aEndsecond split point.
aPrepart before the aStart point.
aMidpart between aStart and aEnd.
aPostpart after the aEnd point.

Definition at line 2687 of file shape_line_chain.cpp.

References Find(), NearestPoint(), Reverse(), Slice(), and Split().

◆ splitArc()

void SHAPE_LINE_CHAIN::splitArc ( ssize_t  aPtIndex,
bool  aCoincident = false 
)
protected

Splits an arc into two arcs at aPtIndex.

Parameter aCoincident controls whether the two arcs are to be coincident at aPtIndex or whether a short straight segment should be created instead

Parameters
aPtIndexindex of the point in the chain in which to split the arc
aCoincidentIf true, the end point of the first arc will be coincident with the start point of the second arc at aPtIndex. If false, the end point of the first arc will be at aPtIndex-1 and the start point of the second arc will be at aPtIndex, resulting in a short straight line segment between aPtIndex-1 and aPtIndex.

Definition at line 339 of file shape_line_chain.cpp.

References amendArc(), ArcIndex(), SHAPE_ARC::ConstructFromStartEndCenter(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), IsArcEnd(), IsArcStart(), SHAPE_ARC::IsClockwise(), IsPtOnArc(), IsSharedPt(), m_arcs, m_points, m_shapes, PointCount(), alg::run_on_pair(), SHAPE_IS_PT, and SHAPES_ARE_PT.

Referenced by Insert(), Remove(), and Split().

◆ SquaredDistance()

SEG::ecoord SHAPE_LINE_CHAIN_BASE::SquaredDistance ( const VECTOR2I aP,
bool  aOutlineOnly = false 
) const
overridevirtualinherited

◆ TransformToPolygon()

void SHAPE_LINE_CHAIN::TransformToPolygon ( SHAPE_POLY_SET aBuffer,
int  aError,
ERROR_LOC  aErrorLoc 
) const
overridevirtual

Fills a SHAPE_POLY_SET with a polygon representation of this shape.

Parameters
aBuffer[out] will be filled with the polygonal representation of this shape.
aErrorcontrols the maximum allowed deviation when converting rounded shapes to segments
aErrorLoccontrols where the error is placed when approximating rounded shapes

Reimplemented from SHAPE_LINE_CHAIN_BASE.

Definition at line 2934 of file shape_line_chain.cpp.

References SHAPE_POLY_SET::AddOutline().

◆ Type()

◆ TypeName()

wxString SHAPE_BASE::TypeName ( ) const
inlineinherited

Definition at line 103 of file shape.h.

References SHAPE_BASE::m_type, and SHAPE_TYPE_asString().

Referenced by Collide().

◆ Width()

int SHAPE_LINE_CHAIN::Width ( ) const
inline

Get the current width of the segments in the chain.

Returns
the width in internal units.

Definition at line 304 of file shape_line_chain.h.

References m_width.

Referenced by PCB_IO_IPC2581::addPackage(), PNS_PCBNEW_DEBUG_DECORATOR::AddPoint(), and PNS::LINE::dragCorner45().

Friends And Related Function Documentation

◆ SHAPE_POLY_SET

friend class SHAPE_POLY_SET
friend

Definition at line 877 of file shape_line_chain.h.

Member Data Documentation

◆ facets

std::list< FACET* > SHAPE::facets
privateinherited

Definition at line 143 of file wrlfacet.h.

Referenced by SHAPE::CalcShape(), and SHAPE::NewFacet().

◆ m_arcs

◆ m_bbox

BOX2I SHAPE_LINE_CHAIN::m_bbox
mutableprivate

cached bounding box

Definition at line 985 of file shape_line_chain.h.

Referenced by Append(), GenerateBBoxCache(), GetCachedBBox(), Move(), and Slice().

◆ m_closed

bool SHAPE_LINE_CHAIN::m_closed
private

◆ m_points

◆ m_shapes

std::vector<std::pair<ssize_t, ssize_t> > SHAPE_LINE_CHAIN::m_shapes
private

Array of indices that refer to the index of the shape if the point is part of a larger shape, e.g.

arc or spline. If the value is -1, the point is just a point.

There can be up to two shapes associated with a single point (e.g. the end point of one arc might be the start point of another).

Generally speaking only the first element of the pair will be populated (i.e. with a value not equal to SHAPE_IS_PT), unless the point is shared between two arc shapes. If the point is shared, then both the first and second element of the pair should be populated.

The second element must always be SHAPE_IS_PT if the first element is SHAPE_IS_PT.

Definition at line 970 of file shape_line_chain.h.

Referenced by Append(), ArcIndex(), Clear(), convertArc(), convertToClipper(), convertToClipper2(), CShapes(), fixIndicesRotation(), Insert(), IsArcSegment(), IsPtOnArc(), IsSharedPt(), mergeFirstLastPointIfNeeded(), NextShape(), Parse(), Remove(), RemoveDuplicatePoints(), RemoveShape(), Replace(), Reverse(), reversedArcIndex(), SetPoint(), SHAPE_LINE_CHAIN(), ShapeCount(), Simplify(), Simplify2(), Slice(), Split(), and splitArc().

◆ m_type

SHAPE_TYPE SHAPE_BASE::m_type
protectedinherited

< type of our shape

Definition at line 119 of file shape.h.

Referenced by SHAPE::Format(), SHAPE::IsNull(), SHAPE_BASE::Type(), and SHAPE_BASE::TypeName().

◆ m_width

int SHAPE_LINE_CHAIN::m_width
private

Width of the segments (for BBox calculations in RTree) TODO Adjust usage of SHAPE_LINE_CHAIN to account for where we need a width and where not Alternatively, we could split the class into a LINE_CHAIN (no width) and SHAPE_LINE_CHAIN that derives from SHAPE as well that does have a width.

Not sure yet on the correct path. TODO Note that we also have SHAPE_SIMPLE which is a closed, filled SHAPE_LINE_CHAIN.

Definition at line 982 of file shape_line_chain.h.

Referenced by BBox(), GenerateBBoxCache(), SetWidth(), and Width().

◆ MIN_PRECISION_IU

const int SHAPE::MIN_PRECISION_IU = 4
staticinherited

This is the minimum precision for all the points in a shape.

Definition at line 131 of file shape.h.

Referenced by BOOST_AUTO_TEST_CASE(), DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), CIRCLE::IntersectLine(), and LINE_FILLET_ROUTINE::ProcessLinePair().

◆ SHAPE_IS_PT

const ssize_t SHAPE_LINE_CHAIN::SHAPE_IS_PT = -1
staticprivate

◆ SHAPES_ARE_PT

const std::pair< ssize_t, ssize_t > SHAPE_LINE_CHAIN::SHAPES_ARE_PT = { SHAPE_IS_PT, SHAPE_IS_PT }
staticprivate

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