KiCad PCB EDA Suite
|
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>
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< INTERSECTION > | INTERSECTIONS |
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_CHAIN & | operator= (const SHAPE_LINE_CHAIN &)=default |
SHAPE * | Clone () 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_CHAIN & | Simplify2 (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 VECTOR2I & | CPoint (int aIndex) const |
Return a reference to a given point in the line chain. | |
const std::vector< VECTOR2I > & | CPoints () const |
const VECTOR2I & | CLastPoint () 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 |
BOX2I * | GetCachedBBox () 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< INTERSECTION > | SelfIntersecting () const |
Check if the line chain is self-intersecting. | |
const std::optional< INTERSECTION > | SelfIntersectingWithArcs () 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_ARC & | Arc (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. | |
FACET * | NewFacet () |
SGNODE * | CalcShape (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< VECTOR2I > | m_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_ARC > | m_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 |
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.
Definition at line 82 of file shape_line_chain.h.
|
protectedinherited |
typedef std::vector<INTERSECTION> SHAPE_LINE_CHAIN::INTERSECTIONS |
Definition at line 151 of file shape_line_chain.h.
typedef std::vector<VECTOR2I>::const_iterator SHAPE_LINE_CHAIN::point_citer |
Definition at line 86 of file shape_line_chain.h.
typedef std::vector<VECTOR2I>::iterator SHAPE_LINE_CHAIN::point_iter |
Definition at line 85 of file shape_line_chain.h.
|
inline |
Initialize an empty line chain.
Definition at line 157 of file shape_line_chain.h.
|
inline |
Definition at line 163 of file shape_line_chain.h.
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::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::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::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::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.
|
inlinevirtual |
Definition at line 187 of file shape_line_chain.h.
|
protected |
Definition at line 322 of file shape_line_chain.cpp.
References SHAPE_ARC::ConstructFromStartEndCenter(), SHAPE_ARC::GetCenter(), SHAPE_ARC::IsClockwise(), and m_arcs.
Referenced by amendArcEnd(), amendArcStart(), and splitArc().
|
inlineprotected |
Definition at line 907 of file shape_line_chain.h.
References amendArc(), and m_arcs.
|
inlineprotected |
Definition at line 902 of file shape_line_chain.h.
References amendArc(), and m_arcs.
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().
void SHAPE_LINE_CHAIN::Append | ( | const SHAPE_ARC & | aArc, |
double | aAccuracy | ||
) |
Definition at line 1658 of file shape_line_chain.cpp.
References Append(), SHAPE_ARC::ConvertToPolyline(), m_arcs, m_points, m_shapes, and PointCount().
void SHAPE_LINE_CHAIN::Append | ( | const SHAPE_LINE_CHAIN & | aOtherLine | ) |
Append another line chain at the end.
aOtherLine | is 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.
|
inline |
Append a new point at the end of the line chain.
aP | is the new point. |
aAllowDuplication | set 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.
|
inline |
Append a new point at the end of the line chain.
aX | is X coordinate of the new point. |
aY | is Y coordinate of the new point. |
aAllowDuplication | set 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().
|
inline |
Definition at line 841 of file shape_line_chain.h.
References m_arcs.
Referenced by PNS::NODE::Add(), approximateLineChainWithArcs(), BOOST_AUTO_TEST_CASE(), Collide(), Collide(), PNS::MEANDER_PLACER::doMove(), PNS::LINE_PLACER::FixRoute(), PCB_IO_KICAD_SEXPR::formatPolyPts(), ALTIUM_PCB::HelperCreateBoardOutline(), IsArcEnd(), IsArcStart(), GEOM_TEST::IsOutlineValid(), makeWireFromChain(), PNS::DP_MEANDER_PLACER::Move(), NearestPoint(), kiapi::common::PackPolyLine(), GERBER_PLOTTER::PlotPoly(), SelfIntersectingWithArcs(), and Slice().
|
inline |
Definition at line 825 of file shape_line_chain.h.
References m_arcs.
Referenced by PNS::NODE::Add(), PNS::LINE::ArcCount(), BOOST_AUTO_TEST_CASE(), KI_TEST::CheckShapePolySet(), Collide(), Collide(), ROUTER_PREVIEW_ITEM::drawLineChain(), PNS::LINE_PLACER::FixRoute(), and Length().
|
inline |
Return the arc index for the given segment index.
Definition at line 833 of file shape_line_chain.h.
References IsSharedPt(), and m_shapes.
Referenced by Append(), approximateLineChainWithArcs(), PNS::NODE::AssembleLine(), PNS::MEANDER_PLACER::doMove(), fixIndicesRotation(), PNS::LINE_PLACER::FixRoute(), PCB_IO_KICAD_SEXPR::formatPolyPts(), PNS::LINE_PLACER::handlePullback(), ALTIUM_PCB::HelperCreateBoardOutline(), IsArcEnd(), IsArcSegment(), IsArcStart(), GEOM_TEST::IsOutlineValid(), makeWireFromChain(), mergeFirstLastPointIfNeeded(), PNS::LINE_PLACER::mergeHead(), PNS::DP_MEANDER_PLACER::Move(), NearestPoint(), NextShape(), kiapi::common::PackPolyLine(), GERBER_PLOTTER::PlotPoly(), RemoveShape(), SelfIntersectingWithArcs(), Slice(), Split(), and splitArc().
double SHAPE_LINE_CHAIN::Area | ( | bool | aAbsolute = true | ) | const |
Return the area of this chain.
aAbsolute | If 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().
|
inlineoverridevirtual |
Compute a bounding box of the shape, with a margin of aClearance a collision.
aClearance | how much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape. |
Implements SHAPE.
Definition at line 447 of file shape_line_chain.h.
References BOX2< Vec >::Compute(), BOX2< Vec >::Inflate(), m_points, and m_width.
Referenced by SHAPE_SIMPLE::BBox(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), AR_AUTOPLACER::fillMatrix(), POLYGON_TEST::FindPairs(), PCB_TUNING_PATTERN::GetBoundingBox(), Intersect(), FABMASTER::loadZones(), PNS::NODE::NearestObstacle(), RN_NET::OptimizeRNEdges(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PNS::LINE_PLACER::rhMarkObstacles(), PNS::WALKAROUND::singleStep(), PNS::COMPONENT_DRAGGER::Start(), POLYGON_TRIANGULATION::TesselatePolygon(), and DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer().
|
inherited |
Definition at line 703 of file wrlfacet.cpp.
References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), SHAPE::facets, IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COLORS::SetColorList(), IFSG_COORDS::SetCoordsList(), IFSG_NORMALS::SetNormalList(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by WRL2FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL1FACESET::TranslateToSG().
|
inline |
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().
|
inlinevirtualinherited |
Compute a center-of-mass of the shape.
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().
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.
aP | is the point to check. |
aDist | is the distance in internal units. |
Definition at line 2017 of file shape_line_chain.cpp.
References SEG::A, SEG::B, CSegment(), SEG::Distance(), m_points, PointCount(), and SegmentCount().
|
inline |
Return the last point in the line chain.
Definition at line 425 of file shape_line_chain.h.
References m_points, and PointCount().
Referenced by CreepageGraph::Addshape(), BOOST_AUTO_TEST_CASE(), PNS::DP_GATEWAYS::buildDpContinuation(), EDA_SHAPE::continueEdit(), POLYGON_GEOM_MANAGER::DeleteLastCorner(), EDA_SHAPE::endEdit(), and POLYGON_GEOM_MANAGER::updateTemporaryLines().
|
inline |
Remove all points from the line chain.
Definition at line 261 of file shape_line_chain.h.
References m_arcs, m_closed, m_points, and m_shapes.
Referenced by approximateLineChainWithArcs(), PNS::LINE_PLACER::buildInitialLine(), SHAPE_SIMPLE::Clear(), PNS::DIFF_PAIR::Clear(), PNS::LINE::Clear(), PNS::MOUSE_TRAIL_TRACER::Clear(), PNS::LINE::ClipToNearestObstacle(), KI_TEST::CommonTestData::CommonTestData(), PNS::MEANDER_PLACER::doMove(), PNS::LINE_PLACER::FixRoute(), fractureSingleCacheFriendly(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), PNS::LINE_PLACER::handlePullback(), PNS::LINE_PLACER::handleSelfIntersections(), PNS::LINE_PLACER::initPlacement(), IteratorFixture::IteratorFixture(), PNS::TOPOLOGY::LeadingRatLine(), PNS::MEANDER_SHAPE::MakeArc(), PNS::MEANDER_SHAPE::MakeCorner(), DSN::SPECCTRA_DB::makeIMAGE(), PNS::DP_MEANDER_PLACER::Move(), PNS::NODE::NearestObstacle(), OffsetLine(), PNS::SHOVE::onReverseCollidingVia(), PNS::LINE_PLACER::optimizeTailHeadTransition(), EASYEDA_PARSER_BASE::ParseLineChains(), PNS::LINE_PLACER::reduceTail(), POLYGON_GEOM_MANAGER::Reset(), PNS::LINE_PLACER::SetLayer(), PNS::WALKAROUND::singleStep(), PNS::MEANDER_SHAPE::start(), PNS::tightenSegment(), PNS::LINE_PLACER::UnfixRoute(), and POLYGON_GEOM_MANAGER::updateTemporaryLines().
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().
|
overridevirtual |
Return a dynamically allocated copy of the shape.
copy | of 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().
|
static |
Definition at line 765 of file shape_line_chain.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, VECTOR2< T >::x, and VECTOR2< T >::y.
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.
aOther | the line chain to test against. |
aPt0 | closest point on this line chain (output). |
aPt1 | closest point on the other line chain (output). |
aDistance | distance between points (output). |
Definition at line 798 of file shape_line_chain.cpp.
References ClosestPoints(), and m_points.
Referenced by ClosestPoints().
|
static |
Definition at line 713 of file shape_line_chain.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, and SEG::NearestPoints().
Referenced by 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.
aOther | the line chain to test against. |
aPt0 | closest point on this line chain (output). |
aPt1 | closest point on the other line chain (output). |
aDistance | distance between points (output). |
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().
|
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.
aSeg | the segment to check for collisions with |
aClearance | minimum distance that does not qualify as a collision. |
aActual | an optional pointer to an int to store the actual distance in the event of a collision. |
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().
|
virtualinherited |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
aShape | shape to check collision against |
aClearance | minimum 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. |
Reimplemented in SHAPE_COMPOUND, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 1172 of file shape_collisions.cpp.
References collideShapes().
|
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().
|
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.
aP | the point to check for collisions with |
aClearance | minimum distance that does not qualify as a collision. |
aActual | an optional pointer to an int to store the actual distance in the event of a collision. |
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().
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().
|
protected |
Convert an arc to only a point chain by removing the arc and references.
aArcIndex | index 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().
|
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.
|
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().
|
inline |
Return a reference to a given point in the line chain.
aIndex | is the index of the point. Negative indexes are from the back. |
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().
|
inline |
Definition at line 417 of file shape_line_chain.h.
References m_points.
Referenced by CreepageGraph::Addshape(), PNS::TOPOLOGY::AssembleTuningPath(), BOOST_AUTO_TEST_CASE(), TEARDROP_MANAGER::computeAnchorPoints(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), formatPoly(), PCB_SHAPE::GetCorners(), CONNECTIVITY_DATA::IsConnectedOnLayer(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), FABMASTER::loadZones(), RN_NET::OptimizeRNEdges(), SCH_RULE_AREA::Plot(), SCH_SHAPE::Plot(), GERBER_PLOTTER::PlotPoly(), SCH_SHAPE::Print(), SCH_SHAPE::PrintBackground(), EE_POINT_EDITOR::removeCornerCondition(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), SCH_IO_KICAD_LEGACY_LIB_CACHE::savePolyLine(), EDA_SHAPE::scale(), PNS_KICAD_IFACE_BASE::syncTextItem(), and POLYGON_TRIANGULATION::TesselatePolygon().
|
inline |
Return a constant copy of the aIndex segment in the line chain.
aIndex | is 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). |
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().
|
inline |
Definition at line 441 of file shape_line_chain.h.
References m_shapes.
Referenced by Append(), BOOST_AUTO_TEST_CASE(), and GEOM_TEST::IsOutlineValid().
|
virtual |
|
inline |
Definition at line 863 of file shape_line_chain.h.
References SHAPE_LINE_CHAIN_BASE::SquaredDistance().
|
inherited |
Check if point aP lies on an edge or vertex of the line chain.
aP | point to check |
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().
int SHAPE_LINE_CHAIN::Find | ( | const VECTOR2I & | aP, |
int | aThreshold = 0 |
||
) | const |
Search for point aP.
aP | is the point to be looked for. |
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().
int SHAPE_LINE_CHAIN::FindSegment | ( | const VECTOR2I & | aP, |
int | aThreshold = 1 |
||
) | const |
Search for segment containing point aP.
aP | is the point to be looked for. |
Definition at line 1304 of file shape_line_chain.cpp.
References CSegment(), SEG::Distance(), and SegmentCount().
Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadNets().
|
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().
|
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().
|
inline |
Definition at line 458 of file shape_line_chain.h.
References BOX2< Vec >::Compute(), BOX2< Vec >::Inflate(), m_bbox, m_points, and m_width.
Referenced by SHAPE_POLY_SET::BuildBBoxCaches().
|
inlineoverridevirtual |
Reimplemented from SHAPE_LINE_CHAIN_BASE.
Definition at line 466 of file shape_line_chain.h.
References m_bbox.
|
inherited |
Return the actual minimum distance between two shapes.
distance | in 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().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 113 of file shape.h.
Referenced by SHAPE::GetClearance().
|
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().
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 868 of file shape_line_chain.h.
References CPoint().
Referenced by CADSTAR_ARCHIVE_PARSER::VERTEX::AppendToChain(), PNS::TOPOLOGY::AssembleTuningPath(), BOOST_AUTO_TEST_CASE(), BuildFootprintPolygonOutlines(), KI_TEST::CheckShapePolySet(), POLYGON_GEOM_MANAGER::DeleteLastCorner(), PNS::LINE::dragCornerFree(), CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes(), EDA_SHAPE::hitTest(), CONVERT_TOOL::makePolysFromChainedSegs(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), EE_POINT_EDITOR::removeCorner(), Split(), EDA_SHAPE::TransformShapeToPolygon(), and PCB_TEXTBOX::TransformShapeToPolygon().
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 870 of file shape_line_chain.h.
References PointCount().
Referenced by EE_POINT_EDITOR::addCorner(), EDA_SHAPE::calcEdit(), EDA_SHAPE::continueEdit(), EDA_SHAPE::endEdit(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), SCH_SHAPE::GetItemDescription(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), EDA_SHAPE::hitTest(), EE_POINT_EDITOR::removeCorner(), EE_POINT_EDITOR::removeCornerCondition(), SCH_IO_KICAD_LEGACY_LIB_CACHE::savePolyLine(), and EDA_SHAPE::TransformShapeToPolygon().
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 869 of file shape_line_chain.h.
References CSegment().
Referenced by EE_POINT_EDITOR::addCorner(), Collide(), Collide(), PCB_GRID_HELPER::computeAnchors(), doConvertOutlineToPolygon(), DRAWING_TOOL::DrawVia(), Slice(), STROKE_PARAMS::Stroke(), EDA_SHAPE::TransformShapeToPolygon(), and PCB_TEXTBOX::TransformShapeToPolygon().
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 871 of file shape_line_chain.h.
References SegmentCount().
Referenced by approximateLineChainWithArcs(), Collide(), Collide(), PCB_GRID_HELPER::computeAnchors(), and DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 108 of file shape.h.
Referenced by ROUTER_PREVIEW_ITEM::ViewDraw().
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().
void SHAPE_LINE_CHAIN::Insert | ( | size_t | aVertex, |
const VECTOR2I & | aP | ||
) |
Definition at line 1677 of file shape_line_chain.cpp.
References Append(), IsPtOnArc(), m_points, m_shapes, SHAPES_ARE_PT, and splitArc().
Referenced by EE_POINT_EDITOR::addCorner(), PNS::TOPOLOGY::AssembleTuningPath(), ZONE_FILLER::connect_nearby_polys(), PNS::LINE::dragCorner45(), PNS::LINE::dragCornerFree(), CONVERT_TOOL::makePolysFromChainedSegs(), Replace(), and Split().
int SHAPE_LINE_CHAIN::Intersect | ( | const SEG & | aSeg, |
INTERSECTIONS & | aIp | ||
) | const |
Find all intersection points between our line chain and the segment aSeg.
aSeg | is the segment chain to find intersections with. |
aIp | is the reference to a vector to store found intersections. Intersection points are sorted with increasing distances from point aSeg.a. |
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().
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.
aChain | is the line chain to find intersections with. |
aIp | is reference to a vector to store found intersections. Intersection points are sorted with increasing path lengths from the starting point of aChain. |
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.
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().
bool SHAPE_LINE_CHAIN::IsArcEnd | ( | size_t | aIndex | ) | const |
Definition at line 3092 of file shape_line_chain.cpp.
References Arc(), ArcIndex(), SHAPE_ARC::GetP1(), IsArcSegment(), IsSharedPt(), and m_points.
Referenced by BOOST_AUTO_TEST_CASE(), NearestPoint(), Remove(), RemoveShape(), and splitArc().
bool SHAPE_LINE_CHAIN::IsArcSegment | ( | size_t | aSegment | ) | const |
Definition at line 3056 of file shape_line_chain.cpp.
References ArcIndex(), IsPtOnArc(), IsSharedPt(), m_closed, and m_shapes.
Referenced by PNS::NODE::Add(), Append(), approximateLineChainWithArcs(), PNS::LINE::ClipToNearestObstacle(), Collide(), Collide(), PNS::MEANDER_PLACER::doMove(), PNS::LINE::dragCornerFree(), PNS::LINE_PLACER::handlePullback(), IsArcEnd(), IsArcStart(), isLine45Degree(), Length(), makeWireFromChain(), PNS::LINE_PLACER::mergeHead(), PNS::OPTIMIZER::mergeStep(), PNS::DP_MEANDER_PLACER::Move(), NearestPoint(), NextShape(), PNS::SHOVE::ShoveObstacleLine(), Slice(), and Split().
bool SHAPE_LINE_CHAIN::IsArcStart | ( | size_t | aIndex | ) | const |
Definition at line 3078 of file shape_line_chain.cpp.
References Arc(), ArcIndex(), SHAPE_ARC::GetP0(), IsArcSegment(), IsSharedPt(), and m_points.
Referenced by BOOST_AUTO_TEST_CASE(), fixIndicesRotation(), ALTIUM_PCB::HelperCreateBoardOutline(), makeWireFromChain(), NearestPoint(), Remove(), RemoveShape(), Slice(), and splitArc().
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 284 of file shape_line_chain.h.
References m_closed.
Referenced by SHAPE_POLY_SET::AddOutline(), ZONE::AddPolygon(), approximateLineChainWithArcs(), BOOST_AUTO_TEST_CASE(), BuildFootprintPolygonOutlines(), Collide(), Collide(), KIGFX::CAIRO_GAL_BASE::drawPoly(), KIGFX::OPENGL_GAL::DrawPolyline(), KIGFX::CAIRO_GAL_BASE::DrawSegmentChain(), KIGFX::OPENGL_GAL::DrawSegmentChain(), EDA_SHAPE::hitTest(), EDA_SHAPE::IsClosed(), GEOM_TEST::IsOutlineValid(), EDA_SHAPE::makeEffectiveShapes(), OffsetLine(), kiapi::common::PackPolyLine(), SCH_EASYEDA_PARSER::ParseSymbolShapes(), PLOTTER::PlotPoly(), GERBER_PLOTTER::PlotPoly(), PNS::pointInside2(), KIGEOM::RectifyPolygon(), Remove(), SelfIntersecting(), SelfIntersectingWithArcs(), and DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain().
|
inlineinherited |
Return true if the shape is a null shape.
true | if null :-) |
Definition at line 166 of file shape.h.
References SHAPE_BASE::m_type, and SH_NULL.
bool SHAPE_LINE_CHAIN::IsPtOnArc | ( | size_t | aPtIndex | ) | const |
Definition at line 3050 of file shape_line_chain.cpp.
References m_shapes, and SHAPES_ARE_PT.
Referenced by BOOST_AUTO_TEST_CASE(), PNS::LINE::dragCorner45(), PNS::LINE::dragCornerFree(), PNS::LINE_PLACER::FixRoute(), PNS::LINE_PLACER::handlePullback(), Insert(), IsArcSegment(), PNS::OPTIMIZER::mergeColinear(), PNS::LINE_PLACER::mergeHead(), kiapi::common::PackPolyLine(), Remove(), splitArc(), and PNS::DRAGGER::startDragSegment().
bool SHAPE_LINE_CHAIN::IsSharedPt | ( | size_t | aIndex | ) | const |
Test if a point is shared between multiple shapes.
aIndex |
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().
|
inlineoverridevirtual |
Implements SHAPE.
Definition at line 785 of file shape_line_chain.h.
long long int SHAPE_LINE_CHAIN::Length | ( | ) | const |
Return length of the line chain in Euclidean metric.
Definition at line 1003 of file shape_line_chain.cpp.
References ArcCount(), CArcs(), CSegment(), IsArcSegment(), SEG::Length(), and SegmentCount().
Referenced by PNS::COST_ESTIMATOR::Add(), PNS::LINE_PLACER::clipAndCheckCollisions(), PNS::clipToOtherLine(), PNS::MEANDER_SHAPE::CurrentLength(), PNS::MEANDER_PLACER::doMove(), PNS::LINE::dragSegment45(), PNS::OPTIMIZER::fanoutCleanup(), PNS::DP_MEANDER_PLACER::Move(), PNS::MULTI_DRAGGER::multidragWalkaround(), PNS::SHOVE::onCollidingArc(), PNS::SHOVE::onCollidingSegment(), PNS::COST_ESTIMATOR::Remove(), PNS::COST_ESTIMATOR::Replace(), PNS::LINE_PLACER::rhWalkBase(), PNS::WALKAROUND::Route(), PNS::SHOVE::shoveLineFromLoneVia(), PNS::WALKAROUND::singleStep(), PNS::DIFF_PAIR::Skew(), PNS::OPTIMIZER::smartPadsSingle(), and PNS::DIFF_PAIR::TotalLength().
|
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().
void SHAPE_LINE_CHAIN::Mirror | ( | const SEG & | axis | ) |
Mirror the line points using an given axis.
axis | is the axis on which to mirror. |
Definition at line 1036 of file shape_line_chain.cpp.
References m_arcs, m_points, and SEG::ReflectPoint().
void SHAPE_LINE_CHAIN::Mirror | ( | const VECTOR2I & | aRef, |
FLIP_DIRECTION | aFlipDirection | ||
) |
Mirror the line points about y or x (or both).
aRef | sets the reference point about which to mirror. |
aFlipDirection | is 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().
|
inlineoverridevirtual |
Implements SHAPE.
Definition at line 751 of file shape_line_chain.h.
References m_arcs, m_bbox, m_points, and BOX2< Vec >::Move().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PAD::buildEffectiveShape(), PCB_GRID_HELPER::computeAnchors(), MULTICHANNEL_TOOL::copyRuleAreaContents(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), PCB_SELECTION_TOOL::hitTestDistance(), SHAPE_SIMPLE::Move(), SCH_EASYEDA_PARSER::ParseSchematic(), and PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer().
Find a point on the line chain that is closest to the line defined by the points of segment aSeg, also returns the distance.
aSeg | is the segment defining the line. |
dist | is the reference receiving the distance to the nearest point. |
Definition at line 2325 of file shape_line_chain.cpp.
References CPoint(), SEG::LineDistance(), and PointCount().
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.
aP | is the point to find. |
aAllowInternalShapePoints | if false will not return points internal to an arc (i.e. only the arc endpoints are possible candidates) |
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().
int SHAPE_LINE_CHAIN::NearestSegment | ( | const VECTOR2I & | aP | ) | const |
Find the segment nearest the given point.
aP | is the point to compare with. |
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().
|
inherited |
Definition at line 695 of file wrlfacet.cpp.
References SHAPE::facets.
Referenced by WRL2FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL1FACESET::TranslateToSG().
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.
aPointIndex | is a vertex in the chain. |
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().
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.
aAmount | is the amount to offset. |
aCornerStrategy | is the corner rounding strategy. |
aMaxError | is the max error used for rounding. |
aLeft | left line chain output. |
aRight | right line chain output. |
aSimplify | set 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().
|
inline |
Definition at line 735 of file shape_line_chain.h.
References CPoint(), and PointCount().
|
default |
|
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.
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.
Definition at line 1899 of file shape_line_chain.cpp.
References SEG::A, CSegment(), SEG::Length(), and SegmentCount().
Referenced by PNS::NODE::NearestObstacle().
const VECTOR2I SHAPE_LINE_CHAIN::PointAlong | ( | int | aPathLength | ) | const |
Definition at line 2481 of file shape_line_chain.cpp.
References SEG::A, SEG::B, CPoint(), CSegment(), SEG::Length(), VECTOR2< T >::Resize(), and SegmentCount().
Referenced by PNS::clipToOtherLine().
|
inline |
Return the number of points (vertices) in this line chain.
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().
|
overridevirtualinherited |
Check if point aP lies inside a closed shape.
Always returns false if this shape is not closed.
aPt | point to check |
aUseBBoxCache | gives better performance if the bounding box caches have been generated. |
Reimplemented from SHAPE.
Definition at line 1933 of file shape_line_chain.cpp.
References SHAPE_LINE_CHAIN_BASE::GetCachedBBox(), SHAPE_LINE_CHAIN_BASE::GetPoint(), SHAPE_LINE_CHAIN_BASE::GetPointCount(), SHAPE_LINE_CHAIN_BASE::IsClosed(), SHAPE_LINE_CHAIN_BASE::PointOnEdge(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BuildBoardPolygonOutlines(), Collide(), SHAPE_LINE_CHAIN_BASE::Collide(), Collide(), SHAPE_POLY_SET::containsSingle(), doConvertOutlineToPolygon(), PCB_TUNING_PATTERN::EditPush(), BOARD::GetBoardPolygonOutlines(), ZONE::HitTestCutout(), MARKER_BASE::HitTestMarker(), CONNECTIVITY_DATA::IsConnectedOnLayer(), PNS::SHOVE::onReverseCollidingVia(), SHAPE::PointInside(), SHAPE_POLY_SET::PointInside(), SHAPE_POLY_SET::RebuildHolesFromContours(), PCB_TUNING_PATTERN::recoverBaseline(), KIGEOM::RectifyPolygon(), SHAPE_LINE_CHAIN_BASE::SquaredDistance(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), and PNS::LINE::Walkaround().
|
inherited |
Check if point aP lies on an edge or vertex of the line chain.
aP | point to check |
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().
|
inline |
Remove the aIndex-th point from the line chain.
aIndex | is the index of the point to be removed. |
Definition at line 582 of file shape_line_chain.h.
References Remove().
void SHAPE_LINE_CHAIN::Remove | ( | int | aStartIndex, |
int | aEndIndex | ||
) |
Remove the range of points [start_index, end_index] from the line chain.
aStartIndex | is the start of the point range to be replaced (inclusive). |
aEndIndex | is the end of the point range to be replaced (inclusive). |
Definition at line 1124 of file shape_line_chain.cpp.
References convertArc(), IsArcEnd(), IsArcStart(), IsClosed(), IsPtOnArc(), IsSharedPt(), m_points, m_shapes, PointCount(), alg::run_on_pair(), SetClosed(), SHAPE_IS_PT, and splitArc().
Referenced by POLYGON_GEOM_MANAGER::AddPoint(), PNS::TOPOLOGY::AssembleTuningPath(), PNS::LINE_PLACER::buildInitialLine(), PNS::LINE::ClipToNearestObstacle(), POLYGON_GEOM_MANAGER::DeleteLastCorner(), doConvertOutlineToPolygon(), PNS::MULTI_DRAGGER::Drag(), EDA_SHAPE::endEdit(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::LINE_PLACER::handleSelfIntersections(), PNS::OPTIMIZER::mergeColinear(), PNS::LINE_PLACER::mergeHead(), OffsetLine(), ZONE_CREATE_HELPER::OnComplete(), PNS::LINE_PLACER::reduceTail(), Remove(), EE_POINT_EDITOR::removeCorner(), RemoveDuplicatePoints(), RemoveShape(), Replace(), and Simplify2().
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().
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 ).
aPointIndex | is 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().
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.
aStartIndex | is the start of the point range to be replaced (inclusive). |
aEndIndex | is the end of the point range to be replaced (inclusive). |
aLine | is 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.
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.
aStartIndex | is the start of the point range to be replaced (inclusive). |
aEndIndex | is the end of the point range to be replaced (inclusive). |
aP | is 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().
|
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().
const SHAPE_LINE_CHAIN SHAPE_LINE_CHAIN::Reverse | ( | ) | const |
Reverse point order in the line chain.
Definition at line 957 of file shape_line_chain.cpp.
References m_arcs, m_closed, m_points, m_shapes, SHAPE_ARC::Reverse(), alg::run_on_pair(), SHAPE_IS_PT, and SHAPES_ARE_PT.
Referenced by PNS::ArcHull(), PNS::DP_GATEWAYS::buildEntries(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS::SHOVE::checkShoveDirection(), convertToClipper(), convertToClipper2(), PNS::coupledBypass(), PNS::LINE::dragCorner45(), PCB_TUNING_PATTERN::getOutline(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), OffsetLine(), PNS::DP_GATEWAY::Reverse(), PNS::LINE::Reverse(), PNS::SegmentHull(), PNS::OPTIMIZER::smartPadsSingle(), Split(), POLYGON_GEOM_MANAGER::updateTemporaryLines(), and PNS::LINE::Walkaround().
|
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.
|
overridevirtual |
Rotate all vertices by a given angle.
aCenter | is the rotation center. |
aAngle | is 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().
SEG SHAPE_LINE_CHAIN::Segment | ( | int | aIndex | ) | const |
Return a copy of the aIndex-th segment in the line chain.
aIndex | is 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). |
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().
|
inline |
Return the number of segments in this line chain.
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().
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).
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().
const std::optional< SHAPE_LINE_CHAIN::INTERSECTION > SHAPE_LINE_CHAIN::SelfIntersectingWithArcs | ( | ) | const |
Check if the line chain is self-intersecting.
Also processes arcs. Might be slower.
Definition at line 2101 of file shape_line_chain.cpp.
References SEG::A, Arc(), ArcIndex(), SEG::B, SHAPE_ARC::Collide(), SEG::Contains(), CSegment(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), SHAPE_ARC::GetRadius(), SHAPE_LINE_CHAIN::INTERSECTION::index_our, SHAPE_LINE_CHAIN::INTERSECTION::index_their, SHAPE_ARC::Intersect(), CIRCLE::Intersect(), SEG::Intersect(), BOX2I_MINMAX::Intersects(), IsClosed(), SHAPE_KEY::m_ArcIdx, SHAPE_KEY::m_BBox, SHAPE_KEY::m_FirstIdx, NextShape(), SHAPE_LINE_CHAIN::INTERSECTION::p, and SegmentCount().
Referenced by approximateLineChainWithArcs().
|
inline |
Mark the line chain as closed (i.e.
with a segment connecting the last point with the first point).
aClosed | whether 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().
void SHAPE_LINE_CHAIN::SetPoint | ( | int | aIndex, |
const VECTOR2I & | aPos | ||
) |
Move a point to a specific location.
aIndex | is the index of the point to move. Negative indexes are from the back. |
aPos | is 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().
|
inline |
Set the width of all segments in the chain.
aWidth | is the width in internal units. |
Definition at line 294 of file shape_line_chain.h.
References m_width.
Referenced by PNS_PCBNEW_DEBUG_DECORATOR::AddPoint(), PNS_PCBNEW_DEBUG_DECORATOR::AddShape(), BOOST_AUTO_TEST_CASE(), FOOTPRINT::BuildCourtyardCaches(), doConvertOutlineToPolygon(), POLYGON_BOOLEAN_ROUTINE::Finalize(), PNS::LINE::SetShape(), PNS::DIFF_PAIR::SetWidth(), and PNS::LINE::SetWidth().
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.
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().
void SHAPE_LINE_CHAIN::Simplify | ( | int | aMaxError = 0 | ) |
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
aMaxError | is the maximum error in internal units. Setting to 0 means that the points must be exactly co-linear to be removed. |
Definition at line 2592 of file shape_line_chain.cpp.
References m_closed, m_points, m_shapes, PointCount(), SHAPE_IS_PT, and TestSegmentHit().
Referenced by PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), PNS::DIFF_PAIR_PLACER::attemptWalk(), BOOST_AUTO_TEST_CASE(), DIRECTION_45::BuildInitialTrace(), PNS_LOG_VIEWER_FRAME::buildListTree(), PNS::LINE::ChangedArea(), CompareGeometry(), PNS::DIFF_PAIR::CoupledSegmentPairs(), PNS::MEANDER_PLACER::doMove(), PNS::LINE::dragCornerFree(), PNS::LINE::dragSegment45(), PNS::MOUSE_TRAIL_TRACER::GetPosture(), PNS::LINE_PLACER::mergeHead(), PNS::DP_MEANDER_PLACER::Move(), ZONE_CREATE_HELPER::OnComplete(), PNS::LINE_PLACER::optimizeTailHeadTransition(), KIGEOM::RectifyPolygon(), PCB_TUNING_PATTERN::removeToBaseline(), PCB_TUNING_PATTERN::resetToBaseline(), PNS::LINE_PLACER::rhWalkBase(), PNS::TOPOLOGY::SimplifyLine(), PNS::LINE_PLACER::simplifyNewLine(), PNS::LINE_PLACER::Trace(), and SHAPE_POLY_SET::unfractureSingle().
SHAPE_LINE_CHAIN & SHAPE_LINE_CHAIN::Simplify2 | ( | bool | aRemoveColinear = true | ) |
Definition at line 2716 of file shape_line_chain.cpp.
References CPoint(), m_arcs, m_points, m_shapes, PointCount(), Remove(), and SHAPES_ARE_PT.
Referenced by PNS::CORNER_COUNT_LIMIT_CONSTRAINT::Check(), PNS::OPTIMIZER::mergeDpStep(), PNS::OPTIMIZER::mergeFull(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::preShoveCleanup(), PNS::OPTIMIZER::runSmartPads(), PNS::OPTIMIZER::smartPadsSingle(), and PNS::Tighten().
const SHAPE_LINE_CHAIN 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.
aStartIndex | is the start of the point range to be returned (inclusive). |
aEndIndex | is the end of the point range to be returned (inclusive). |
Definition at line 1457 of file shape_line_chain.cpp.
References Append(), Arc(), ArcIndex(), SHAPE_ARC::ConstructFromStartEndCenter(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), GetSegment(), IsArcSegment(), IsArcStart(), SHAPE_ARC::IsClockwise(), m_arcs, m_bbox, m_points, m_shapes, BOX2< Vec >::Merge(), NextShape(), PointCount(), SegmentCount(), SHAPE_IS_PT, and SHAPE_LINE_CHAIN().
Referenced by PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), approximateLineChainWithArcs(), BOOST_AUTO_TEST_CASE(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS::LINE_PLACER::clipAndCheckCollisions(), PNS::clipToOtherLine(), PNS::LINE::ClipVertexRange(), PNS::LINE::dragCorner45(), PNS::dragCornerInternal(), PNS::LINE_PLACER::optimizeTailHeadTransition(), Split(), PNS::LINE_PLACER::splitHeadTail(), and PNS::Tighten().
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.
aP | is the point to be inserted. |
aExact | set to skip the split logic when an exact point match exists. |
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().
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.
aStart | first split point. |
aEnd | second split point. |
aPre | part before the aStart point. |
aMid | part between aStart and aEnd. |
aPost | part after the aEnd point. |
Definition at line 2687 of file shape_line_chain.cpp.
References Find(), NearestPoint(), Reverse(), Slice(), and Split().
|
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
aPtIndex | index of the point in the chain in which to split the arc |
aCoincident | If 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.
|
overridevirtualinherited |
Reimplemented from SHAPE.
Definition at line 1214 of file shape_line_chain.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, SHAPE_LINE_CHAIN_BASE::GetSegment(), SHAPE_LINE_CHAIN_BASE::GetSegmentCount(), SHAPE_LINE_CHAIN_BASE::IsClosed(), SHAPE_LINE_CHAIN_BASE::PointInside(), and SEG::SquaredDistance().
Referenced by Distance(), and SHAPE::SquaredDistance().
|
overridevirtual |
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
aBuffer | [out] will be filled with the polygonal representation of this shape. |
aError | controls the maximum allowed deviation when converting rounded shapes to segments |
aErrorLoc | controls 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().
|
inlineinherited |
Return the type of the shape.
the | type |
Definition at line 98 of file shape.h.
References SHAPE_BASE::m_type.
Referenced by CreepageGraph::Addshape(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::BuildHullForPrimitiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), SHAPE_POLY_SET::Collide(), Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS_LOG_VIEWER_FRAME::drawSimpleShape(), EDA_SHAPE::EDA_SHAPE(), SHAPE::GetClearance(), PNS::HOLE::Hull(), PNS::SOLID::Hull(), DRC_RTREE::QueryColliding(), PNS::HOLE::Radius(), PNS::HOLE::SetCenter(), PNS::HOLE::SetRadius(), STROKE_PARAMS::Stroke(), and SHAPE_FILE_IO::Write().
|
inlineinherited |
Definition at line 103 of file shape.h.
References SHAPE_BASE::m_type, and SHAPE_TYPE_asString().
Referenced by Collide().
|
inline |
Get the current width of the segments in the chain.
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().
|
friend |
Definition at line 877 of file shape_line_chain.h.
|
privateinherited |
Definition at line 143 of file wrlfacet.h.
Referenced by SHAPE::CalcShape(), and SHAPE::NewFacet().
|
private |
Definition at line 972 of file shape_line_chain.h.
Referenced by amendArc(), amendArcEnd(), amendArcStart(), Append(), Arc(), ArcCount(), CArcs(), Clear(), ClearArcs(), convertArc(), convertToClipper(), convertToClipper2(), Insert(), Mirror(), Move(), Parse(), RemoveDuplicatePoints(), Replace(), Reverse(), Rotate(), SHAPE_LINE_CHAIN(), Simplify2(), Slice(), and splitArc().
|
mutableprivate |
cached bounding box
Definition at line 985 of file shape_line_chain.h.
Referenced by Append(), GenerateBBoxCache(), GetCachedBBox(), Move(), and Slice().
|
private |
is the line chain closed?
Definition at line 975 of file shape_line_chain.h.
Referenced by Area(), Clear(), Format(), IsArcSegment(), IsClosed(), mergeFirstLastPointIfNeeded(), NextShape(), Parse(), Reverse(), Segment(), SegmentCount(), SetClosed(), and Simplify().
|
private |
array of vertices
Definition at line 954 of file shape_line_chain.h.
Referenced by Append(), Area(), BBox(), CheckClearance(), CLastPoint(), Clear(), ClosestPoints(), ClosestSegmentsFast(), CompareGeometry(), CPoint(), CPoints(), fixIndicesRotation(), Format(), GenerateBBoxCache(), Insert(), IsArcEnd(), IsArcStart(), mergeFirstLastPointIfNeeded(), Mirror(), Move(), NearestPoint(), Parse(), PointCount(), Remove(), RemoveDuplicatePoints(), Replace(), ReservePoints(), Reverse(), Rotate(), Segment(), SegmentCount(), SetPoint(), SHAPE_LINE_CHAIN(), ShapeCount(), Simplify(), Simplify2(), Slice(), Split(), and splitArc().
|
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().
|
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().
|
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().
|
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().
|
staticprivate |
Definition at line 949 of file shape_line_chain.h.
Referenced by Append(), convertArc(), fixIndicesRotation(), IsSharedPt(), mergeFirstLastPointIfNeeded(), NextShape(), Parse(), Remove(), Replace(), Reverse(), SetPoint(), SHAPE_LINE_CHAIN(), Simplify(), Slice(), Split(), and splitArc().
|
staticprivate |
Definition at line 951 of file shape_line_chain.h.
Referenced by Append(), Insert(), IsPtOnArc(), NextShape(), RemoveDuplicatePoints(), RemoveShape(), Reverse(), SHAPE_LINE_CHAIN(), Simplify2(), and splitArc().