68 return ref.
x < p.
x || (ref.
x == p.
x && ref.
y < p.
y);
83void BuildConvexHull( std::vector<VECTOR2I>& aResult,
const std::vector<VECTOR2I>& aPoly )
85 std::vector<VECTOR2I> poly = aPoly;
86 int point_count = poly.size();
99 aResult.resize( 2 * point_count );
102 for(
int ii = 0; ii < point_count; ++ii )
104 while( k >= 2 &&
cross_product( aResult[k - 2], aResult[k - 1], poly[ii] ) <= 0 )
107 aResult[k++] = poly[ii];
111 for(
int ii = point_count - 2, t = k + 1; ii >= 0; ii-- )
113 while( k >= t &&
cross_product( aResult[k - 2], aResult[k - 1], poly[ii] ) <= 0 )
116 aResult[k++] = poly[ii];
123 if( k > 1 && aResult[0] == aResult[k - 1] )
140 std::vector<VECTOR2I> buf;
142 for(
int cnt = 0; cnt < aPolygons.
OutlineCount(); cnt++ )
146 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
154 for(
unsigned ii = 0; ii < aResult.size(); ii++ )
157 aResult[ii] += aPosition;
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
static coord2_t cross_product(const VECTOR2I &O, const VECTOR2I &A, const VECTOR2I &B)
static bool compare_point(const VECTOR2I &ref, const VECTOR2I &p)
void BuildConvexHull(std::vector< VECTOR2I > &aResult, const std::vector< VECTOR2I > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
static constexpr EDA_ANGLE ANGLE_0
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I