gtsam_points
Loading...
Searching...
No Matches
include
glk
primitives
frustum.hpp
Go to the documentation of this file.
1
#ifndef GLK_PRIMITIVES_FRUSTUM_HPP
2
#define GLK_PRIMITIVES_FRUSTUM_HPP
3
4
#include <vector>
5
#include <Eigen/Core>
6
7
namespace
glk
{
8
9
class
Frustum
{
10
public
:
11
Frustum
(
float
w
,
float
h
,
float
z
,
bool
close_front
) {
12
vertices
.push_back(Eigen::Vector3f(
w
/ 2,
h
/ 2,
z
));
// v0
13
vertices
.push_back(Eigen::Vector3f(-
w
/ 2,
h
/ 2,
z
));
// v1
14
vertices
.push_back(Eigen::Vector3f(-
w
/ 2, -
h
/ 2,
z
));
// v2
15
vertices
.push_back(Eigen::Vector3f(
w
/ 2, -
h
/ 2,
z
));
// v3
16
vertices
.push_back(Eigen::Vector3f(0, 0, 0));
// v4
17
18
normals
.push_back(
vertices
[0].
normalized
());
// n1
19
normals
.push_back(
vertices
[1].
normalized
());
// n2
20
normals
.push_back(
vertices
[2].
normalized
());
// n3
21
normals
.push_back(
vertices
[3].
normalized
());
// n4
22
normals
.push_back(Eigen::Vector3f(0, 0, 0));
// n5
23
24
indices
= {0, 4, 1, 1, 4, 2, 2, 4, 3, 3, 4, 0};
25
26
if
(
close_front
) {
27
std::array<int, 6>
front_indices
= {0, 1, 2, 0, 2, 3};
28
indices
.insert(
indices
.end(),
front_indices
.begin(),
front_indices
.end());
29
}
30
}
31
32
std::vector<Eigen::Vector3f>
vertices
;
33
std::vector<Eigen::Vector3f>
normals
;
34
std::vector<int>
indices
;
35
};
36
}
// namespace glk
37
38
#endif
glk::Frustum
Definition
frustum.hpp:9
glk::Frustum::indices
std::vector< int > indices
Definition
frustum.hpp:34
glk::Frustum::vertices
std::vector< Eigen::Vector3f > vertices
Definition
frustum.hpp:32
glk::Frustum::Frustum
Frustum(float w, float h, float z, bool close_front)
Definition
frustum.hpp:11
glk::Frustum::normals
std::vector< Eigen::Vector3f > normals
Definition
frustum.hpp:33
glk
Definition
async_buffer_copy.hpp:6
glk::make_shared
std::enable_if_t< needs_aligned_allocator< T >::value, std::shared_ptr< T > > make_shared(Args &&... args)
Definition
make_shared.hpp:20
Generated by
1.9.8