30 const std::vector<mrpt::math::CMatrixFixedNumeric<float,2,1> > & pts,
31 const float lineWidth,
35 #if MRPT_HAS_OPENGL_GLUT 43 const size_t N = pts.size();
44 for (
size_t i=0;i<N;i++)
61 const std::vector<mrpt::math::CMatrixFixedNumeric<float,3,1> > & pts,
62 const float lineWidth,
67 #if MRPT_HAS_OPENGL_GLUT 79 const size_t idx_1st_slice = 1;
84 for (
size_t i=0;i<stacks;i++)
93 for (
size_t s=0;
s<slices-3;
s++)
95 size_t idx_this_slice = idx_1st_slice + stacks*
s;
96 size_t idx_next_slice = idx_this_slice + stacks;
98 for (
size_t i=0;i<stacks;i++)
100 const size_t ii = (i==(stacks-1) ? 0 : i+1);
115 const size_t idx_last_pt = pts.size()-1;
116 const size_t idx_last_slice = idx_1st_slice + (slices-3)*stacks;
118 for (
size_t i=0;i<stacks;i++)
146 std::vector<mrpt::math::CMatrixFixedNumeric<float,2,1> > &out_params_pts,
151 out_params_pts.clear();
152 out_params_pts.reserve(numSegments);
153 const double Aa = 2*
M_PI/numSegments;
154 for (
double ang=0;ang<2*
M_PI;ang+=Aa)
156 const double ccos = cos(ang);
157 const double ssin = sin(ang);
159 out_params_pts.resize(out_params_pts.size()+1);
161 Eigen::Matrix<float,2,1> &pt = out_params_pts.back();
163 pt[0] =
mean[0] + ccos * U.get_unsafe(0,0) + ssin * U.get_unsafe(0,1);
164 pt[1] =
mean[1] + ccos * U.get_unsafe(1,0) + ssin * U.get_unsafe(1,1);
179 pts.resize(pts.size()+1);
181 pt[0] =
mean[0] +
x * M.get_unsafe(0,0) +
y * M.get_unsafe(0,1) +
z * M.get_unsafe(0,2);
182 pt[1] =
mean[1] +
x * M.get_unsafe(1,0) +
y * M.get_unsafe(1,1) +
z * M.get_unsafe(1,2);
183 pt[2] =
mean[2] +
x * M.get_unsafe(2,0) +
y * M.get_unsafe(2,1) +
z * M.get_unsafe(2,2);
194 std::vector<mrpt::math::CMatrixFixedNumeric<float,3,1> > & pts,
204 std::vector<double> slice_cos(slices),slice_sin(slices);
205 for (
uint32_t i = 0; i < slices; i++)
207 double angle =
M_PI * i / double(slices-1);
208 slice_sin[i] = sin(angle);
209 slice_cos[i] = cos(angle);
212 std::vector<double> stack_sin(stacks),stack_cos(stacks);
213 for (
uint32_t i = 0; i < stacks; i++)
215 double angle = 2*
M_PI * i / double(stacks);
216 stack_sin[i] = sin(angle);
217 stack_cos[i] = cos(angle);
225 pts.reserve((slices-2)*stacks+2);
231 else if (i==(slices-1))
235 const double x = slice_cos[i];
236 const double R = slice_sin[i];
240 const double y =
R*stack_cos[j];
241 const double z =
R*stack_sin[j];
#define ASSERT_EQUAL_(__A, __B)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLAPI void GLAPIENTRY glVertex3fv(const GLfloat *v)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
#define GL_ONE_MINUS_SRC_ALPHA
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
void renderGeneralizedEllipsoidTemplate< 2 >(const std::vector< mrpt::math::CMatrixFixedNumeric< float, 2, 1 > > &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
void OPENGL_IMPEXP 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)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
void renderGeneralizedEllipsoidTemplate< 3 >(const std::vector< mrpt::math::CMatrixFixedNumeric< float, 3, 1 > > &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
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 is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERT_ABOVEEQ_(__A, __B)
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
The namespace for 3D scene representation and rendering.
GLAPI void GLAPIENTRY glEnd(void)
void OPENGL_IMPEXP 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)
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.