RobWorkProject  23.9.11-
Static Public Member Functions | List of all members
Triangulate Class Reference

Class for triangulating a polygon. More...

#include <Triangulate.hpp>

Static Public Member Functions

static bool processPoints (const std::vector< rw::math::Vector2D<>> &points, std::vector< int > &result)
 Triangulates the polygon described by points. More...
 
static bool processPoints (const std::vector< rw::math::Vector3D< double >> &contour, std::vector< int > &result, double colinearCriteria=1e-5, double precision=1e-5)
 Triangulates the polygon described by points. More...
 
static bool processPolygon (Polygon<>::Ptr polygon, std::vector< int > &result, double colinearCriteria=1e-5, double precision=1e-5)
 Triangules the polygon polygon. More...
 
static double calcArea (const std::vector< rw::math::Vector2D<>> &contour)
 Computes area of the polygon defined by contour.
 
static bool insideTriangle2D (float Ax, float Ay, float Bx, float By, float Cx, float Cy, float Px, float Py)
 Checks if the point (Px,Py) is inside the triangle (Ax,Ay), (Bx,By), (Cx,Cy)
 

Detailed Description

Class for triangulating a polygon.

Member Function Documentation

◆ processPoints() [1/2]

static bool processPoints ( const std::vector< rw::math::Vector2D<>> &  points,
std::vector< int > &  result 
)
static

Triangulates the polygon described by points.

The polygon need to be simple (no edges crossing and no holes). Both convex and concave polygons are supported

Parameters
points[in] Points of the polygon. These needs to be in the right order, as no sorting is done in the function.
result[out] Indices of the vertices defining the triangles. The corners of the n'th triangle is the points with indices result[3*n], result[3*n+1] and result[3*n+2]

◆ processPoints() [2/2]

static bool processPoints ( const std::vector< rw::math::Vector3D< double >> &  contour,
std::vector< int > &  result,
double  colinearCriteria = 1e-5,
double  precision = 1e-5 
)
static

Triangulates the polygon described by points.

The polygon need to be simple (no edges crossing and no holes). Both convex and concave polygons are supported

Parameters
contour[in] Points of the polygon. These needs to be in the right order, as no sorting is done in the function.
result[out] Indices of the vertices defining the triangles. The corners of the n'th triangle is the points with indices result[3*n], result[3*n+1] and result[3*n+2]
colinearCriteria[in] Criteria for when two edges are considered to be colinear
precision[in] Criteria for when two points are considered to be coinciding

◆ processPolygon()

static bool processPolygon ( Polygon<>::Ptr  polygon,
std::vector< int > &  result,
double  colinearCriteria = 1e-5,
double  precision = 1e-5 
)
static

Triangules the polygon polygon.

The polygon need to be simple (no edges crossing and no holes). Both convex and concave polygons are supported

Parameters
polygon[in] The polygon to triangulate
result[out] Indices of the vertices defining the triangles. The corners of the n'th triangle is the points with indices result[3*n], result[3*n+1] and result[3*n+2]
colinearCriteria[in] Criteria for when two edges are considered to be colinear
precision[in] Criteria for when two points are considered to be coinciding

The documentation for this class was generated from the following file: