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);
85 writeToStreamRender(out);
88 << m_keepRadiusIndependentEyeDistance;
97 readFromStreamRender(
in);
101 m_nDivsLongitude = i;
104 in >> m_keepRadiusIndependentEyeDistance;
106 m_keepRadiusIndependentEyeDistance =
false;
125 CPose3D transf = this->m_pose - o;
126 double x = transf.
x(),
y = transf.
y(),
z = transf.z();
127 double r2 = m_radius * m_radius;
128 double dyz =
y *
y +
z *
z;
129 if (dyz > r2)
return false;
130 double dx = sqrt(r2 - dyz);
136 else if (
x + dx >= 0)
148 bb_min.
x = -m_radius;
149 bb_min.
y = -m_radius;
150 bb_min.
z = -m_radius;
157 m_pose.composePoint(bb_min, bb_min);
158 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)
std::shared_ptr< CRenderizable > Ptr
A solid or wire-frame sphere.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
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 render_dl() const override
Render.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
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.
Virtual base class for "archives": classes abstracting I/O streams.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
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
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...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
double x
X,Y,Z coordinates.