Terrain Rasterizer
Conversion of GPS data into 2.5D topographic maps
Loading...
Searching...
No Matches
triangulation.cpp File Reference

Implementation of Delaunay triangulation using delaunator-cpp. More...

#include "triangulation.hpp"
#include <cmath>
#include <delaunator.hpp>
#include <iostream>
Include dependency graph for triangulation.cpp:

Functions

double distSq (const Point &a, const Point &b)
 Calculates the squared Euclidean distance between two points.
 
Mesh triangulate (const std::vector< Point > &points)
 Performs Delaunay triangulation on a set of 2D points.
 

Detailed Description

Implementation of Delaunay triangulation using delaunator-cpp.

Function Documentation

◆ distSq()

double distSq ( const Point a,
const Point b 
)

Calculates the squared Euclidean distance between two points.

Used to avoid square root calculations when comparing distances.

Parameters
aFirst point.
bSecond point.
Returns
double Squared distance between a and b.

◆ triangulate()

Mesh triangulate ( const std::vector< Point > &  points)

Performs Delaunay triangulation on a set of 2D points.

Uses the delaunator-cpp library to generate a triangulation from the projected X and Y coordinates of the input points. The Z coordinate is preserved in the resulting mesh.

Parameters
pointsThe vector of input points to triangulate.
Returns
Mesh The resulting triangular mesh containing points and triangles.
Here is the call graph for this function: