Go to the documentation of this file.
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);
66 writeToStreamRender(out);
68 out << mBaseRadius << mTopRadius << mHeight << mSlices << mStacks
69 << mHasBottomBase << mHasTopBase;
77 readFromStreamRender(
in);
78 in >> mBaseRadius >> mTopRadius >> mHeight >> mSlices >> mStacks >>
79 mHasBottomBase >> mHasTopBase;
100 return (
t = -
b /
a) >= 0;
106 t = (-
b - delta) /
a;
109 else if (-
b + delta > 0)
111 t = (-
b + delta) /
a;
132 if (!reachesHeight(lin.
pBase.
z))
return false;
134 return getRadius(
static_cast<float>(lin.
pBase.
z),
r)
150 if (nDist <= mBaseRadius)
159 if (tZ0 > 0 && (!fnd || tZ0 < dist))
164 if (nDist <= mTopRadius)
171 if (mBaseRadius == mTopRadius)
178 if ((!fnd || nDist < dist) &&
187 double slope = (mTopRadius - mBaseRadius) / mHeight;
192 (mBaseRadius + slope * lin.
pBase.
z) * slope *
197 if ((!fnd || nDist < dist) &&
210 bb_min.
x = -std::max(mBaseRadius, mTopRadius);
214 bb_max.
x = std::max(mBaseRadius, mTopRadius);
219 m_pose.composePoint(bb_min, bb_min);
220 m_pose.composePoint(bb_max, bb_max);
void createFromPoseX(const mrpt::math::TPose3D &p, TLine3D &r)
Gets a 3D line corresponding to the X axis in a given pose.
GLAPI void GLAPIENTRY glPopMatrix(void)
TPoint3D pBase
Base point.
A renderizable object suitable for rendering with OpenGL's display lists.
GLsizei GLsizei GLuint * obj
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
GLAPI void GLAPIENTRY glDisable(GLenum cap)
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
A cylinder or cone whose base lies in the XY plane.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
T square(const T x)
Inline function for the square of a number.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
GLAPI void GLAPIENTRY glPushMatrix(void)
Virtual base class for "archives": classes abstracting I/O streams.
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...
GLdouble GLdouble GLdouble r
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
#define GL_ONE_MINUS_SRC_ALPHA
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double x
X,Y,Z coordinates.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
void unitarize()
Unitarize director vector.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
bool solveEqn(double a, double b, double c, double &t)
This base provides a set of functions for maths stuff.
3D line, represented by a base point and a director vector.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
The namespace for 3D scene representation and rendering.
double director[3]
Director vector.
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
double getEpsilon()
Gets the value of the geometric epsilon (default = 1e-5)
GLubyte GLubyte GLubyte a
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |