Adding conversion from points to arcs

Allows detection of arcs from segments in a SHAPE_LINE_CHAIN, converting
them to SHAPE_ARCs in the chain
This commit is contained in:
Seth Hillbrand 2020-08-13 19:54:08 -07:00 committed by Jon Evans
parent 5b2be906b8
commit 6c224156f5
2 changed files with 21 additions and 0 deletions

View File

@ -609,6 +609,13 @@ public:
*/
SHAPE_LINE_CHAIN& Simplify( bool aRemoveColinear = true );
/**
* Detects arcs in a chain and converts them from segments to true arcs by adding an arc
* and the associated references. The original segment points are not changed.
* @return reference to self
*/
SHAPE_LINE_CHAIN& DetectArcs();
/**
* Convert an arc to only a point chain by removing the arc and references.
*

View File

@ -223,6 +223,20 @@ bool SHAPE_LINE_CHAIN_BASE::Collide( const SEG& aSeg, int aClearance, int* aActu
}
SHAPE_LINE_CHAIN& SHAPE_LINE_CHAIN::DetectArcs()
{
for( int ii = 0; ii < PointCount(); ++ii )
{
if( ssize_t ind = ArcIndex( ii ) >= 0 )
{
const SHAPE_ARC& arc = Arc( ind );
}
}
return *this;
}
const SHAPE_LINE_CHAIN SHAPE_LINE_CHAIN::Reverse() const
{
SHAPE_LINE_CHAIN a( *this );