Class Polylidar3D

Class Documentation

class Polylidar::Polylidar3D

This class handles all data inputs: 2D points sets, 3D point clouds, 3D meshes. Will extract polygons from data. The only issue is the ‘_alpha’ parameter is only applicable for 2D point sets. TODO - Break up into 2D and 3D classes?

Public Functions

Polylidar3D(const double _alpha = PL_DEFAULT_ALPHA, const double _lmax = PL_DEFAULT_LMAX, const size_t _min_triangles = PL_DEFAULT_MINTRIANGLES, const size_t _min_hole_vertices = PL_DEFAULT_MINHOLEVERTICES, const double _z_thresh = PL_DEFAULT_ZTHRESH, const double _norm_thresh = PL_DEFAULT_NORMTHRESH, const double _norm_thresh_min = PL_DEFAULT_NORMTHRESH_MIN, const int _task_threads = PL_DEFAULT_TASK_THREADS)

Construct a new Polylidar 3D object.

Parameters
  • _alpha – Maximum circumcircle radius (only applicable for 2D point sets). Leave at 0.0 for 3D Data.

  • _lmax – Maximum triangle edge length in a planar triangle segment

  • _min_triangles – Minimum number of triangles in a planar triangle segment

  • _min_hole_vertices – Minimum number of vertices for an interior hole in a polygon

  • _z_thresh – Maximum point to plane distance during region growing (3D only). A value of 0.0 ignores this constraint.

  • _norm_thresh – IGNORE - will be deprecated or repurposed (3D only)

  • _norm_thresh_min – Minimum value of the dot product between a triangle and surface normal being extracted (3D only)

  • _task_threads – Number of threads for task-based parallelism (Marl library)

std::tuple<MeshHelper::HalfEdgeTriangulation, Planes, Polygons> ExtractPlanesAndPolygons(const Matrix<double> &points, const std::array<double, 3> plane_normal = PL_DEFAULT_DESIRED_VECTOR)

Extract Planes and Polygons from a 2D point sets or unorganized 3D point clouds Uses 2D Delaunay triangulation for 2D point sets. Uses 2.5 Delaunay triangulation for 3D point clouds. Only send 3D point clouds whose desired surface for extraction is already aligned with the XY Plane (e.g. airborne LiDAR point clouds)

Parameters
  • pointsMatrix (NX2 or NX3) point cloud. Contiguous Memory.

  • plane_normal – Leave this at the default. It can technically be changed but don’t deviate to greatly from [0,0,1].

Returns

std::tuple<MeshHelper::HalfEdgeTriangulation, Planes, Polygons>

std::tuple<Planes, Polygons> ExtractPlanesAndPolygons(MeshHelper::HalfEdgeTriangulation &mesh, const std::array<double, 3> plane_normal)

Extracts planes and polygons from a half-edge triangular mesh given a plane normal.

Parameters
  • mesh – A half-edge mesh previously created.

  • plane_normal – The unit plane normal to extract planes and polygons from the mesh.

Returns

std::tuple<Planes, Polygons>

std::tuple<Planes, Polygons> ExtractPlanesAndPolygonsOptimized(MeshHelper::HalfEdgeTriangulation &mesh, const std::array<double, 3> plane_normal)

Extracts planes and polygons from a half-edge triangular mesh and makes use of task-based parallelism.

Parameters
  • mesh – A half-edge mesh previously created.

  • plane_normal – The unit plane normal to extract planes and polygons from the mesh.

Returns

std::tuple<Planes, Polygons>

std::tuple<PlanesGroup, PolygonsGroup> ExtractPlanesAndPolygons(MeshHelper::HalfEdgeTriangulation &mesh, const Matrix<double> &plane_normals)

Extracts planes and polygons from a half-edge triangular mesh given multiple dominant plane normals.

Parameters
  • mesh – A half-edge mesh previously created.

  • plane_normals – The set of dominant plane normal in the mesh to extract planes and polygons from. Size LX3, L=number of dominant planes.

Returns

std::tuple<PlanesGroup, PolygonsGroup>

std::tuple<PlanesGroup, PolygonsGroup> ExtractPlanesAndPolygonsOptimized(MeshHelper::HalfEdgeTriangulation &mesh, const Matrix<double> &plane_normals)

Extracts planes and polygons from a half-edge triangular mesh given multiple dominant plane normals. Uses task-based parallelism.

Parameters
  • mesh – A half-edge mesh previously created.

  • plane_normals – The set of dominant plane normal in the mesh to extract planes and polygons from. Size LX3, L=number of dominant planes.

Returns

std::tuple<PlanesGroup, PolygonsGroup>

std::tuple<PlanesGroup, PolygonsGroup> ExtractPlanesAndPolygonsOptimizedClassified(MeshHelper::HalfEdgeTriangulation &mesh, const Matrix<double> &plane_normals)

Extracts planes and polygons from a classified half-edge triangular mesh given multiple dominant plane normals. Uses task-based parallelism.

Parameters
  • mesh – A classified half-edge mesh previously created.

  • plane_normals – The set of dominant plane normal in the mesh to extract planes and polygons from. Size LX3, L=number of dominant planes.

Returns

std::tuple<PlanesGroup, PolygonsGroup>

std::vector<uint8_t> ExtractTriSet(MeshHelper::HalfEdgeTriangulation &mesh, const Matrix<double> &plane_normals)

Extract the triangle set (dominant planar grouping) for each triangle. This is used for debugging/visualization.

Parameters
  • mesh

  • plane_normals

Returns

std::vector<uint8_t>

Public Members

double alpha

Maximum circumcircle radius of a triangle. Filters ‘big’ triangles. Only applicable for 2D point sets. A value of 0.0 makes this parameter ignored.

double lmax

Maximum triangle edge length of a triangle in a planar segment. Filters ‘big’ triangles.

size_t min_triangles

Minimum number of triangles in a planar triangle segment. Filters small planar segments very fast.

size_t min_hole_vertices

Minimum number of vertices for a hole in a polygon. Filters small holes very fast.

double z_thresh

Maximum point to plane distance during region growing (3D only). Forces planarity constraints. A value of 0.0 ignores this constraint.

double norm_thresh

IGNORE - will be deprecated or repurposed (3D only)

double norm_thresh_min

Minimum value of the dot product between a triangle and surface normal being extracted. Forces Planar Constraints.