CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
third-party
marchingcube
DataStructs.h
Go to the documentation of this file.
1
#pragma once
2
#include <vector>
3
#include <array>
4
#include <functional>
5
6
namespace
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
32
Vec3
Normalized
()
const
33
{
34
auto
n =
Norm
();
35
return
{
x
/ n,
y
/ n,
z
/ n};
36
}
37
};
38
39
struct
Rect3
40
{
41
Vec3
min
;
42
Vec3
size
;
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
}
MeshReconstruction
Definition
Cube.h:5
MeshReconstruction::Triangle
std::array< int, 3 > Triangle
Definition
DataStructs.h:45
MeshReconstruction::Fun3v
std::function< Vec3(Vec3 const &)> Fun3v
Definition
DataStructs.h:55
MeshReconstruction::Fun3s
std::function< double(Vec3 const &)> Fun3s
Definition
DataStructs.h:54
MeshReconstruction::Mesh
Definition
DataStructs.h:48
MeshReconstruction::Mesh::vertexNormals
std::vector< Vec3 > vertexNormals
Definition
DataStructs.h:51
MeshReconstruction::Mesh::triangles
std::vector< Triangle > triangles
Definition
DataStructs.h:50
MeshReconstruction::Mesh::vertices
std::vector< Vec3 > vertices
Definition
DataStructs.h:49
MeshReconstruction::Rect3
Definition
DataStructs.h:40
MeshReconstruction::Rect3::size
Vec3 size
Definition
DataStructs.h:42
MeshReconstruction::Rect3::min
Vec3 min
Definition
DataStructs.h:41
MeshReconstruction::Vec3
Definition
DataStructs.h:9
MeshReconstruction::Vec3::Norm
double Norm() const
Definition
DataStructs.h:27
MeshReconstruction::Vec3::x
double x
Definition
DataStructs.h:10
MeshReconstruction::Vec3::operator*
Vec3 operator*(double c) const
Definition
DataStructs.h:22
MeshReconstruction::Vec3::y
double y
Definition
DataStructs.h:10
MeshReconstruction::Vec3::operator-
Vec3 operator-(Vec3 const &o) const
Definition
DataStructs.h:17
MeshReconstruction::Vec3::z
double z
Definition
DataStructs.h:10
MeshReconstruction::Vec3::operator+
Vec3 operator+(Vec3 const &o) const
Definition
DataStructs.h:12
MeshReconstruction::Vec3::Normalized
Vec3 Normalized() const
Definition
DataStructs.h:32
Generated by
1.18.0