class mrpt::maps::CSimplePointsMap

Python API: mrpt.maps.CSimplePointsMap

Overview

A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.

This class only stores the coordinates (x,y,z) of each point.

See mrpt::maps::CPointsMap and derived classes for other point cloud classes.

See also:

CMetricMap, CPoint, mrpt::serialization::CSerializable

#include <mrpt/maps/CSimplePointsMap.h>

class CSimplePointsMap: public mrpt::maps::CPointsMap
{
public:
    // typedefs

    typedef std::shared_ptr<mrpt::maps ::CSimplePointsMap> Ptr;
    typedef std::shared_ptr<const mrpt::maps ::CSimplePointsMap> ConstPtr;
    typedef std::unique_ptr<mrpt::maps ::CSimplePointsMap> UniquePtr;
    typedef std::unique_ptr<const mrpt::maps ::CSimplePointsMap> ConstUniquePtr;

    // structs

    struct TMapDefinition;
    struct TMapDefinitionBase;

    // fields

    static constexpr const char* className = "mrpt::maps" "::" "CSimplePointsMap";
    static const size_t m_private_map_register_id =   mrpt::maps::internal::TMetricMapTypesRegistry::Instance().doRegister("mrpt::maps::CSimplePointsMap,pointsMap" ,& mrpt::maps::CSimplePointsMap ::MapDefinition,& mrpt::maps::CSimplePointsMap ::internal_CreateFromMapDefinition);

    // construction

    CSimplePointsMap();
    CSimplePointsMap(const CPointsMap& o);
    CSimplePointsMap(const CSimplePointsMap& o);

