cesium-native 0.43.0
Loading...
Searching...
No Matches
clipTriangleAtAxisAlignedThreshold.h
1#pragma once
2
3#include <glm/glm.hpp>
4
5#include <variant>
6#include <vector>
7
8namespace CesiumGeometry {
9
21 int first;
22
26 int second;
27
32 double t;
33
41 constexpr bool operator==(const InterpolatedVertex& other) const noexcept {
42 return this->first == other.first && this->second == other.second &&
43 std::fabs(this->t - other.t) <=
44 std::numeric_limits<double>::epsilon();
45 }
46
48 constexpr bool operator!=(const InterpolatedVertex& other) const noexcept {
49 return !(*this == other);
50 }
51};
52
59using TriangleClipVertex = std::variant<int, InterpolatedVertex>;
60
95 double threshold,
96 bool keepAbove,
97 int i0,
98 int i1,
99 int i2,
100 double u0,
101 double u1,
102 double u2,
103 std::vector<TriangleClipVertex>& result) noexcept;
104} // 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.
constexpr bool operator!=(const InterpolatedVertex &other) const noexcept
The inverse of InterpolatedVertex::operator==.
double t
The fraction of the distance from first to second at which to interpolate.
constexpr bool operator==(const InterpolatedVertex &other) const noexcept
Compares this InterpolatedVertex against another.
int first
The index of the first vertex to interpolate between.
int second
The index of the second vertex to interpolate between.