KiCad PCB EDA Suite
Loading...
Searching...
No Matches
convex_hull.h File Reference
#include <vector>
#include <math/vector2d.h>
#include <geometry/eda_angle.h>

Go to the source code of this file.

Functions

void BuildConvexHull (std::vector< VECTOR2I > &aResult, const std::vector< VECTOR2I > &aPoly)
 Calculate the convex hull of a list of points in counter-clockwise order.
 
void BuildConvexHull (std::vector< VECTOR2I > &aResult, const SHAPE_POLY_SET &aPolygons)
 Calculate the convex hull of a SHAPE_POLY_SET.
 
void BuildConvexHull (std::vector< VECTOR2I > &aResult, const SHAPE_POLY_SET &aPolygons, const VECTOR2I &aPosition, const EDA_ANGLE &aRotation)
 Calculate the convex hull (rotated and moved) of a SHAPE_POLY_SET.
 

Function Documentation

◆ BuildConvexHull() [1/3]

void BuildConvexHull ( std::vector< VECTOR2I > &  aResult,
const SHAPE_POLY_SET aPolygons 
)

Calculate the convex hull of a SHAPE_POLY_SET.

Parameters
aResultis a vector to store the convex polygon.
aPolygonsis the SHAPE_POLY_SET.

Definition at line 134 of file convex_hull.cpp.

References ANGLE_0, and BuildConvexHull().

◆ BuildConvexHull() [2/3]

void BuildConvexHull ( std::vector< VECTOR2I > &  aResult,
const SHAPE_POLY_SET aPolygons,
const VECTOR2I aPosition,
const EDA_ANGLE aRotation 
)

Calculate the convex hull (rotated and moved) of a SHAPE_POLY_SET.

Parameters
aResultis a vector to store the convex polygon.
aPolygonsis the set of polygons.
aPositionis the final position of the convex hull.
aRotationis the rotation of the convex hull.

Definition at line 140 of file convex_hull.cpp.

References BuildConvexHull(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ BuildConvexHull() [3/3]

void BuildConvexHull ( std::vector< VECTOR2I > &  aResult,
const std::vector< VECTOR2I > &  aPoly 
)

Calculate the convex hull of a list of points in counter-clockwise order.

Parameters
aResultis a vector to store the convex polygon.
aPolyis the list of points.

Definition at line 87 of file convex_hull.cpp.

References compare_point(), and cross_product().

Referenced by ZONE_FILLER::addKnockout(), BuildConvexHull(), MULTICHANNEL_TOOL::buildRAOutline(), TEARDROP_MANAGER::computeAnchorPoints(), FOOTPRINT::GetBoundingHull(), and DSN::SPECCTRA_DB::makePADSTACK().