Go to the documentation of this file.
36 #if MRPT_HAS_OPENGL_GLUT
47 const size_t N = pts.size();
48 for (
size_t i = 0; i < N; i++)
glVertex2f(pts[i][0], pts[i][1]);
70 #if MRPT_HAS_OPENGL_GLUT
84 const size_t idx_1st_slice = 1;
89 for (
size_t i = 0; i < stacks; i++)
98 for (
size_t s = 0;
s < slices - 3;
s++)
100 size_t idx_this_slice = idx_1st_slice + stacks *
s;
101 size_t idx_next_slice = idx_this_slice + stacks;
103 for (
size_t i = 0; i < stacks; i++)
106 (i == (stacks - 1) ? 0 : i + 1);
121 const size_t idx_last_pt = pts.size() - 1;
122 const size_t idx_last_slice = idx_1st_slice + (slices - 3) * stacks;
124 for (
size_t i = 0; i < stacks; i++)
158 out_params_pts.clear();
159 out_params_pts.reserve(numSegments);
160 const double Aa = 2 *
M_PI / numSegments;
161 for (
double ang = 0; ang < 2 *
M_PI; ang += Aa)
163 const double ccos = cos(ang);
164 const double ssin = sin(ang);
166 out_params_pts.resize(out_params_pts.size() + 1);
168 Eigen::Matrix<float, 2, 1>& pt = out_params_pts.back();
170 pt[0] =
mean[0] + ccos * U.get_unsafe(0, 0) + ssin * U.get_unsafe(0, 1);
171 pt[1] =
mean[1] + ccos * U.get_unsafe(1, 0) + ssin * U.get_unsafe(1, 1);
176 const double x,
const double y,
const double z,
181 pts.resize(pts.size() + 1);
183 pt[0] =
mean[0] +
x * M.get_unsafe(0, 0) +
y * M.get_unsafe(0, 1) +
184 z * M.get_unsafe(0, 2);
185 pt[1] =
mean[1] +
x * M.get_unsafe(1, 0) +
y * M.get_unsafe(1, 1) +
186 z * M.get_unsafe(1, 2);
187 pt[2] =
mean[2] +
x * M.get_unsafe(2, 0) +
y * M.get_unsafe(2, 1) +
188 z * M.get_unsafe(2, 2);
206 std::vector<double> slice_cos(slices), slice_sin(slices);
207 for (
uint32_t i = 0; i < slices; i++)
209 double angle =
M_PI * i / double(slices - 1);
210 slice_sin[i] = sin(angle);
211 slice_cos[i] = cos(angle);
214 std::vector<double> stack_sin(stacks), stack_cos(stacks);
215 for (
uint32_t i = 0; i < stacks; i++)
217 double angle = 2 *
M_PI * i / double(stacks);
218 stack_sin[i] = sin(angle);
219 stack_cos[i] = cos(angle);
227 pts.reserve((slices - 2) * stacks + 2);
229 for (
uint32_t i = 0; i < slices; i++)
233 else if (i == (slices - 1))
237 const double x = slice_cos[i];
238 const double R = slice_sin[i];
240 for (
uint32_t j = 0; j < stacks; j++)
242 const double y =
R * stack_cos[j];
243 const double z =
R * stack_sin[j];
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glVertex3fv(const GLfloat *v)
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
GLAPI void GLAPIENTRY glDisable(GLenum cap)
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y)
GLAPI void GLAPIENTRY glEnd(void)
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
void generalizedEllipsoidPoints< 3 >(const mrpt::math::CMatrixFixedNumeric< double, 3, 3 > &U, const mrpt::math::CMatrixFixedNumeric< double, 3, 1 > &mean, std::vector< mrpt::math::CMatrixFixedNumeric< float, 3, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
#define GL_ONE_MINUS_SRC_ALPHA
A numeric matrix of compile-time fixed size.
void renderGeneralizedEllipsoidTemplate< 2 >(const std::vector< mrpt::math::CMatrixFixedNumeric< float, 2, 1 >> &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
#define ASSERT_ABOVEEQ_(__A, __B)
void generalizedEllipsoidPoints< 2 >(const mrpt::math::CMatrixFixedNumeric< double, 2, 2 > &U, const mrpt::math::CMatrixFixedNumeric< double, 2, 1 > &mean, std::vector< mrpt::math::CMatrixFixedNumeric< float, 2, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
void aux_add3DpointWithEigenVectors(const double x, const double y, const double z, std::vector< mrpt::math::CMatrixFixedNumeric< float, 3, 1 >> &pts, const mrpt::math::CMatrixFixedNumeric< double, 3, 3 > &M, const mrpt::math::CMatrixFixedNumeric< double, 3, 1 > &mean)
This base provides a set of functions for maths stuff.
void renderGeneralizedEllipsoidTemplate< 3 >(const std::vector< mrpt::math::CMatrixFixedNumeric< float, 3, 1 >> &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
The namespace for 3D scene representation and rendering.
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |