11#ifndef EASY3D_ALGO_DELAUNAY_2D_H
12#define EASY3D_ALGO_DELAUNAY_2D_H
14#include <easy3d/algo/delaunay.h>
38 set_vertices((
unsigned int) vertices.size(), &vertices[0].x);
41 unsigned int nearest_vertex(
const float *p)
const override {
42 return Delaunay::nearest_vertex(p);
45 unsigned int nearest_vertex(
const vec2 &p)
const {
46 return nearest_vertex(p.data());
49 const vec2 &vertex(
unsigned int i)
const {
53 const int *tri_to_v()
const {
return cell_to_v(); }
55 const int *tri_to_tri()
const {
return cell_to_cell(); }
57 int vertex_tri(
int v)
const {
return vertex_cell(v); }
67 int tri_adjacent(
unsigned int t,
unsigned int le)
const {
68 return cell_adjacent(t, le);
72 struct triangulateio *triangle_out_;
73 struct triangulateio *triangle_in_;
2D Delaunay triangulation, using Jonathan Richard Shewchuk's "triangle" implementation.
Definition: delaunay_2d.h:26
void set_vertices(const std::vector< vec2 > &vertices)
Sets the vertices from an array of 2D points.
Definition: delaunay_2d.h:37
unsigned int nb_triangles() const
Returns the number of triangles.
Definition: delaunay_2d.h:60
int tri_vertex(unsigned int t, unsigned int lv) const
Returns the index of the lv_th vertex in the t_th triangle.
Definition: delaunay_2d.h:63
void set_vertices(unsigned int nb_vertices, const float *pts) override
Sets the vertices from an array of floating point numbers in which each consecutive number pair denot...
Definition: delaunay_2d.cpp:62
Base class for Delaunay triangulation.
Definition: delaunay.h:25
unsigned int nb_cells() const
Returns the number of cells.
Definition: delaunay.h:56
unsigned int nb_vertices() const
Returns the number of vertices.
Definition: delaunay.h:53
const float * vertex_ptr(unsigned int i) const
Returns the pointer to the vertex of index i.
Definition: delaunay.h:47
int cell_vertex(unsigned int c, unsigned int lv) const
Returns the index of the lv_th vertex in the c_th cell.
Definition: delaunay.h:65
Definition: collider.cpp:182
Vec< 2, float > vec2
A 2D point/vector of float type.
Definition: types.h:43