|
Visual Computing Library
devel
|
List of Core Polygon algorithms. More...

Functions | |
| template<Point2Concept PointType> | |
| bool | vcl::areCounterClockwise (const PointType &p0, const PointType &p1, const PointType &p2) |
| Checks if the three points are counter-clockwise. | |
| template<Point2Concept PointType> | |
| auto | vcl::collinearityTest (const PointType &p0, const PointType &p1, const PointType &p2) |
| Computes the collinearity test between three points. The test returns a positive value if the points are counter-clockwise, a negative value if the points are clockwise, and zero if the points are collinear. | |
| template<Point2IteratorConcept InputIterator> | |
| auto | vcl::convexHull (InputIterator first, InputIterator end) |
| Get the 2D convex hull using Graham scan algorithm on a set of points. | |
| template<Polygon2Concept PolygonType> | |
| PolygonType | vcl::createCircle (uint n, typename PolygonType::ScalarType radius=1.0) |
| Create a 2D circle polygon with n vertices and the given radius. | |
| template<FaceConcept Face> | |
| std::vector< uint > | vcl::earCut (const Face &polygon) |
| Computes the earcut algorithm of a 3D planar polygonal face, that returns a triangulation of the polygon. | |
| template<Point2IteratorConcept Iterator> | |
| std::vector< uint > | vcl::earCut (Iterator begin, Iterator end) |
| Triangulates a simple polygon with no holes using the ear-cutting algorithm. | |
| template<Range R> | |
| std::vector< uint > | vcl::earCut (R &&range) |
| Triangulates a simple polygon with no holes using the ear-cutting algorithm. | |
| template<FaceConcept FaceType> | |
| auto | vcl::faceAngleOnVertexRad (const FaceType &f, uint vi) |
| Returns the internal angle (in radians) of the vi-th vertex of the face. | |
| template<FaceConcept FaceType> | |
| auto | vcl::faceArea (const FaceType &f) |
| Computes the area of a face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces. | |
| template<FaceConcept FaceType> | |
| FaceType::VertexType::PositionType | vcl::faceBarycenter (const FaceType &f) |
| Computes the barycenter of a face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces. | |
| template<FaceConcept FaceType> | |
| FaceType::VertexType::PositionType | vcl::faceNormal (const FaceType &f) |
| Computes the normal of a face, without modifying the face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces. | |
| template<FaceConcept FaceType> | |
| auto | vcl::facePerimeter (const FaceType &f) |
| Computes the perimeter of a face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces. | |
| template<Point2IteratorConcept Iterator> | |
| bool | vcl::isCounterClockWise (Iterator begin, Iterator end) |
| Checks if a set of points that form a polygon are in counter-clockwise order. | |
| template<Point3IteratorConcept Iterator> | |
| auto | vcl::project (Iterator begin, Iterator end) |
| Project a 3D polygon onto a plane, and return the 2D polygon. | |
| template<Range R> requires Point3Concept<std::ranges::range_value_t<R>> | |
| auto | vcl::project (R &&polygon) |
| Project a 3D polygon defined by the given range onto a plane, and return the 2D polygon. | |
| template<Point2IteratorConcept Iterator> | |
| void | vcl::sortConvexPolygonVertices (Iterator begin, Iterator end) |
| Sorts the vertices of a convex polygon in counter-clockwise order. | |
List of Core Polygon algorithms.
| bool vcl::areCounterClockwise | ( | const PointType & | p0, |
| const PointType & | p1, | ||
| const PointType & | p2 | ||
| ) |
Checks if the three points are counter-clockwise.
| PointType | the type of the points that satisfies the Point2Concept. |
| [in] | p0 | the first point. |
| [in] | p1 | the second point. |
| [in] | p2 | the third point. |
| auto vcl::collinearityTest | ( | const PointType & | p0, |
| const PointType & | p1, | ||
| const PointType & | p2 | ||
| ) |
Computes the collinearity test between three points. The test returns a positive value if the points are counter-clockwise, a negative value if the points are clockwise, and zero if the points are collinear.
The function computes the z coordinate of the cross product between the vectors p1 - p0 and p2 - p0:
| PointType | the type of the points that satisfies the Point2Concept. |
| [in] | p0 | the first point. |
| [in] | p1 | the second point. |
| [in] | p2 | the third point. |
| auto vcl::convexHull | ( | InputIterator | first, |
| InputIterator | end | ||
| ) |
Get the 2D convex hull using Graham scan algorithm on a set of points.
| InputIterator | Iterator type of the input container of points. It must Iterate over a range of elements that satisfy the Point2Concept. |
| [in] | first | First iterator of the input container of points. |
| [in] | end | End iterator of the input container of points. |
| PolygonType vcl::createCircle | ( | uint | n, |
| typename PolygonType::ScalarType | radius = 1.0 |
||
| ) |
Create a 2D circle polygon with n vertices and the given radius.
| PolygonType | The polygon type. |
| [in] | n | The number of vertices. |
| [in] | radius | The radius of the circle. |
Computes the earcut algorithm of a 3D planar polygonal face, that returns a triangulation of the polygon.
Returns a list of indices in which each index is the index of a point of the 3D input polygon, organized in triplets, each one of these is a triangle of the resulting triangulation.
This algorithm first computes the normal of the given polygon, then projects it in a 2D plane and executes the classic 2D EarCut algorithm.
| Face | the type of the face that satisfies the FaceConcept. |
| [in] | polygon | A (polygonal) face of a vcl::Mesh. |
| std::vector< uint > vcl::earCut | ( | Iterator | begin, |
| Iterator | end | ||
| ) |
Triangulates a simple polygon with no holes using the ear-cutting algorithm.
Triangulates a simple polygon with no holes in 3D space by projecting it onto a 2D plane and applying the ear-cutting algorithm.
| Iterator | The type of iterator used to represent the vertices of the polygon. It must satisfy the Point2Concept requirement. |
| [in] | begin | An iterator pointing to the first vertex of the polygon. |
| [in] | end | An iterator pointing to one past the last vertex of the polygon. |
| std::logic_error | If the polygon is not simple or has holes. |
| Iterator | The type of iterator used to represent the vertices of the polygon. It must satisfy the Point3Concept requirement. |
| [in] | begin | An iterator pointing to the first vertex of the polygon. |
| [in] | end | An iterator pointing to one past the last vertex of the polygon. |
| std::logic_error | If the polygon is not simple or has holes. |
| std::vector< uint > vcl::earCut | ( | R && | range | ) |
Triangulates a simple polygon with no holes using the ear-cutting algorithm.
| R | a range of points that satisfy the PointConcept. |
| [in] | range | the range of points that define the polygon. |
Returns the internal angle (in radians) of the vi-th vertex of the face.
| FaceType | the type of the face that satisfies the FaceConcept. |
| [in] | f | the input face. |
| [in] | vi | the index of the vertex in the face on which calculate the angle |
Computes the area of a face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces.
| FaceType | the type of the face that satisfies the FaceConcept. |
| [in] | f | the input face. |
| FaceType::VertexType::PositionType vcl::faceBarycenter | ( | const FaceType & | f | ) |
Computes the barycenter of a face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces.
| FaceType | the type of the face that satisfies the FaceConcept. |
| [in] | f | the input face. |
| FaceType::VertexType::PositionType vcl::faceNormal | ( | const FaceType & | f | ) |
Computes the normal of a face, without modifying the face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces.
| FaceType | the type of the face that satisfies the FaceConcept. |
| [in] | f | the input face. |
Computes the perimeter of a face. Works both for triangle and polygonal faces, and it is optimized in case of triangle faces.
| FaceType | the type of the face that satisfies the FaceConcept. |
| [in] | f | the input face. |
| bool vcl::isCounterClockWise | ( | Iterator | begin, |
| Iterator | end | ||
| ) |
Checks if a set of points that form a polygon are in counter-clockwise order.
| Iterator | the type of iterator that iterates over a range of points that satisfy the Point2Concept. |
| [in] | begin | the iterator pointing to the first point. |
| [in] | end | the iterator pointing to one past the last point. |
| auto vcl::project | ( | Iterator | begin, |
| Iterator | end | ||
| ) |
Project a 3D polygon onto a plane, and return the 2D polygon.
| Iterator | Iterator type, it must iterate over 3D points. |
| [in] | begin | Iterator to the first point of the polygon. |
| [in] | end | Iterator to the past-the-end point of the polygon. |
| auto vcl::project | ( | R && | polygon | ) |
Project a 3D polygon defined by the given range onto a plane, and return the 2D polygon.
| R | A range of 3D points. |
| [in] | polygon | The input polygon. |
| void vcl::sortConvexPolygonVertices | ( | Iterator | begin, |
| Iterator | end | ||
| ) |
Sorts the vertices of a convex polygon in counter-clockwise order.
Given a set of points that form a convex polygon, this function sorts the points in counter-clockwise order. The function assumes that the input points form a convex polygon, and it sorts the points in counter-clockwise order with respect to the point with the lowest y-coordinate. The function uses the atan2 function to compute the angle of each point with respect to the point with the lowest y-coordinate, and it sorts the points based on these angles.
| Iterator | the type of iterator that iterates over a range of points that satisfy the Point2Concept. |
| [in] | begin | the iterator pointing to the first point. |
| [in] | end | the iterator pointing to one past the last point. |