class mrpt::viz::CArrow

Overview

A 3D arrow.

mrpt::viz::CArrow

See also:

opengl::Scene

#include <mrpt/viz/CArrow.h>

class CArrow:
    public mrpt::viz::CVisualObject,
    public mrpt::viz::VisualObjectParams_Triangles
{
public:
    // typedefs

    typedef std::shared_ptr<mrpt::viz ::CArrow> Ptr;
    typedef std::shared_ptr<const mrpt::viz ::CArrow> ConstPtr;
    typedef std::unique_ptr<mrpt::viz ::CArrow> UniquePtr;
    typedef std::unique_ptr<const mrpt::viz ::CArrow> ConstUniquePtr;

    // fields

    static constexpr const char* className = "mrpt::viz" "::" "CArrow";

    // construction

    CArrow();

    CArrow(
        const mrpt::math::TPoint3Df& from,
        const mrpt::math::TPoint3Df& to,
        float headRatio = 0.2f,
        float smallRadius = 0.05f,
        float largeRadius = 0.2f
        );

    // methods

    static constexpr auto getClassName();
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    static std::shared_ptr<CObject> CreateObject();

    template <typename... Args>
    static Ptr Create(Args&&... args);

    template <typename Alloc, typename... Args>
    static Ptr CreateAlloc(
        const Alloc& alloc,
        Args&&... args
        );

    template <typename... Args>
    static UniquePtr CreateUnique(Args&&... args);

    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual mrpt::rtti::CObject* clone() const;
    virtual CVisualObject& setColorA_u8(const uint8_t a);

    void setArrowEnds(
        float x0,
        float y0,
        float z0,
        float x1,
        float y1,
        float z1
        );

    template <typename Vector3Like>
    void setArrowEnds(
        const Vector3Like& start,
        const Vector3Like& end
        );

    void setHeadRatio(float rat);
    void setSmallRadius(float rat);
    void setLargeRadius(float rat);
    void setSlicesCount(uint32_t slices);
    uint32_t getSlicesCount() const;
    virtual void updateBuffers() const;
    virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const;
    virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
    void cullFaces(const TCullFace& cf);
};

Inherited Members

public:
    // typedefs

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

    // structs

    struct PoseAndScale;
    struct State;

    // methods

    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    const auto& shaderTrianglesBuffer() const;
    auto& shaderTrianglesBufferMutex() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    PoseAndScale getPoseAndScale() 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;

Typedefs

typedef std::shared_ptr<mrpt::viz ::CArrow> Ptr

A type for the associated smart pointer.

Methods

virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const

Returns information about the class of an object in runtime.

virtual mrpt::rtti::CObject* clone() const

Returns a deep copy (clone) of the object, indepently of its class.

virtual CVisualObject& setColorA_u8(const uint8_t a)

Set alpha (transparency) color component in the range [0,255].

Returns:

a ref to this

void setSlicesCount(uint32_t slices)

Number of radial divisions

uint32_t getSlicesCount() const

Number of radial divisions

virtual void updateBuffers() const

Called by the rendering system to update internal geometry buffers.

Derived classes should override this to populate their data buffers (triangles, points, lines) when the object geometry changes.

This is called automatically when hasToUpdateBuffers() returns true, which happens after notifyChange() was called.

The base implementation does nothing; derived classes should override.

Thread safety: implementations should lock the appropriate mutexes when writing to shared buffers.

virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const

Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates.

This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.

See also:

getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()

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 cullFaces(const TCullFace& cf)

Control whether to render the FRONT, BACK, or BOTH (default) set of faces.

Refer to docs for glCullFace(). Example: If set to cullFaces(TCullFace::BACK);, back faces will not be drawn (“culled”)