    // 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;
    static std::shared_ptr<mrpt::maps::TMetricMapInitializer> MapDefinition();
    static std::shared_ptr<CSimplePointsMap> CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer& def);
    static std::shared_ptr<mrpt::maps::CMetricMap> internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer& def);
    virtual void reserve(size_t newLength);
    virtual void resize(size_t newLength);
    virtual void setSize(size_t newLength);
    void insertPointFast(float x, float y, float z = 0);
    virtual void getPointAllFieldsFast(size_t index, std::vector<float>& point_data) const;
    virtual void setPointAllFieldsFast(size_t index, const std::vector<float>& point_data);
    virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan& rangeScan, const std::optional<const mrpt::poses::CPose3D>& robotPose);
    virtual void loadFromRangeScan(const mrpt::obs::CObservation3DRangeScan& rangeScan, const std::optional<const mrpt::poses::CPose3D>& robotPose);
    CSimplePointsMap& operator = (const CPointsMap& o);
    CSimplePointsMap& operator = (const CSimplePointsMap& o);
};

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<CMetricMap> Ptr;
    typedef std::shared_ptr<const CMetricMap> ConstPtr;
    typedef KDTreeCapable<Derived, num_t, metric_t> self_t;
    typedef std::shared_ptr<CPointsMap> Ptr;
    typedef std::shared_ptr<const CPointsMap> ConstPtr;

    // structs

    template <int _DIM = -1>
    struct TKDTreeDataHolder;

    struct TKDTreeSearchParams;
    struct InsertCtx;
    struct TInsertionOptions;
    struct TLaserRange2DInsertContext;
    struct TLaserRange3DInsertContext;
    struct TLikelihoodOptions;
    struct TRenderOptions;

    // fields

    TMapGenericParams genericMapParams;
    TKDTreeSearchParams kdtree_search_params;
    static constexpr static const char* POINT_FIELD_INTENSITY = "intensity";
    static constexpr static const char* POINT_FIELD_RING_ID = "ring";
    static constexpr static const char* POINT_FIELD_TIMESTAMP = "t";
    static constexpr static const char* POINT_FIELD_COLOR_Ru8 = "color_r";
    static constexpr static const char* POINT_FIELD_COLOR_Gu8 = "color_g";
    static constexpr static const char* POINT_FIELD_COLOR_Bu8 = "color_b";
    static constexpr static const char* POINT_FIELD_COLOR_Rf = "color_rf";
    static constexpr static const char* POINT_FIELD_COLOR_Gf = "color_gf";
    static constexpr static const char* POINT_FIELD_COLOR_Bf = "color_bf";
    TInsertionOptions insertionOptions;
    TLikelihoodOptions likelihoodOptions;
    TRenderOptions renderOptions;

    // 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 std::string asString() const = 0;
    Visualizable& operator = (const Visualizable&);
    Visualizable& operator = (Visualizable&&);
    virtual void getVisualizationInto(mrpt::viz::CSetOfObjects& o) const = 0;
    std::shared_ptr<mrpt::viz::CSetOfObjects> getVisualization() const;
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    void clear();
    virtual bool isEmpty() const = 0;
    virtual auto boundingBox() const;
    void loadFromSimpleMap(const mrpt::maps::CSimpleMap& Map);
    bool insertObservation(const mrpt::obs::CObservation& obs, const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt);
    bool insertObservationPtr(const mrpt::obs::CObservation::Ptr& obs, const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt);
    double computeObservationLikelihood(const mrpt::obs::CObservation& obs, const mrpt::poses::CPose3D& takenFrom) const;
    virtual bool canComputeObservationLikelihood(const mrpt::obs::CObservation& obs) const;
    double computeObservationsLikelihood(const mrpt::obs::CSensoryFrame& sf, const mrpt::poses::CPose3D& takenFrom);
    bool canComputeObservationsLikelihood(const mrpt::obs::CSensoryFrame& sf) const;

    virtual void determineMatching2D(
        const mrpt::maps::CMetricMap* otherMap,
        const mrpt::poses::CPose2D& otherMapPose,
        mrpt::tfest::TMatchingPairList& correspondences,
        const TMatchingParams& params,
        TMatchingExtraResults& extraResults
        ) const;

    virtual void determineMatching3D(
        const mrpt::maps::CMetricMap* otherMap,
        const mrpt::poses::CPose3D& otherMapPose,
        mrpt::tfest::TMatchingPairList& correspondences,
        const TMatchingParams& params,
        TMatchingExtraResults& extraResults
        ) const;

    virtual float compute3DMatchingRatio(const mrpt::maps::CMetricMap* otherMap, const mrpt::poses::CPose3D& otherMapPose, const TMatchingRatioParams& params) const;
    virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const = 0;
    virtual void auxParticleFilterCleanUp();
    virtual float squareDistanceToClosestCorrespondence(float x0, float y0) const;
    size_t kdTreeClosestPoint2D(float x0, float y0, float& out_x, float& out_y, float& out_dist_sqr) const;
    size_t kdTreeClosestPoint2D(float x0, float y0, float& out_dist_sqr) const;
    size_t kdTreeClosestPoint2D(const TPoint2D& p0, TPoint2D& pOut, float& outDistSqr) const;
    float kdTreeClosestPoint2DsqrError(float x0, float y0) const;
    float kdTreeClosestPoint2DsqrError(const TPoint2D& p0) const;

    void kdTreeTwoClosestPoint2D(
        float x0,
        float y0,
        float& out_x1,
        float& out_y1,
        float& out_x2,
        float& out_y2,
        float& out_dist_sqr1,
        float& out_dist_sqr2
        ) const;

    void kdTreeTwoClosestPoint2D(const TPoint2D& p0, TPoint2D& pOut1, TPoint2D& pOut2, float& outDistSqr1, float& outDistSqr2) const;

    std::vector<size_t> kdTreeNClosestPoint2D(
        float x0,
        float y0,
        size_t knn,
        std::vector<float>& out_x,
        std::vector<float>& out_y,
        std::vector<float>& out_dist_sqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    std::vector<size_t> kdTreeNClosestPoint2D(
        const TPoint2D& p0,
        size_t N,
        std::vector<TPoint2D>& pOut,
        std::vector<float>& outDistSqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    void kdTreeNClosestPoint2DIdx(
        float x0,
        float y0,
        size_t knn,
        std::vector<size_t>& out_idx,
        std::vector<float>& out_dist_sqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    void kdTreeNClosestPoint2DIdx(
        const TPoint2D& p0,
        size_t N,
        std::vector<size_t>& outIdx,
        std::vector<float>& outDistSqr
        ) const;

    size_t kdTreeClosestPoint3D(
        float x0,
        float y0,
        float z0,
        float& out_x,
        float& out_y,
        float& out_z,
        float& out_dist_sqr
        ) const;

    size_t kdTreeClosestPoint3D(float x0, float y0, float z0, float& out_dist_sqr) const;
    size_t kdTreeClosestPoint3D(const TPoint3D& p0, TPoint3D& pOut, float& outDistSqr) const;

    void kdTreeNClosestPoint3D(
        float x0,
        float y0,
        float z0,
        size_t knn,
        std::vector<float>& out_x,
        std::vector<float>& out_y,
        std::vector<float>& out_z,
        std::vector<float>& out_dist_sqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    void kdTreeNClosestPoint3DWithIdx(
        float x0,
        float y0,
        float z0,
        size_t knn,
        std::vector<float>& out_x,
        std::vector<float>& out_y,
        std::vector<float>& out_z,
        std::vector<size_t>& out_idx,
        std::vector<float>& out_dist_sqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    void kdTreeNClosestPoint3D(
        const TPoint3D& p0,
        size_t N,
        std::vector<TPoint3D>& pOut,
        std::vector<float>& outDistSqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    size_t kdTreeRadiusSearch3D(
        const num_t x0,
        const num_t y0,
        const num_t z0,
        const num_t maxRadiusSqr,
        std::vector<nanoflann::ResultItem<size_t, num_t>>& out_indices_dist
        ) const;

    size_t kdTreeRadiusSearch2D(
        const num_t x0,
        const num_t y0,
        const num_t maxRadiusSqr,
        std::vector<nanoflann::ResultItem<size_t, num_t>>& out_indices_dist
        ) const;

    void kdTreeNClosestPoint3DIdx(
        float x0,
        float y0,
        float z0,
        size_t knn,
        std::vector<size_t>& out_idx,
        std::vector<float>& out_dist_sqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    void kdTreeNClosestPoint3DIdx(
        const TPoint3D& p0,
        size_t N,
        std::vector<size_t>& outIdx,
        std::vector<float>& outDistSqr,
        const std::optional<float>& maximumSearchDistanceSqr = std::nullopt
        ) const;

    void kdTreeEnsureIndexBuilt3D();
    void kdTreeEnsureIndexBuilt2D();
    bool kdtree_save_index_3D(] std::ostream& out) const;
    void kdtree_load_index_3D(] std::istream& in) const;
    bool kdtree_save_index_2D(] std::ostream& out) const;
    void kdtree_load_index_2D(] std::istream& in) const;
    KDTreeCapable& operator = (const KDTreeCapable& o);
    const Derived& derived() const;
    Derived& derived();

    bool loadFromPlyFile(
        const std::string& filename,
        std::vector<std::string>* file_comments = nullptr,
        std::vector<std::string>* file_obj_info = nullptr
        );

    std::string getLoadPLYErrorString() const;

    bool saveToPlyFile(
        const std::string& filename,
        bool save_in_binary = false,
        const std::vector<std::string>& file_comments = std::vector<std::string>(),
        const std::vector<std::string>& file_obj_info = std::vector<std::string>()
        ) const;

    std::string getSavePLYErrorString() const;
    virtual bool nn_has_indices_or_ids() const = 0;
    virtual void nn_prepare_for_2d_queries() const;
    virtual void nn_prepare_for_3d_queries() const;
    virtual size_t nn_index_count() const = 0;

    virtual bool nn_single_search(
        const mrpt::math::TPoint3Df& query,
        mrpt::math::TPoint3Df& result,
        float& out_dist_sqr,
        uint64_t& resultIndexOrIDOrID
        ) const = 0;

    virtual bool nn_single_search(
        const mrpt::math::TPoint2Df& query,
        mrpt::math::TPoint2Df& result,
        float& out_dist_sqr,
        uint64_t& resultIndexOrIDOrID
        ) const = 0;

    virtual void nn_multiple_search(
        const mrpt::math::TPoint3Df& query,
        size_t N,
        std::vector<mrpt::math::TPoint3Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs
        ) const = 0;

    virtual void nn_multiple_search(
        const mrpt::math::TPoint2Df& query,
        size_t N,
        std::vector<mrpt::math::TPoint2Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs
        ) const = 0;

    virtual void nn_radius_search(
        const mrpt::math::TPoint3Df& query,
        float search_radius_sqr,
        std::vector<mrpt::math::TPoint3Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs,
        size_t maxPoints = 0
        ) const = 0;

    virtual void nn_radius_search(
        const mrpt::math::TPoint2Df& query,
        float search_radius_sqr,
        std::vector<mrpt::math::TPoint2Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs,
        size_t maxPoints = 0
        ) const = 0;

    NearestNeighborsCapable& operator = (const NearestNeighborsCapable&);
    NearestNeighborsCapable& operator = (NearestNeighborsCapable&&);
    OptionsCapable& operator = (const OptionsCapable&);
    OptionsCapable& operator = (OptionsCapable&&);
    virtual std::map<std::string, mrpt::config::CLoadableOptions*> optionsByName() = 0;
    virtual bool trySetCreationOptions(] const mrpt::config::CConfigFileBase& cfg, ] const std::string& section);
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual bool registerField_float(const std::string& fieldName);
    virtual bool registerField_uint16(] const std::string& fieldName);
    virtual bool registerField_uint8(] const std::string& fieldName);
    virtual bool registerField_uint32(] const std::string& fieldName);
    virtual bool registerField_double(] const std::string& fieldName);
    virtual void reserve(size_t newLength) = 0;
    virtual void resize(size_t newLength) = 0;
    virtual void setSize(size_t newLength) = 0;
    void setPointFast(size_t index, float x, float y, float z);
    void insertPointFast(float x, float y, float z);
    virtual void getPointAllFieldsFast(size_t index, std::vector<float>& point_data) const = 0;
    virtual void setPointAllFieldsFast(size_t index, const std::vector<float>& point_data) = 0;
    bool loadFromKittiVelodyneFile(const std::string& filename);
    bool saveToKittiVelodyneFile(const std::string& filename) const;
    bool load2D_from_text_file(const std::string& file);
    bool load2D_from_text_stream(std::istream& in, mrpt::optional_ref<std::string> outErrorMsg = std::nullopt);
    bool load3D_from_text_file(const std::string& file);
    bool load3D_from_text_stream(std::istream& in, mrpt::optional_ref<std::string> outErrorMsg = std::nullopt);
    bool load2Dor3D_from_text_file(const std::string& file, bool is_3D);
    bool load2Dor3D_from_text_stream(std::istream& in, mrpt::optional_ref<std::string> outErrorMsg, bool is_3D);
    bool save2D_to_text_file(const std::string& file) const;
    bool save2D_to_text_stream(std::ostream& out) const;
    bool save3D_to_text_file(const std::string& file) const;
    bool save3D_to_text_stream(std::ostream& out) const;
    virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const;
    virtual bool hasPointField(const std::string& fieldName) const;
    virtual std::vector<std::string> getPointFieldNames_float() const;
    virtual std::vector<std::string> getPointFieldNames_double() const;
    virtual std::vector<std::string> getPointFieldNames_uint16() const;
    virtual std::vector<std::string> getPointFieldNames_uint8() const;
    virtual std::vector<std::string> getPointFieldNames_uint32() const;
    std::vector<std::string> getPointFieldNames_float_except_xyz() const;
    virtual float getPointField_float(size_t index, const std::string& fieldName) const;
    virtual double getPointField_double(] size_t index, ] const std::string& fieldName) const;
    virtual uint16_t getPointField_uint16(] size_t index, ] const std::string& fieldName) const;
    virtual uint8_t getPointField_uint8(] size_t index, ] const std::string& fieldName) const;
    virtual uint32_t getPointField_uint32(] size_t index, ] const std::string& fieldName) const;
    virtual void setPointField_float(size_t index, const std::string& fieldName, float value);
    virtual void setPointField_double(] size_t index, ] const std::string& fieldName, ] double value);
    virtual void setPointField_uint16(] size_t index, ] const std::string& fieldName, ] uint16_t value);
    virtual void setPointField_uint8(] size_t index, ] const std::string& fieldName, ] uint8_t value);
    virtual void setPointField_uint32(] size_t index, ] const std::string& fieldName, ] uint32_t value);
    virtual void insertPointField_float(] const std::string& fieldName, ] float value);
    virtual void insertPointField_double(] const std::string& fieldName, ] double value);
    virtual void insertPointField_uint16(] const std::string& fieldName, ] uint16_t value);
    virtual void insertPointField_uint8(] const std::string& fieldName, ] uint8_t value);
    virtual void insertPointField_uint32(] const std::string& fieldName, ] uint32_t value);
    virtual void reserveField_float(] const std::string& fieldName, ] size_t n);
    virtual void reserveField_double(] const std::string& fieldName, ] size_t n);
    virtual void reserveField_uint16(] const std::string& fieldName, ] size_t n);
    virtual void reserveField_uint8(] const std::string& fieldName, ] size_t n);
    virtual void reserveField_uint32(] const std::string& fieldName, ] size_t n);
    virtual void resizeField_float(] const std::string& fieldName, ] size_t n);
    virtual void resizeField_double(] const std::string& fieldName, ] size_t n);
    virtual void resizeField_uint16(] const std::string& fieldName, ] size_t n);
    virtual void resizeField_uint8(] const std::string& fieldName, ] size_t n);
    virtual void resizeField_uint32(] const std::string& fieldName, ] size_t n);
    virtual auto getPointsBufferRef_float_field(const std::string& fieldName) const;
    virtual auto getPointsBufferRef_double_field(] const std::string& fieldName) const;
    virtual auto getPointsBufferRef_uint16_field(] const std::string& fieldName) const;
    virtual auto getPointsBufferRef_uint8_field(] const std::string& fieldName) const;
    virtual auto getPointsBufferRef_uint32_field(] const std::string& fieldName) const;
    virtual auto getPointsBufferRef_float_field(const std::string& fieldName);
    virtual auto getPointsBufferRef_double_field(] const std::string& fieldName);
    virtual auto getPointsBufferRef_uint16_field(] const std::string& fieldName);
    virtual auto getPointsBufferRef_uint8_field(] const std::string& fieldName);
    virtual auto getPointsBufferRef_uint32_field(] const std::string& fieldName);
    void enableFilterByHeight(bool enable = true);
    bool isFilterByHeightEnabled() const;
    void setHeightFilterLevels(const double _z_min, const double _z_max);
    void getHeightFilterLevels(double& _z_min, double& _z_max) const;
    std::pair<double, double> getHeightFilterLevels() const;

    template <class POINTCLOUD>
    void getPCLPointCloud(POINTCLOUD& cloud) const;

    template <class POINTCLOUD>
    void setFromPCLPointCloud(const POINTCLOUD& cloud);

    size_t kdtree_get_point_count() const;
    float kdtree_get_pt(size_t idx, int dim) const;
    float kdtree_distance(const float* p1, size_t idx_p2, size_t size) const;

    template <typename BBOX>
    bool kdtree_get_bbox(BBOX& bb) const;

    virtual void nn_prepare_for_2d_queries() const;
    virtual void nn_prepare_for_3d_queries() const;
    virtual bool nn_has_indices_or_ids() const;
    virtual size_t nn_index_count() const;

    virtual bool nn_single_search(
        const mrpt::math::TPoint3Df& query,
        mrpt::math::TPoint3Df& result,
        float& out_dist_sqr,
        uint64_t& resultIndexOrIDOrID
        ) const;

    virtual bool nn_single_search(
        const mrpt::math::TPoint2Df& query,
        mrpt::math::TPoint2Df& result,
        float& out_dist_sqr,
        uint64_t& resultIndexOrID
        ) const;

    virtual void nn_multiple_search(
        const mrpt::math::TPoint3Df& query,
        size_t N,
        std::vector<mrpt::math::TPoint3Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs
        ) const;

    virtual void nn_multiple_search(
        const mrpt::math::TPoint2Df& query,
        size_t N,
        std::vector<mrpt::math::TPoint2Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs
        ) const;

    virtual void nn_radius_search(
        const mrpt::math::TPoint3Df& query,
        float search_radius_sqr,
        std::vector<mrpt::math::TPoint3Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs,
        size_t maxPoints
        ) const;

    virtual void nn_radius_search(
        const mrpt::math::TPoint2Df& query,
        float search_radius_sqr,
        std::vector<mrpt::math::TPoint2Df>& results,
        std::vector<float>& out_dists_sqr,
        std::vector<uint64_t>& resultIndicesOrIDs,
        size_t maxPoints
        ) const;

    CPointsMap& operator = (const CPointsMap& o);
    CPointsMap& operator = (CPointsMap&& o);
    virtual float squareDistanceToClosestCorrespondence(float x0, float y0) const;
    float squareDistanceToClosestCorrespondenceT(const mrpt::math::TPoint2D& p0) const;
    virtual std::map<std::string, mrpt::config::CLoadableOptions*> optionsByName();

    void insertAnotherMap(
        const CPointsMap* otherMap,
        const mrpt::poses::CPose3D& otherPose,
        bool filterOutPointsAtZero = false,
        bool autoRegisterAllSourceFields = true
        );

    void operator += (const CPointsMap& anotherMap);
    size_t size() const;
    void getPoint(size_t index, float& x, float& y, float& z) const;
    void getPoint(size_t index, float& x, float& y) const;
    void getPoint(size_t index, double& x, double& y, double& z) const;
    void getPoint(size_t index, double& x, double& y) const;
    void getPoint(size_t index, mrpt::math::TPoint2D& p) const;
    void getPoint(size_t index, mrpt::math::TPoint3D& p) const;
    void getPoint(size_t index, mrpt::math::TPoint3Df& p) const;
    void getPointFast(size_t index, float& x, float& y, float& z) const;
    bool hasColor_u8() const;
    bool hasColor_f() const;
    void setPoint(size_t index, float x, float y, float z);
    void setPoint(size_t index, const mrpt::math::TPoint2D& p);
    void setPoint(size_t index, const mrpt::math::TPoint3D& p);
    void setPoint(size_t index, float x, float y);
    const mrpt::aligned_std_vector<float>& getPointsBufferRef_x() const;
    const mrpt::aligned_std_vector<float>& getPointsBufferRef_y() const;
    const mrpt::aligned_std_vector<float>& getPointsBufferRef_z() const;

    template <class VECTOR>
    void getAllPoints(
        VECTOR& xs,
        VECTOR& ys,
        VECTOR& zs,
        size_t decimation = 1
        ) const;

    void getAllPoints(std::vector<float>& xs, std::vector<float>& ys, size_t decimation = 1) const;
    void getAllPoints(std::vector<mrpt::math::TPoint2D>& ps, size_t decimation = 1) const;
    void insertPoint(float x, float y, float z = 0);
    void insertPoint(const mrpt::math::TPoint3D& p);
    bool registerPointFieldsFrom(const mrpt::maps::CPointsMap& source);
    InsertCtx prepareForInsertPointsFrom(const CPointsMap& source);
    void insertPointFrom(size_t sourcePointIndex, const InsertCtx& ctx);

    template <typename VECTOR>
    void setAllPointsTemplate(
        const VECTOR& X,
        const VECTOR& Y,
        const VECTOR& Z = VECTOR()
        );

    void setAllPoints(
        const std::vector<float>& X,
        const std::vector<float>& Y,
        const std::vector<float>& Z
        );

    void setAllPoints(const std::vector<float>& X, const std::vector<float>& Y);
    void getPointAllFields(size_t index, std::vector<float>& point_data) const;
    void setPointAllFields(size_t index, const std::vector<float>& point_data);
    void clipOutOfRangeInZ(float zMin, float zMax, mrpt::maps::CPointsMap& result) const;
    void clipOutOfRange(const mrpt::math::TPoint2D& point, float maxRange, mrpt::maps::CPointsMap& result) const;

    virtual void determineMatching2D(
        const mrpt::maps::CMetricMap* otherMap,
        const mrpt::poses::CPose2D& otherMapPose,
        mrpt::tfest::TMatchingPairList& correspondences,
        const TMatchingParams& params,
        TMatchingExtraResults& extraResults
        ) const;

    virtual void determineMatching3D(
        const mrpt::maps::CMetricMap* otherMap,
        const mrpt::poses::CPose3D& otherMapPose,
        mrpt::tfest::TMatchingPairList& correspondences,
        const TMatchingParams& params,
        TMatchingExtraResults& extraResults
        ) const;

    virtual float compute3DMatchingRatio(const mrpt::maps::CMetricMap* otherMap, const mrpt::poses::CPose3D& otherMapPose, const TMatchingRatioParams& params) const;

    void compute3DDistanceToMesh(
        const mrpt::maps::CMetricMap* otherMap2,
        const mrpt::poses::CPose3D& otherMapPose,
        float maxDistForCorrespondence,
        mrpt::tfest::TMatchingPairList& correspondences,
        float& correspondencesRatio
        );

    virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan& rangeScan, const std::optional<const mrpt::poses::CPose3D>& robotPose) = 0;
    virtual void loadFromRangeScan(const mrpt::obs::CObservation3DRangeScan& rangeScan, const std::optional<const mrpt::poses::CPose3D>& robotPose) = 0;
    void loadFromVelodyneScan(const mrpt::obs::CObservationVelodyneScan& scan, const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt);

    void fuseWith(
        CPointsMap* anotherMap,
        float minDistForFuse = 0.02f,
        std::vector<bool>* notFusedPoints = nullptr
        );

    void changeCoordinatesReference(const mrpt::poses::CPose2D& b);
    void changeCoordinatesReference(const mrpt::poses::CPose3D& b);
    void changeCoordinatesReference(const CPointsMap& other, const mrpt::poses::CPose3D& b);
    virtual bool isEmpty() const;
    bool empty() const;
    virtual void getVisualizationInto(mrpt::viz::CSetOfObjects& outObj) const;
    virtual mrpt::math::TBoundingBoxf boundingBox() const;
    void extractCylinder(const mrpt::math::TPoint2D& center, double radius, double zmin, double zmax, CPointsMap& outMap);
    void extractPoints(const mrpt::math::TBoundingBoxf& bbox, CPointsMap& outMap);
    virtual double internal_computeObservationLikelihood(const mrpt::obs::CObservation& obs, const mrpt::poses::CPose3D& takenFrom) const;

    double internal_computeObservationLikelihoodPointCloud3D(
        const mrpt::poses::CPose3D& pc_in_map,
        const float* xs,
        const float* ys,
        const float* zs,
        std::size_t num_pts
        ) const;

    void mark_as_modified() const;
    virtual std::string asString() const;

