30 #if MRPT_HAS_OPENGL_GLUT
35 GLUquadricObj*
obj = gluNewQuadric();
38 const float absHeight = std::abs(mHeight);
45 gluCylinder(
obj, mBaseRadius, mTopRadius, absHeight, mSlices, mStacks);
49 if (mHasBottomBase) gluDisk(
obj, 0, mBaseRadius, mSlices, 1);
50 if (mHasTopBase && mTopRadius > 0)
54 gluDisk(
obj, 0, mTopRadius, mSlices, 1);
57 gluDeleteQuadric(
obj);
73 writeToStreamRender(out);
75 out << mBaseRadius << mTopRadius << mHeight << mSlices << mStacks
76 << mHasBottomBase << mHasTopBase;
89 readFromStreamRender(
in);
90 in >> mBaseRadius >> mTopRadius >> mHeight >> mSlices >> mStacks >>
91 mHasBottomBase >> mHasTopBase;
112 return (
t = -
b /
a) >= 0;
118 t = (-
b - delta) /
a;
121 else if (-
b + delta > 0)
123 t = (-
b + delta) /
a;
144 if (!reachesHeight(lin.
pBase.
z))
return false;
146 return getRadius(
static_cast<float>(lin.
pBase.
z),
r)
162 if (nDist <= mBaseRadius)
171 if (tZ0 > 0 && (!fnd || tZ0 < dist))
176 if (nDist <= mTopRadius)
183 if (mBaseRadius == mTopRadius)
190 if ((!fnd || nDist < dist) &&
199 double slope = (mTopRadius - mBaseRadius) / mHeight;
204 (mBaseRadius + slope * lin.
pBase.
z) * slope *
209 if ((!fnd || nDist < dist) &&
222 bb_min.
x = -std::max(mBaseRadius, mTopRadius);
226 bb_max.
x = std::max(mBaseRadius, mTopRadius);
231 m_pose.composePoint(bb_min, bb_min);
232 m_pose.composePoint(bb_max, bb_max);
bool solveEqn(double a, double b, double c, double &t)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
A cylinder or cone whose base lies in the XY plane.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
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 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...
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 class used to store a 3D pose (a 3D translation + a rotation in 3D).
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPushMatrix(void)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
GLAPI void GLAPIENTRY glPopMatrix(void)
#define GL_ONE_MINUS_SRC_ALPHA
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLsizei GLsizei GLuint * obj
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLdouble GLdouble GLdouble r
GLubyte GLubyte GLubyte a
void createFromPoseX(const mrpt::poses::CPose3D &p, TLine3D &r)
Gets a 3D line corresponding to the X axis in a given pose.
double getEpsilon()
Gets the value of the geometric epsilon (default = 1e-5)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
T square(const T x)
Inline function for the square of a number.
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
The namespace for 3D scene representation and rendering.
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.
3D line, represented by a base point and a director vector.
double director[3]
Director vector.
void unitarize()
Unitarize director vector.
TPoint3D pBase
Base point.
double x
X,Y,Z coordinates.