Searching...
No Matches
convex_hull.cpp File Reference
`#include <geometry/convex_hull.h>`
`#include <geometry/shape_line_chain.h>`
`#include <geometry/shape_poly_set.h>`
`#include <math/vector2d.h>`
`#include <trigo.h>`
`#include <algorithm>`

Go to the source code of this file.

## Typedefs

typedef long long coord2_t

## Functions

static bool compare_point (const VECTOR2I &ref, const VECTOR2I &p)

static coord2_t cross_product (const VECTOR2I &O, const VECTOR2I &A, const VECTOR2I &B)

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.

## ◆ coord2_t

 typedef long long coord2_t

Definition at line 66 of file convex_hull.cpp.

## ◆ BuildConvexHull() [1/3]

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

Calculate the convex hull of a SHAPE_POLY_SET.

Parameters
 aResult is a vector to store the convex polygon. aPolygons is 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
 aResult is a vector to store the convex polygon. aPolygons is the set of polygons. aPosition is the final position of the convex hull. aRotation is the rotation of the convex hull.

Definition at line 140 of file convex_hull.cpp.

## ◆ 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
 aResult is a vector to store the convex polygon. aPoly is the list of points.

Definition at line 87 of file convex_hull.cpp.

References compare_point(), and cross_product().

## ◆ compare_point()

 static bool compare_point ( const VECTOR2I & ref, const VECTOR2I & p )
static

Definition at line 70 of file convex_hull.cpp.

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BuildConvexHull().

## ◆ cross_product()

 static coord2_t cross_product ( const VECTOR2I & O, const VECTOR2I & A, const VECTOR2I & B )
static

Definition at line 79 of file convex_hull.cpp.

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BuildConvexHull().