Typedefs

typedef std::shared_ptr<mrpt::maps ::CSimplePointsMap> Ptr

A type for the associated smart pointer.

Fields

static const size_t m_private_map_register_id =   mrpt::maps::internal::TMetricMapTypesRegistry::Instance().doRegister("mrpt::maps::CSimplePointsMap,pointsMap" ,& mrpt::maps::CSimplePointsMap ::MapDefinition,& mrpt::maps::CSimplePointsMap ::internal_CreateFromMapDefinition)

ID used to initialize class registration (just ignore it)

Construction

CSimplePointsMap()

Default constructor.

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.

static std::shared_ptr<mrpt::maps::TMetricMapInitializer> MapDefinition()

Returns default map definition initializer.

See * mrpt::maps::TMetricMapInitializer

static std::shared_ptr<CSimplePointsMap> CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer& def)

Constructor from a map definition structure: initializes the map and * its parameters accordingly.

virtual void reserve(size_t newLength)

Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.

This is useful for situations where it is approximately known the final size of the map. This method is more efficient than constantly increasing the size of the buffers. Refer to the STL C++ library’s “reserve” methods. Implementations apply a growth factor, so the resulting capacity may exceed newLength; subclasses that need the exact figure should use resize() followed by shrink_to_fit()-style compacting instead.

