# class hiro::modules::PointCloudResource

## Overview

Resource that allows visualization of a cogs::PointCloud structure. More…

    #include <PointCloudResource.h>

    class PointCloudResource: public hiro::Resource {
    public:
        // structs

        struct DataRecord;

        // construction

        PointCloudResource(const std::string& name, const cogs::PointCloud& pc);

        // methods

        virtual hiro::PGadget CreateGadget();
        uint32_t GetPointCount() const;
        hiro::draw::PPointCloudRenderer GetRenderer() const;
        glm::vec3 GetCenterOfMass() const;
        float GetApproxRadius() const;
        bool IsColoringAvailable() const;
        const std::vector<cogs::Color3f>* GetColoringOption(const uint32_t id) const;
        const std::vector<std::string> GetColoringOptionNames() const;
        bool HasFloatData() const;
        const hiro::modules::PointCloudResource::DataRecord* GetFDataOption(const uint32_t id) const;
        const std::vector<std::string> GetFDataOptionNames() const;
        bool HasNormals() const;
        std::string GetSpaceId() const;
        std::optional<utils::SpaceDefinition> GetSpace() const;

    protected:
        // fields

        hiro::draw::PPointCloudRenderer vis_object_ { nullptr };
        uint32_t point_count_ { 0u };

        // construction

        PointCloudResource(const hiro::ResourceId& id);

        // methods

        void StoreData(const cogs::PointCloud& pc);
    };

### Inherited Members

    public:
        // fields

        const hiro::ResourceId ID;

        // methods

        virtual hiro::PGadget CreateGadget() = 0;
        void ResetGadgets();
        virtual void Update(float delta_time);

    protected:
        // methods

        void DrawOnNextUpdate() const;

## Detailed Documentation

Resource that allows visualization of a cogs::PointCloud structure.

### Construction

    PointCloudResource(const std::string& name, const cogs::PointCloud& pc)

Constructor of PointcloudUnit.

Parameters:

name | The name of the point cloud.
pc | Input data as PointCloud.

### Methods

    virtual hiro::PGadget CreateGadget()

Creates PointCloudGadget. Function is handled by HIRO, non accessible by user.

    uint32_t GetPointCount() const

Returns number of points.

    hiro::draw::PPointCloudRenderer GetRenderer() const

Returns a PointCloudObject pointer.

    glm::vec3 GetCenterOfMass() const

Returns calculated center of mass.

    float GetApproxRadius() const

Returns approximation of object radius around center of mass.

    bool IsColoringAvailable() const

Returns if coloring options for points are available.

    const std::vector<cogs::Color3f>* GetColoringOption(const uint32_t id) const

Returns current coloring option. It returns available RGB color values for one point with given id.

Parameters:

id | id of the given point

    const std::vector<std::string> GetColoringOptionNames() const

Returns names of coloring properties.

    bool HasFloatData() const

Returns if any float data for points are available.

    const hiro::modules::PointCloudResource::DataRecord* GetFDataOption(const uint32_t id) const

Returns a DataRecord value for point. It returns available DataRecord value for one point with given id.

Parameters:

id | id of the given point

    const std::vector<std::string> GetFDataOptionNames() const

Returns names of float data properties.

    bool HasNormals() const

Returns if normal vectors for points are available.

    std::string GetSpaceId() const

Returns string id of point cloud space.

    std::optional<utils::SpaceDefinition> GetSpace() const

Returns point space if defined.