8#ifndef META_OCEAN_GEOMETRY_DELAUNAY_H
9#define META_OCEAN_GEOMETRY_DELAUNAY_H
57 inline unsigned int index0()
const;
63 inline unsigned int index1()
const;
69 inline unsigned int index2()
const;
82 inline unsigned int operator[](
const unsigned int n)
const;
216 inline bool operator()(
const unsigned int a,
const unsigned int b)
const;
236 inline IndexEdge(
const unsigned int indexFirst,
const unsigned int indexSecond);
244 inline IndexEdge(
const unsigned int indexFirst,
const unsigned int indexSecond,
const Vector2* points);
277 using EdgeMap = std::map<IndexEdge, unsigned int>;
350 ocean_assert(n < 3u);
365 ocean_assert(
isValid() && points);
372 ocean_assert(
isValid() && points);
382 ocean_assert(points);
387 if constexpr (std::is_same<double, Scalar>::value)
393 ocean_assert(triangle.
isValid());
402 if constexpr (std::is_same<double, Scalar>::value)
418 ocean_assert(points && pointsSuperTriangle);
425 ocean_assert(point0 != point1 && point0 != point2 && point1 != point2);
427 if constexpr (std::is_same<double, Scalar>::value)
429 ocean_assert(!
Line2(point0, (point1 - point0).normalizedOrZero()).isOnLine(point2));
432 const Triangle2 triangle(point0, point1, point2);
433 ocean_assert(triangle.
isValid());
442 if constexpr (std::is_same<double, Scalar>::value)
462 ocean_assert(epsilon >= 0);
472 ocean_assert(epsilon >= 0);
500 firstIndex_(indexFirst < indexSecond ? indexFirst : indexSecond),
501 secondIndex_(indexFirst < indexSecond ? indexSecond : indexFirst)
508 firstIndex_(points[indexFirst] < points[indexSecond] ? indexFirst : indexSecond),
509 secondIndex_(points[indexFirst] < points[indexSecond] ? indexSecond : indexFirst)
Scalar circumcircleRadius_
Radius of the circumcircle, with range [0, infinity), -1 for and invalid triangle object.
Definition Delaunay.h:183
CircumCricleIndexTriangle(const unsigned int index0, const unsigned int index1, const unsigned int index2, const Vector2 *points)
Creates a new index triangle object and calculates circumcenter and radius.
Definition Delaunay.h:377
bool isOutsideCircumCircle(const Vector2 &point, const Scalar epsilon=Numeric::eps()) const
Returns whether a point is outside the circumcircle of the triangle.
Definition Delaunay.h:468
bool isInsideCircumCircle(const Vector2 &point, const Scalar epsilon=Numeric::eps()) const
Returns whether a point is within the circumcircle of the triangle.
Definition Delaunay.h:458
bool isRightOfCircumCircle(const Vector2 &point) const
Returns whether a point is completely right of the circumcircle (i.e.
Definition Delaunay.h:478
Vector2 circumcenter_
2D (Cartesian) circumcenter.
Definition Delaunay.h:180
void swap()
Swaps the order of the indices from a counter clockwise order to a clockwise order or vice versa.
Definition Delaunay.h:453
bool operator()(const unsigned int a, const unsigned int b) const
Compares two point indices and returns whether the x coordinate of the first point is below the x coo...
Definition Delaunay.h:492
const Vector2 * dataPoints_
The points to be compared.
Definition Delaunay.h:221
ComparePointsX(const Vector2 *points)
Creates a new comparison object by a set of given points.
Definition Delaunay.h:486
bool operator<(const IndexEdge &right) const
Lesser operator for two edge objects.
Definition Delaunay.h:525
unsigned int firstIndex_
The index of the first point.
Definition Delaunay.h:268
unsigned int secondIndex() const
Returns the index of the second point.
Definition Delaunay.h:520
unsigned int secondIndex_
The index of the second point.
Definition Delaunay.h:271
IndexEdge(const unsigned int indexFirst, const unsigned int indexSecond)
Creates a new edge object and sorts the provided two point indices to ensure that the first index is ...
Definition Delaunay.h:499
unsigned int firstIndex() const
Returns the index of the first point.
Definition Delaunay.h:515
unsigned int index2() const
Returns the third index.
Definition Delaunay.h:338
Triangle3 triangle3(const Vector3 *points) const
Creates a 3D triangle with positions as corners from this index triangle.
Definition Delaunay.h:370
IndexTriangle()
Creates an invalid index triangle object.
Definition Delaunay.h:310
Triangle2 triangle2(const Vector2 *points) const
Creates a 2D triangle with positions as corners from this index triangle.
Definition Delaunay.h:363
bool operator==(const IndexTriangle &second) const
Returns whether two triangles are equal (i.e.
Definition Delaunay.h:354
bool isValid() const
Returns whether three individual indices are stored.
Definition Delaunay.h:343
unsigned int index1() const
Returns the second index.
Definition Delaunay.h:333
unsigned int operator[](const unsigned int n) const
Returns one index of this triangle.
Definition Delaunay.h:348
unsigned int indices_[3]
Triangle indices;.
Definition Delaunay.h:108
unsigned int index0() const
Returns the first index.
Definition Delaunay.h:328
This class implements Delaunay triangulation functions.
Definition Delaunay.h:30
static bool checkTriangulation(const CircumCricleIndexTriangles &triangles, const Vectors2 &points, const Scalar epsilon=Numeric::eps())
Checks a Delaunay triangulation for integrity: no points are allowed within the circumcircle of a tri...
std::map< IndexEdge, unsigned int > EdgeMap
Definition of a map mapping edge pairs to a counter.
Definition Delaunay.h:277
std::vector< IndexTriangle > IndexTriangles
Definition of a vector holding index triangles.
Definition Delaunay.h:114
static bool checkTriangulation(const IndexTriangles &triangles, const Vectors2 &points, const Scalar epsilon=Numeric::eps())
Checks a Delaunay triangulation for integrity: no points are allowed within the circumcircle of a tri...
std::vector< CircumCricleIndexTriangle > CircumCricleIndexTriangles
Definition of a vector holding extended index triangles.
Definition Delaunay.h:189
std::list< CircumCricleIndexTriangle > CircumCricleIndexTriangleList
Definition of a list holding extended index triangles.
Definition Delaunay.h:194
static IndexTriangles triangulation(const Vectors2 &points)
Determines the delaunay triangulation for a given 2D point set.
static constexpr Scalar weakEps()
static constexpr Scalar eps()
static bool isEqual(const Scalar first, const Scalar second)
static constexpr Scalar sqr(const Scalar value)
const VectorT2< T > & point2() const
Returns the third triangle corner.
Definition Triangle2.h:416
const VectorT2< T > & point0() const
Returns the first triangle corner.
Definition Triangle2.h:404
VectorT2< T > cartesianCircumcenter() const
Returns the circumcenter for this triangle in Cartesian coordinates.
Definition Triangle2.h:784
const VectorT2< T > & point1() const
Returns the second triangle corner.
Definition Triangle2.h:410
bool isValid() const
Returns whether this triangle can provide valid barycentric coordinates (for 64 bit floating point va...
Definition Triangle2.h:798
const T & x() const noexcept
Returns the x value.
Definition Vector2.h:703
LineT2< Scalar > Line2
Definition of the Line2 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition Line2.h:28
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition Vector2.h:64
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
TriangleT3< Scalar > Triangle3
Definition of the Triangle3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with sing...
Definition Triangle3.h:28
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition Vector3.h:29
TriangleT2< Scalar > Triangle2
Definition of the Triangle2 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with sing...
Definition Triangle2.h:28
float Scalar
Definition of a scalar type.
Definition Math.h:129
Namespace of the Geometry library.
Definition AbsoluteTransformation.h:20
The namespace covering the entire Ocean framework.
Definition Accessor.h:15