virtual void resize(size_t newLength)

Resizes all point buffers so they can hold the given number of points: newly created points are set to default values, and old contents are not changed.

See also:

reserve, setPoint, setPointFast, setSize

virtual void setSize(size_t newLength)

Resizes all point buffers so they can hold the given number of points, erasing all previous contents and leaving all points to default values.

See also:

reserve, setPoint, setPointFast, setSize

void insertPointFast(float x, float y, float z = 0)

The virtual method for insertPoint() without calling mark_as_modified()

virtual void getPointAllFieldsFast(size_t index, std::vector<float>& point_data) const

Get all the data fields for one point as a vector: [X Y Z] Unlike getPointAllFields(), this method does not check for index out of bounds.

See also:

getPointAllFields, setPointAllFields, setPointAllFieldsFast

virtual void setPointAllFieldsFast(
    size_t index,
    const std::vector<float>& point_data
    )

Set all the data fields for one point as a vector: [X Y Z] Unlike setPointAllFields(), this method does not check for index out of bounds.

See also:

setPointAllFields, getPointAllFields, getPointAllFieldsFast

virtual void loadFromRangeScan(
    const mrpt::obs::CObservation2DRangeScan& rangeScan,
    const std::optional<const mrpt::poses::CPose3D>& robotPose
    )

