cesium-native  0.41.0
clipTriangleAtAxisAlignedThreshold.h
1 #pragma once
2 
3 #include <glm/glm.hpp>
4 
5 #include <variant>
6 #include <vector>
7 
8 namespace CesiumGeometry {
9 
21  int first;
22 
26  int second;
27 
32  double t;
33 
34  constexpr bool operator==(const InterpolatedVertex& other) const noexcept {
35  return this->first == other.first && this->second == other.second &&
36  std::fabs(this->t - other.t) <=
37  std::numeric_limits<double>::epsilon();
38  }
39 
40  constexpr bool operator!=(const InterpolatedVertex& other) const noexcept {
41  return !(*this == other);
42  }
43 };
44 
51 using TriangleClipVertex = std::variant<int, InterpolatedVertex>;
52 
87  double threshold,
88  bool keepAbove,
89  int i0,
90  int i1,
91  int i2,
92  double u0,
93  double u1,
94  double u2,
95  std::vector<TriangleClipVertex>& result) noexcept;
96 } // namespace CesiumGeometry
Basic geometry classes for Cesium.
std::variant< int, InterpolatedVertex > TriangleClipVertex
A vertex resulting from clipping a triangle against a threshold.
void clipTriangleAtAxisAlignedThreshold(double threshold, bool keepAbove, int i0, int i1, int i2, double u0, double u1, double u2, std::vector< TriangleClipVertex > &result) noexcept
Splits a 2D triangle at given axis-aligned threshold value and returns the resulting polygon on a giv...
A structure describing a vertex that results from interpolating two other vertices.
double t
The fraction of the distance from first to second at which to interpolate.
int first
The index of the first vertex to interpolate between.
int second
The index of the second vertex to interpolate between.