app
android
jni
tango-gl
circle.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2014 Google Inc. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#include "
tango-gl/circle.h
"
18
19
namespace
tango_gl
{
20
Circle::Circle
(
float
radius,
int
resolution) :
Mesh
(GL_TRIANGLE_FAN){
21
SetShader
();
22
std::vector<GLfloat>
vertices
;
23
vertices
.reserve(3 * (resolution + 2));
24
vertices
.push_back(0);
25
vertices
.push_back(0);
26
vertices
.push_back(0);
27
float
delta_theta =
M_PI
* 2.0f /
static_cast<
float
>
(resolution);
28
for
(
int
i
= resolution;
i
>= 0;
i
--) {
29
float
theta = delta_theta *
static_cast<
float
>
(
i
);
30
vertices
.push_back(
cos
(theta) * radius);
31
vertices
.push_back(0);
32
vertices
.push_back(
sin
(theta) * radius);
33
}
34
SetVertices
(
vertices
);
35
}
36
}
// namespace tango_gl
tango_gl::DrawableObject::SetVertices
void SetVertices(const std::vector< GLfloat > &vertices)
Definition:
drawable_object.cpp:51
tango_gl::vertices
static const float vertices[]
Definition:
quad.cpp:39
tango_gl::Circle::Circle
Circle(float radius, int resolution)
Definition:
circle.cpp:20
circle.h
M_PI
#define M_PI
Definition:
tango-gl/include/tango-gl/util.h:66
glm::cos
GLM_FUNC_DECL genType cos(genType const &angle)
tango_gl::Mesh::SetShader
void SetShader()
Definition:
mesh.cpp:28
tango_gl
Definition:
axis.cpp:20
tango_gl::Mesh
Definition:
mesh.h:25
i
int i
glm::sin
GLM_FUNC_DECL genType sin(genType const &angle)
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:07