72 return ref.x < p.x || (ref.x == p.x && ref.y < p.y);
87 void BuildConvexHull( std::vector<wxPoint>& aResult,
const std::vector<wxPoint>& aPoly )
89 std::vector<wxPoint> 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] )
141 const wxPoint& aPosition,
double aRotation )
144 std::vector<wxPoint> 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;
int OutlineCount() const
Return the number of vertices in a given outline/hole.
static coord2_t cross_product(const wxPoint &O, const wxPoint &A, const wxPoint &B)
void RotatePoint(int *pX, int *pY, double angle)
static bool compare_point(const wxPoint &ref, const wxPoint &p)
void BuildConvexHull(std::vector< wxPoint > &aResult, const std::vector< wxPoint > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
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.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const