28 float radius,
int nDivsLongitude,
int nDivsLatitude)
30 return CSpherePtr(
new CSphere(radius,nDivsLongitude,nDivsLatitude) );
37 #if MRPT_HAS_OPENGL_GLUT 38 if ( m_color.A != 255 )
47 if (m_keepRadiusIndependentEyeDistance)
53 float eye_distance= raster_pos[3];
55 eye_distance = max( eye_distance , 0.1f);
57 real_radius = 0.01*m_radius * eye_distance;
59 else real_radius = m_radius;
62 GLUquadricObj *
obj = gluNewQuadric();
65 gluQuadricDrawStyle(
obj,GLU_FILL);
66 gluQuadricNormals(
obj,GLU_SMOOTH);
68 gluSphere(
obj, real_radius ,m_nDivsLongitude,m_nDivsLatitude);
71 gluDeleteQuadric(
obj);
74 if ( m_color.A != 255 )
92 writeToStreamRender(out);
95 << m_keepRadiusIndependentEyeDistance;
111 readFromStreamRender(
in);
115 m_nDivsLongitude = i;
118 in >> m_keepRadiusIndependentEyeDistance;
119 else m_keepRadiusIndependentEyeDistance =
false;
135 double x=transf.
x(),
y=transf.
y(),
z=transf.z();
136 double r2=m_radius*m_radius;
138 if (dyz>r2)
return false;
139 double dx=sqrt(r2-dyz);
143 }
else if (
x+dx>=0) {
151 bb_min.
x = -m_radius;
152 bb_min.
y = -m_radius;
153 bb_min.
z = -m_radius;
160 m_pose.composePoint(bb_min, bb_min);
161 m_pose.composePoint(bb_max, bb_max);
double x() const
Common members of all points & poses classes.
void render_dl() const MRPT_OVERRIDE
Render.
GLAPI void GLAPIENTRY glGetFloatv(GLenum pname, GLfloat *params)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glRasterPos3f(GLfloat x, GLfloat y, GLfloat z)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
#define GL_ONE_MINUS_SRC_ALPHA
double z
X,Y,Z coordinates.
GLsizei GLsizei GLuint * obj
#define GL_CURRENT_RASTER_POSITION
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Ray tracing.
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A renderizable object suitable for rendering with OpenGL's display lists.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
This base provides a set of functions for maths stuff.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
A solid or wire-frame sphere.
The namespace for 3D scene representation and rendering.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
unsigned __int32 uint32_t
GLAPI void GLAPIENTRY glDisable(GLenum cap)