Transform the range scan into a set of cartessian coordinated points.

The options in “insertionOptions” are considered in this method. Only ranges marked as “valid=true” in the observation will be inserted

Each derived class may enrich points in different ways (color, weight, etc..), so please refer to the description of the specific implementation of mrpt::maps::CPointsMap you are using.

The actual generic implementation of this file lives in <src>/CPointsMap_crtp_common.h, but specific instantiations are generated at each derived class.

Parameters:

rangeScan

The scan to be inserted into this map

robotPose

Default to (0,0,0|0deg,0deg,0deg). Changes the frame of reference for the point cloud (i.e. the vehicle/robot pose in world coordinates).

See also:

CObservation2DRangeScan, CObservation3DRangeScan

virtual void loadFromRangeScan(
    const mrpt::obs::CObservation3DRangeScan& rangeScan,
    const std::optional<const mrpt::poses::CPose3D>& robotPose
    )

Overload of loadFromRangeScan() for 3D range scans (for example, Kinect observations).

Each derived class may enrich points in different ways (color, weight, etc..), so please refer to the description of the specific implementation of mrpt::maps::CPointsMap you are using.

The actual generic implementation of this file lives in <src>/CPointsMap_crtp_common.h, but specific instantiations are generated at each derived class.

Parameters:

rangeScan

The scan to be inserted into this map

robotPose

Default to (0,0,0|0deg,0deg,0deg). Changes the frame of reference for the point cloud (i.e. the vehicle/robot pose in world coordinates).

See also:

loadFromVelodyneScan