Class HalfEdgeTriangulation

Inheritance Relationships

Derived Type

Class Documentation

class Polylidar::MeshHelper::HalfEdgeTriangulation

This class hold all the datastructures in our meshes (vertices, triangles, halfedges, etc.).

Subclassed by Polylidar::Delaunator::Delaunator

Public Functions

HalfEdgeTriangulation()

Construct an empty HalfEdgeTriangulation object.

HalfEdgeTriangulation &operator=(const HalfEdgeTriangulation &other) = default

Copy an existing HalfEdgeTriangulation object.

HalfEdgeTriangulation(HalfEdgeTriangulation &&other) = default

Move (no copy) an existing HalfEdgeTriangulation object to another.

Parameters

other

HalfEdgeTriangulation(const Matrix<double> &in_vertices)

Create a new HalfEdgeTriangulation object with only vertices (copied). Will be triangulated later.

Parameters

in_vertices

HalfEdgeTriangulation(Matrix<double> &&in_vertices)

Create a new HalfEdgeTriangulation object with only vertices (moved/no copy). Will be triangulated later.

Parameters

in_vertices

HalfEdgeTriangulation(Matrix<double> &&in_vertices, Matrix<size_t> &&in_triangles)

Create a new HalfEdgeTriangulation object with vertices and triangles (moved/no copy).

Parameters
  • in_vertices

  • in_triangles

HalfEdgeTriangulation(Matrix<double> &&in_vertices, Matrix<size_t> &&in_triangles, Matrix<size_t> &&in_halfedges)

Create a new HalfEdgeTriangulation object with vertices, triangles, halfedges (moved/no copy).

Parameters
  • in_vertices

  • in_triangles

  • in_halfedges

HalfEdgeTriangulation(Matrix<double> &&in_vertices, Matrix<size_t> &&in_triangles, Matrix<size_t> &&in_halfedges, Matrix<double> &&in_triangle_normals)

Create a new HalfEdgeTriangulation object with vertices, triangles, halfedges, and triangle normals (moved/no copy).

Parameters
  • in_vertices

  • in_triangles

  • in_halfedges

  • in_triangle_normals

void SetTriangleNormals(const Matrix<double> &in_triangle_normals)

Set the Triangle Normals of the mesh.

Parameters

in_triangle_normals

void SetVertexClasses(const Matrix<uint8_t> &in_vertex_classes, bool copy = true)

Set the Vertex classes of the mesh.

Parameters

in_vertex_classes

void ComputeTriangleNormals()

Compute triangle normals using vertex and triangle datastructures.

Public Members

Matrix<double> vertices

Vertices in the mesh, N X 2 or N X 3.

Matrix<size_t> triangles

Triangles in the mesh, K X 3.

Matrix<size_t> halfedges

Half-edge mapping in the mesh, K X 3. Every triangle has three oriented half-edges. Each half-edge has unique id which is mapped to the 2D index of all triangles, e.g. the half-edges of triangle k are [3*k, 3*k + 1, 3*k + 2]. Halfedges array provides the twin/opposite/shared half-edge id. e.g., The twin half-edge of first edge for the triangle k is halfedges(k, 0)

Matrix<double> triangle_normals

Triangle normals in the mesh (normalized), K X 3.

Matrix<uint8_t> vertex_classes

Class ids for each vertex in mesh (normalized), K X 3.

bool counter_clock_wise

Direction of travel for oriented half-edges around a triangle.