29 const std::vector<mrpt::math::CMatrixFixed<float, 2, 1>>& pts,
32 #if MRPT_HAS_OPENGL_GLUT 43 const size_t N = pts.size();
44 for (
size_t i = 0; i < N; i++)
glVertex2f(pts[i][0], pts[i][1]);
63 const std::vector<mrpt::math::CMatrixFixed<float, 3, 1>>& pts,
66 #if MRPT_HAS_OPENGL_GLUT 80 const size_t idx_1st_slice = 1;
85 for (
size_t i = 0; i < stacks; i++)
94 for (
size_t s = 0;
s < slices - 3;
s++)
96 size_t idx_this_slice = idx_1st_slice + stacks *
s;
97 size_t idx_next_slice = idx_this_slice + stacks;
99 for (
size_t i = 0; i < stacks; i++)
102 (i == (stacks - 1) ? 0 : i + 1);
117 const size_t idx_last_pt = pts.size() - 1;
118 const size_t idx_last_slice = idx_1st_slice + (slices - 3) * stacks;
120 for (
size_t i = 0; i < stacks; i++)
150 std::vector<mrpt::math::CMatrixFixed<float, 2, 1>>& out_params_pts,
154 out_params_pts.clear();
155 out_params_pts.reserve(numSegments);
156 const double Aa = 2 *
M_PI / numSegments;
157 for (
double ang = 0; ang < 2 *
M_PI; ang += Aa)
159 const double ccos = cos(ang);
160 const double ssin = sin(ang);
162 out_params_pts.resize(out_params_pts.size() + 1);
164 auto& pt = out_params_pts.back();
166 pt[0] =
mean[0] + ccos * U(0, 0) + ssin * U(0, 1);
167 pt[1] =
mean[1] + ccos * U(1, 0) + ssin * U(1, 1);
172 const double x,
const double y,
const double z,
177 pts.resize(pts.size() + 1);
179 pt[0] =
mean[0] +
x * M(0, 0) +
y * M(0, 1) +
z * M(0, 2);
180 pt[1] =
mean[1] +
x * M(1, 0) +
y * M(1, 1) +
z * M(1, 2);
181 pt[2] =
mean[2] +
x * M(2, 0) +
y * M(2, 1) +
z * M(2, 2);
191 std::vector<mrpt::math::CMatrixFixed<float, 3, 1>>& pts,
199 std::vector<double> slice_cos(slices), slice_sin(slices);
200 for (
uint32_t i = 0; i < slices; i++)
202 double angle =
M_PI * i / double(slices - 1);
203 slice_sin[i] = sin(angle);
204 slice_cos[i] = cos(angle);
207 std::vector<double> stack_sin(stacks), stack_cos(stacks);
208 for (
uint32_t i = 0; i < stacks; i++)
210 double angle = 2 *
M_PI * i / double(stacks);
211 stack_sin[i] = sin(angle);
212 stack_cos[i] = cos(angle);
220 pts.reserve((slices - 2) * stacks + 2);
222 for (
uint32_t i = 0; i < slices; i++)
226 else if (i == (slices - 1))
230 const double x = slice_cos[i];
231 const double R = slice_sin[i];
233 for (
uint32_t j = 0; j < stacks; j++)
235 const double y =
R * stack_cos[j];
236 const double z =
R * stack_sin[j];
A compile-time fixed-size numeric matrix container.
GLAPI void GLAPIENTRY glVertex3fv(const GLfloat *v)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
void renderGeneralizedEllipsoidTemplate< 3 >(const std::vector< mrpt::math::CMatrixFixed< float, 3, 1 >> &pts, const float lineWidth, const uint32_t slices, const uint32_t stacks)
#define GL_ONE_MINUS_SRC_ALPHA
void generalizedEllipsoidPoints< 2 >(const mrpt::math::CMatrixFixed< double, 2, 2 > &U, const mrpt::math::CMatrixFixed< double, 2, 1 > &mean, std::vector< mrpt::math::CMatrixFixed< float, 2, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
This base provides a set of functions for maths stuff.
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
GLAPI void GLAPIENTRY glBegin(GLenum mode)
#define ASSERT_ABOVEEQ_(__A, __B)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void generalizedEllipsoidPoints< 3 >(const mrpt::math::CMatrixFixed< double, 3, 3 > &U, const mrpt::math::CMatrixFixed< double, 3, 1 > &mean, std::vector< mrpt::math::CMatrixFixed< float, 3, 1 >> &out_params_pts, const uint32_t slices, const uint32_t stacks)
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
The namespace for 3D scene representation and rendering.
double mean(const CONTAINER &v)
Computes the mean value of a vector.
GLAPI void GLAPIENTRY glEnd(void)
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
void renderGeneralizedEllipsoidTemplate< 2 >(const std::vector< mrpt::math::CMatrixFixed< float, 2, 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::CMatrixFixed< float, 3, 1 >> &pts, const mrpt::math::CMatrixFixed< double, 3, 3 > &M, const mrpt::math::CMatrixFixed< double, 3, 1 > &mean)
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.