27 float radius,
int nDivsLongitude,
int nDivsLatitude)
36 #if MRPT_HAS_OPENGL_GLUT
46 if (m_keepRadiusIndependentEyeDistance)
52 float eye_distance = raster_pos[3];
54 eye_distance = max(eye_distance, 0.1f);
56 real_radius = 0.01 * m_radius * eye_distance;
59 real_radius = m_radius;
61 GLUquadricObj*
obj = gluNewQuadric();
64 gluQuadricDrawStyle(
obj, GLU_FILL);
65 gluQuadricNormals(
obj, GLU_SMOOTH);
67 gluSphere(
obj, real_radius, m_nDivsLongitude, m_nDivsLatitude);
70 gluDeleteQuadric(
obj);
91 writeToStreamRender(out);
94 << m_keepRadiusIndependentEyeDistance;
109 readFromStreamRender(
in);
113 m_nDivsLongitude = i;
116 in >> m_keepRadiusIndependentEyeDistance;
118 m_keepRadiusIndependentEyeDistance =
false;
137 CPose3D transf = this->m_pose - o;
138 double x = transf.
x(),
y = transf.
y(),
z = transf.z();
139 double r2 = m_radius * m_radius;
140 double dyz =
y *
y +
z *
z;
141 if (dyz > r2)
return false;
142 double dx = sqrt(r2 - dyz);
148 else if (
x + dx >= 0)
160 bb_min.
x = -m_radius;
161 bb_min.
y = -m_radius;
162 bb_min.
z = -m_radius;
169 m_pose.composePoint(bb_min, bb_min);
170 m_pose.composePoint(bb_max, bb_max);
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
A solid or wire-frame sphere.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void render_dl() const override
Render.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
std::shared_ptr< CSphere > Ptr
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double x() const
Common members of all points & poses classes.
std::shared_ptr< CObject > Ptr
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
GLAPI void GLAPIENTRY glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
#define GL_CURRENT_RASTER_POSITION
#define GL_ONE_MINUS_SRC_ALPHA
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLAPI void GLAPIENTRY glGetFloatv(GLenum pname, GLfloat *params)
GLsizei GLsizei GLuint * obj
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
The namespace for 3D scene representation and rendering.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
double x
X,Y,Z coordinates.