gtsam_points
Loading...
Searching...
No Matches
cone.hpp
Go to the documentation of this file.
1#ifndef GLK_PRIMITIVES_CONE_HPP
2#define GLK_PRIMITIVES_CONE_HPP
3
4#include <map>
5#include <vector>
6#include <Eigen/Core>
7
8namespace glk {
9
10class Cone {
11public:
12 Cone(int div = 10) {
13 vertices.push_back(Eigen::Vector3f::Zero());
14 vertices.push_back(Eigen::Vector3f::UnitZ());
15
16 double step = 2.0 * M_PI / div;
17 for (int i = 0; i < div; i++) {
18 double rad = step * i;
19 vertices.push_back(Eigen::Vector3f(std::cos(rad), std::sin(rad), 0.0f));
20
21 int current_index = i + 2;
22 int next_index = ((i + 1) % div) + 2;
23
24 indices.push_back(0);
25 indices.push_back(current_index);
26 indices.push_back(next_index);
27
28 indices.push_back(current_index);
29 indices.push_back(1);
30 indices.push_back(next_index);
31 }
32 }
33
34public:
35 std::vector<Eigen::Vector3f> vertices;
36 std::vector<int> indices;
37};
38
39} // namespace glk
40
41#endif
Definition cone.hpp:10
std::vector< Eigen::Vector3f > vertices
Definition cone.hpp:35
std::vector< int > indices
Definition cone.hpp:36
Cone(int div=10)
Definition cone.hpp:12
Definition async_buffer_copy.hpp:6
std::enable_if_t< needs_aligned_allocator< T >::value, std::shared_ptr< T > > make_shared(Args &&... args)
Definition make_shared.hpp:20