class mrpt::opengl::CCylinder

A cylinder or cone whose base lies in the XY plane.

See also:

opengl::COpenGLScene, opengl::CDisk

#include <mrpt/opengl/CCylinder.h>

class CCylinder: public mrpt::opengl::CRenderizableShaderTriangles
{
public:
    // construction

    CCylinder();

    CCylinder(
        const float baseRadius,
        const float topRadius,
        const float height = 1,
        const int slices = 10
        );

    //
methods

    virtual void onUpdateBuffers_Triangles();
    virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
    void setHasBases(bool top = true, bool bottom = true);
    bool hasTopBase() const;
    bool hasBottomBase() const;
    void setRadius(float radius);
    void setRadii(float bottom, float top);
    void setHeight(float height);
    float getBottomRadius() const;
    float getTopRadius() const;
    float getHeight() const;
    void setSlicesCount(uint32_t slices);
    uint32_t getSlicesCount() const;
    virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const;
};

Inherited Members

public:
    // structs

    struct RenderContext;

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual shader_list_t requiredShaders() const;
    virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const = 0;
    virtual void freeOpenGLResources() = 0;
    virtual void onUpdateBuffers_Triangles() = 0;

Construction

CCylinder(
    const float baseRadius,
    const float topRadius,
    const float height = 1,
    const int slices = 10
    )

Complete constructor.

Allows the configuration of every parameter.Constructor with two radii. Allows the construction of any cylinder.

Methods

virtual void onUpdateBuffers_Triangles()

Must be implemented in derived classes to update the geometric entities to be drawn in “m_*_buffer” fields.

virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const

Simulation of ray-trace, given a pose.

Returns true if the ray effectively collisions with the object (returning the distance to the origin of the ray in “dist”), or false in other case. “dist” variable yields undefined behaviour when false is returned

void setHasBases(bool top = true, bool bottom = true)

Configuration of the cylinder’s bases display.

bool hasTopBase() const

Check whether top base is displayed.

See also:

hasBottomBase

bool hasBottomBase() const

Check whether bottom base is displayed.

See also:

hasTopBase

void setRadius(float radius)

Sets both radii to a single value, thus configuring the object as a cylinder.

See also:

setRadii

void setRadii(float bottom, float top)

Sets both radii independently.

See also:

setRadius

void setHeight(float height)

Chenges cylinder’s height.

float getBottomRadius() const

Gets the bottom radius.

float getTopRadius() const

Gets the top radius.

float getHeight() const

Gets the cylinder’s height.

void setSlicesCount(uint32_t slices)

Number of radial divisions.

uint32_t getSlicesCount() const

Number of radial divisions.

virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const

Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.