Rumba C++ SDK
maquina::DelaunayTriangulation2D Class Reference

A 2D Delaunay triangulation. More...

#include <Delaunay.h>

Public Member Functions

 DelaunayTriangulation2D ()
 Create an empty DelaunayTriangulation2D. More...
 
 DelaunayTriangulation2D (const std::vector< Imath::V2d > &points)
 
bool is_inside_super_triangle (const Imath::V2d &p)
 Returns true if the point lies inside the initial super triangle, false otherwise. More...
 
bool insert (const Imath::V2d &p)
 
std::vector< Imath::V2dpoints () const
 Returns the set of points. More...
 
const std::vector< int > & convex_hull () const
 
const std::vector< Imath::V3i > & triangulation () const
 
std::vector< std::pair< int, double > > nnc (const Imath::V2d &p) const
 

Static Public Member Functions

static bool is_in_circumcircle (const Imath::V2d &p, const Imath::V2d &a, const Imath::V2d &b, const Imath::V2d &c)
 Returns the voronoi diagram of the set of points. More...
 

Detailed Description

A 2D Delaunay triangulation.

This class performs the Bowyer-Watson algorithm to compute the Delaunay triangulation of a set of 2D points.

Constructor & Destructor Documentation

◆ DelaunayTriangulation2D() [1/2]

maquina::DelaunayTriangulation2D::DelaunayTriangulation2D ( )

Create an empty DelaunayTriangulation2D.

◆ DelaunayTriangulation2D() [2/2]

maquina::DelaunayTriangulation2D::DelaunayTriangulation2D ( const std::vector< Imath::V2d > &  points)

Create a DelaunayTriangulation2D from the given 2D points.

Warning
assumes each point is unique.

Member Function Documentation

◆ convex_hull()

const std::vector<int>& maquina::DelaunayTriangulation2D::convex_hull ( ) const

Returns the convex_hull of the set of points as a polygon.

Note
Slow only on the first request, except if invalidated by a point insertion.

◆ insert()

bool maquina::DelaunayTriangulation2D::insert ( const Imath::V2d p)

Inserts the given point to the Delaunay Triangulation. Returns true if the point has been inserted, false otherwise.

Note
For now, the point is inserted only if it lies inside the initial super triangle.
Insertion can be performed only if p is not already part of the point set.

◆ is_in_circumcircle()

static bool maquina::DelaunayTriangulation2D::is_in_circumcircle ( const Imath::V2d p,
const Imath::V2d a,
const Imath::V2d b,
const Imath::V2d c 
)
static

Returns the voronoi diagram of the set of points.

Returns true if p lies in the circumcircle of triangle abc, false otherwise.

◆ is_inside_super_triangle()

bool maquina::DelaunayTriangulation2D::is_inside_super_triangle ( const Imath::V2d p)

Returns true if the point lies inside the initial super triangle, false otherwise.

◆ nnc()

std::vector<std::pair<int, double> > maquina::DelaunayTriangulation2D::nnc ( const Imath::V2d p) const

Computes the natural_neighbor_coordinates of the query point. Returns a map associating each natural neighbor's index with the corresponding coordinate.

◆ points()

std::vector<Imath::V2d> maquina::DelaunayTriangulation2D::points ( ) const

Returns the set of points.

◆ triangulation()

const std::vector<Imath::V3i>& maquina::DelaunayTriangulation2D::triangulation ( ) const

Returns the result of the triangulation as a list of triangles.

Note
Slow only on the first request, except if invalidated by a point insertion.

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