25 CCylinderPtr
CCylinder::Create(const
float baseRadius,const
float topRadius,const
float height,const
int slices,const
int stacks)
27 return CCylinderPtr(
new CCylinder(baseRadius,topRadius,
height,slices,stacks));
33 #if MRPT_HAS_OPENGL_GLUT 38 GLUquadricObj *
obj=gluNewQuadric();
41 const float absHeight = std::abs(mHeight);
48 gluCylinder(
obj,mBaseRadius,mTopRadius,absHeight,mSlices,mStacks);
53 if (mHasBottomBase) gluDisk(
obj,0,mBaseRadius,mSlices,1);
54 if (mHasTopBase&&mTopRadius>0) {
57 gluDisk(
obj,0,mTopRadius,mSlices,1);
60 gluDeleteQuadric(
obj);
73 writeToStreamRender(out);
75 out<<mBaseRadius<<mTopRadius<<mHeight<<mSlices<<mStacks<<mHasBottomBase<<mHasTopBase;
86 readFromStreamRender(
in);
87 in>>mBaseRadius>>mTopRadius>>mHeight>>mSlices>>mStacks>>mHasBottomBase>>mHasTopBase;
103 if (delta==0)
return (
t=-
b/
a)>=0;
109 }
else if (-
b+delta>0) {
126 if (!reachesHeight(lin.
pBase.
z))
return false;
134 if (nDist<=mBaseRadius) {
141 if (tZ0>0&&(!fnd||tZ0<dist)) {
143 if (nDist<=mTopRadius) {
149 if (mBaseRadius==mTopRadius) {
155 double slope=(mTopRadius-mBaseRadius)/mHeight;
168 bb_min.
x = -std::max(mBaseRadius,mTopRadius);
172 bb_max.
x = std::max(mBaseRadius,mTopRadius);
177 m_pose.composePoint(bb_min, bb_min);
178 m_pose.composePoint(bb_max, bb_max);
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
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...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
GLAPI void GLAPIENTRY glPopMatrix(void)
TPoint3D pBase
Base point.
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
class OPENGL_IMPEXP CCylinder
double z
X,Y,Z coordinates.
GLsizei GLsizei GLuint * obj
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
T square(const T x)
Inline function for the square of a number.
A renderizable object suitable for rendering with OpenGL's display lists.
void BASE_IMPEXP createFromPoseX(const mrpt::poses::CPose3D &p, TLine3D &r)
Gets a 3D line corresponding to the X axis in a given pose.
void render_dl() const MRPT_OVERRIDE
Render.
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...
A cylinder or cone whose base lies in the XY plane.
void unitarize()
Unitarize director vector.
double director[3]
Director vector.
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const MRPT_OVERRIDE
Ray tracing.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool solveEqn(double a, double b, double c, double &t)
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
The namespace for 3D scene representation and rendering.
GLAPI void GLAPIENTRY glPushMatrix(void)
GLenum GLsizei GLsizei height
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLubyte GLubyte GLubyte a
double BASE_IMPEXP geometryEpsilon
Global epsilon to overcome small precision errors (Default=1e-5)
3D line, represented by a base point and a director vector.