载入中...
搜索中...
未找到
ConvexHull.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4#include "common/Result.h"
5
6#include <array>
7#include <cstddef>
8#include <span>
9#include <vector>
10
11namespace eve::math {
12
14using HullPoint2 = std::array<float, 2>;
16using HullPoint3 = std::array<float, 3>;
18using HullTriangle = std::array<std::size_t, 3>;
19
22
25 HullDimension dimension = HullDimension::Empty;
26 std::vector<HullPoint2> vertices;
27};
28
31 HullDimension dimension = HullDimension::Empty;
32 std::vector<HullPoint3> vertices;
33 std::vector<HullTriangle> faces;
34};
35
46[[nodiscard]] EVENGINE_API_FOUNDATION Result<ConvexHull2D> convexHull2D(std::span<const HullPoint2> points);
47
63[[nodiscard]] EVENGINE_API_FOUNDATION Result<ConvexHull3D> convexHull3D(std::span<const HullPoint3> points,
64 double tolerance = 1e-10);
65
66} // namespace eve::math
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
std::shared_ptr< const std::vector< glm::vec2 > > points
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
std::array< float, 3 > HullPoint3
Owned XYZ coordinates; no script object or module lifetime required.
Definition ConvexHull.h:16
std::array< float, 2 > HullPoint2
Owned XY coordinates; no script object or module lifetime required.
Definition ConvexHull.h:14
HullDimension
Affine dimension of a successful hull, including degenerate inputs.
Definition ConvexHull.h:21
Result< ConvexHull3D > convexHull3D(std::span< const HullPoint3 > input, double tolerance)
Incremental 3D hull with outward triangles and compact vertex indices.
Result< ConvexHull2D > convexHull2D(std::span< const HullPoint2 > points)
Andrew monotone-chain hull; removes exact duplicates and collinear edge interiors.
std::array< std::size_t, 3 > HullTriangle
Triangle indices into the returned vertex array.
Definition ConvexHull.h:18
Self-contained 2D hull; vertices are CCW, with no repeated closing point.
Definition ConvexHull.h:24
std::vector< HullPoint2 > vertices
Definition ConvexHull.h:26
Self-contained 3D hull; volume triangles face outward.
Definition ConvexHull.h:30
std::vector< HullTriangle > faces
Definition ConvexHull.h:33
std::vector< HullPoint3 > vertices
Definition ConvexHull.h:32