class mrpt::viz::CCylinder

Overview

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

mrpt::viz::CCylinder mrpt::viz::CCylinder mrpt::viz::CCylinder mrpt::viz::CCylinder

See also:

opengl::Scene, opengl::CDisk

#include <mrpt/viz/CCylinder.h>

class CCylinder:
    public mrpt::viz::CVisualObject,
    public mrpt::viz::VisualObjectParams_Triangles
{
public:
    // construction

    CCylinder();

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

    // methods

    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 mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CObject> Ptr;
    typedef std::shared_ptr<const CObject> ConstPtr;
    typedef std::unique_ptr<CObject> UniquePtr;
    typedef std::unique_ptr<const CObject> ConstUniquePtr;

    // structs

    struct OutdatedState;
    struct State;

    // methods

    const auto& shaderTrianglesBuffer() const;
    auto& shaderTrianglesBufferMutex() const;
    virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c);
    bool isLightEnabled() const;
    void enableLight(bool enable = true);
    TCullFace cullFaces() const;
    void notifyBBoxChange() const;
    auto getBoundingBoxLocalf() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();

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 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 mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const

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