CARLA
 
载入中...
搜索中...
未找到
DataStructs.h
浏览该文件的文档.
1#pragma once
2#include <vector>
3#include <array>
4#include <functional>
5
6namespace MeshReconstruction
7{
8 struct Vec3
9 {
10 double x, y, z;
11
12 Vec3 operator+(Vec3 const &o) const
13 {
14 return {x + o.x, y + o.y, z + o.z};
15 }
16
17 Vec3 operator-(Vec3 const &o) const
18 {
19 return {x - o.x, y - o.y, z - o.z};
20 }
21
22 Vec3 operator*(double c) const
23 {
24 return {c * x, c * y, c * z};
25 }
26
27 double Norm() const
28 {
29 return sqrt(x * x + y * y + z * z);
30 }
31
33 {
34 auto n = Norm();
35 return {x / n, y / n, z / n};
36 }
37 };
38
39 struct Rect3
40 {
43 };
44
45 using Triangle = std::array<int, 3>;
46
47 struct Mesh
48 {
49 std::vector<Vec3> vertices;
50 std::vector<Triangle> triangles;
51 std::vector<Vec3> vertexNormals;
52 };
53
54 using Fun3s = std::function<double(Vec3 const &)>;
55 using Fun3v = std::function<Vec3(Vec3 const &)>;
56}
std::array< int, 3 > Triangle
Definition DataStructs.h:45
std::function< Vec3(Vec3 const &)> Fun3v
Definition DataStructs.h:55
std::function< double(Vec3 const &)> Fun3s
Definition DataStructs.h:54
std::vector< Vec3 > vertexNormals
Definition DataStructs.h:51
std::vector< Triangle > triangles
Definition DataStructs.h:50
std::vector< Vec3 > vertices
Definition DataStructs.h:49
Vec3 operator*(double c) const
Definition DataStructs.h:22
Vec3 operator-(Vec3 const &o) const
Definition DataStructs.h:17
Vec3 operator+(Vec3 const &o) const
Definition DataStructs.h:12