class mrpt::viz::CSetOfLines

Python API: mrpt.viz.CSetOfLines

Overview

A set of independent lines (or segments), one line with its own start and end positions (X,Y,Z).

Optionally, the vertices can be also shown as dots.

mrpt::viz::CSetOfLines

See also:

opengl::Scene

#include <mrpt/viz/CSetOfLines.h>

class CSetOfLines:
    public mrpt::viz::CVisualObject,
    public mrpt::viz::VisualObjectParams_Points,
    public mrpt::viz::VisualObjectParams_Lines
{
public:
    // typedefs

    typedef std::shared_ptr<mrpt::viz ::CSetOfLines> Ptr;
    typedef std::shared_ptr<const mrpt::viz ::CSetOfLines> ConstPtr;
    typedef std::unique_ptr<mrpt::viz ::CSetOfLines> UniquePtr;
    typedef std::unique_ptr<const mrpt::viz ::CSetOfLines> ConstUniquePtr;
    typedef std::vector<mrpt::math::TSegment3D>::iterator iterator;
    typedef std::vector<mrpt::math::TSegment3D>::reverse_iterator reverse_iterator;
    typedef std::vector<mrpt::math::TSegment3D>::const_iterator const_iterator;
    typedef std::vector<mrpt::math::TSegment3D>::const_reverse_iterator const_reverse_iterator;

    // fields

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

    // construction

    CSetOfLines();
    CSetOfLines(const std::vector<mrpt::math::TSegment3D>& sgms, bool antiAliasing = true);

    // 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;
    void clear();
    float getVerticesPointSize() const;
    void setVerticesPointSize(const float size_points);
    void appendLine(const mrpt::math::TSegment3D& sgm);
    void appendLine(double x0, double y0, double z0, double x1, double y1, double z1);
    void appendLineStrip(float x, float y, float z);

    template <class U>
    void appendLineStrip(const U& point);

    template <class T>
    void appendLines(const T& sgms);

    template <class T_it>
    void appendLines(const T_it& begin, const T_it& end);

    void resize(size_t nLines);
    void reserve(size_t r);

    template <class T, class U>
    void appendLine(T p0, U p1);

    size_t size() const;
    bool empty() const;
    virtual void updateBuffers() const;
    void setLineByIndex(size_t index, const mrpt::math::TSegment3D& segm);

    void setLineByIndex(
        size_t index,
        double x0,
        double y0,
        double z0,
        double x1,
        double y1,
        double z1
        );

    void getLineByIndex(
        size_t index,
        double& x0,
        double& y0,
        double& z0,
        double& x1,
        double& y1,
        double& z1
        ) const;

    const_iterator begin() const;
    iterator begin();
    const_iterator end() const;
    iterator end();
    const_reverse_iterator rbegin() const;
    const_reverse_iterator rend() 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;
    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;

    // structs

    struct BuffersVersion;
    struct ChangeCounter;
    struct PoseAndScale;
    struct State;

    // methods

    mrpt::rtti::CObject::Ptr duplicateGetSmartPtr() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual CObject* clone() const = 0;
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    void setName(const std::string& n);
    std::string getName() const;
    bool isVisible() const;
    void setVisibility(bool visible = true);
    bool castShadows() const;
    void castShadows(bool doCast);
    void enableShowName(bool showName = true);
    bool isShowNameEnabled() const;
    CVisualObject& setPose(const mrpt::poses::CPose3D& o);
    CVisualObject& setPose(const mrpt::poses::CPose2D& o);
    CVisualObject& setPose(const mrpt::math::TPose3D& o);
    CVisualObject& setPose(const mrpt::math::TPose2D& o);
    CVisualObject& setPose(const mrpt::poses::CPoint3D& o);
    CVisualObject& setPose(const mrpt::poses::CPoint2D& o);
    mrpt::math::TPose3D getPose() const;
    PoseAndScale getPoseAndScale() const;
    mrpt::poses::CPose3D getCPose() const;
    CVisualObject& setLocation(double x, double y, double z);
    CVisualObject& setLocation(const mrpt::math::TPoint3D& p);
    mrpt::img::TColorf getColor() const;
    mrpt::img::TColor getColor_u8() const;
    CVisualObject& setColorA(const float a);
    virtual CVisualObject& setColorA_u8(const uint8_t a);
    float materialShininess() const;
    void materialShininess(float shininess);
    float materialSpecularExponent() const;
    void materialSpecularExponent(float exponent);
    mrpt::img::TColorf materialEmissive() const;
    void materialEmissive(const mrpt::img::TColorf& color);
    CVisualObject& setScale(float s);
    CVisualObject& setScale(float sx, float sy, float sz);
    float getScaleX() const;
    float getScaleY() const;
    float getScaleZ() const;
    CVisualObject& setColor(const mrpt::img::TColorf& c);
    CVisualObject& setColor(float R, float G, float B, float A = 1);
    virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c);
    CVisualObject& setColor_u8(uint8_t R, uint8_t G, uint8_t B, uint8_t A = 255);
    virtual bool cullElegible() const;
    virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const;
    virtual bool isCompositeObject() const;
    virtual const std::deque<std::shared_ptr<CVisualObject>>& getInternalChildren() const;
    void notifyChange() const;
    void notifyTransformChange() const;
    void clearChangedFlag() const;
    void notifyBBoxChange() const;
    bool hasToUpdateBuffers() const;
    uint64_t dataVersion() const;
    uint64_t transformVersion() const;
    bool hasToUpdateBuffersSince(uint64_t sinceVersion) const;
    void updateBuffersIfNeeded() const;
    virtual void updateBuffers() const;
    virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
    auto getBoundingBox() const;
    auto getBoundingBoxLocal() const;
    auto getBoundingBoxLocalf() const;
    virtual mrpt::math::TPoint3Df getLocalRepresentativePoint() const;
    void setLocalRepresentativePoint(const mrpt::math::TPoint3Df& p);
    mrpt::viz::CText& labelObject() const;
    std::shared_ptr<mrpt::viz::CText> labelObjectPtr() const;
    const auto& shaderPointsVertexPointBuffer() const;
    const auto& shaderPointsVertexColorBuffer() const;
    auto& shaderPointsBuffersMutex() const;
    void setPointSize(float p);
    float getPointSize() const;
    void enableVariablePointSize(bool enable = true);
    bool isEnabledVariablePointSize() const;
    void setVariablePointSize_k(float v);
    float getVariablePointSize_k() const;
    void setVariablePointSize_DepthScale(float v);
    float getVariablePointSize_DepthScale() const;
    const auto& shaderLinesVertexPointBuffer() const;
    const auto& shaderLinesVertexColorBuffer() const;
    auto& shaderLinesBufferMutex() const;
    void setLineWidth(float w);
    float getLineWidth() const;
    void enableAntiAliasing(bool enable = true);
    bool isAntiAliasingEnabled() const;

