72 return ref.
x < p.
x || (ref.
x == p.
x && ref.
y < p.
y);
87void BuildConvexHull( std::vector<VECTOR2I>& aResult,
const std::vector<VECTOR2I>& aPoly )
89 std::vector<VECTOR2I> poly = aPoly;
90 int point_count = poly.size();
103 aResult.resize( 2 * point_count );
106 for(
int ii = 0; ii < point_count; ++ii )
108 while( k >= 2 &&
cross_product( aResult[k - 2], aResult[k - 1], poly[ii] ) <= 0 )
111 aResult[k++] = poly[ii];
115 for(
int ii = point_count - 2, t = k + 1; ii >= 0; ii-- )
117 while( k >= t &&
cross_product( aResult[k - 2], aResult[k - 1], poly[ii] ) <= 0 )
120 aResult[k++] = poly[ii];
127 if( k > 1 && aResult[0] == aResult[k - 1] )
144 std::vector<VECTOR2I> buf;
146 for(
int cnt = 0; cnt < aPolygons.
OutlineCount(); cnt++ )
150 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
158 for(
unsigned ii = 0; ii < aResult.size(); ii++ )
161 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