Typedefs

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

A type for the associated smart pointer.

Construction

CSetOfLines()

Constructor.

CSetOfLines(const std::vector<mrpt::math::TSegment3D>& sgms, bool antiAliasing = true)

Constructor with a initial set of lines.

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.

void clear()

Clear the list of segments.

void setVerticesPointSize(const float size_points)

Enable showing vertices as dots if size_points>0.

void appendLine(const mrpt::math::TSegment3D& sgm)

Appends a line to the set.

void appendLine(
    double x0,
    double y0,
    double z0,
    double x1,
    double y1,
    double z1
    )

Appends a line to the set, given the coordinates of its bounds.

void appendLineStrip(float x, float y, float z)

Appends a line whose starting point is the end point of the last line (similar to OpenGL’s GL_LINE_STRIP)

Parameters:

std::exception

If there is no previous segment

template <class U>
void appendLineStrip(const U& point)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template <class T>
void appendLines(const T& sgms)

Appends any iterable collection of lines to the set.

Note that this includes another CSetOfLines.

See also:

appendLine

template <class T_it>
void appendLines(const T_it& begin, const T_it& end)

Appends certain amount of lines, located between two iterators, into the set.

See also:

appendLine

void resize(size_t nLines)

Resizes the set.

See also:

reserve

void reserve(size_t r)

Reserves an amount of lines to the set.

This method should be used when some known amount of lines is going to be inserted, so that only a memory allocation is needed.

See also:

resize

template <class T, class U>
void appendLine(T p0, U p1)

Inserts a line, given its bounds.

Works with any pair of objects with access to x, y and z members.

size_t size() const

Returns the total count of lines in this set.

bool empty() const

Returns true if there are no line segments.

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.

void setLineByIndex(size_t index, const mrpt::math::TSegment3D& segm)

Sets a specific line in the set, given its index.

See also:

appendLine

void setLineByIndex(
    size_t index,
    double x0,
    double y0,
    double z0,
    double x1,
    double y1,
    double z1
    )

Sets a specific line in the set, given its index.

See also:

appendLine

void getLineByIndex(
    size_t index,
    double& x0,
    double& y0,
    double& z0,
    double& x1,
    double& y1,
    double& z1
    ) const

Gets a specific line in the set, given its index.

See also:

getLineByIndex

const_iterator begin() const

Beginning const iterator.

See also:

end, rbegin, rend

const_iterator end() const

Ending const iterator.

See also:

begin, rend, rbegin

const_reverse_iterator rbegin() const

Beginning const reverse iterator (actually, accesses the end of the set).

See also:

rend, begin, end

const_reverse_iterator rend() const

Ending const reverse iterator (actually, refers to the starting point of the set).

See also:

rbegin, end, begin

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

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