class cogs::C_PointCloud

Overview

Adapter for cogs::PointCloud structure. More…

#include <C_PointCloud.h>

class C_PointCloud {
public:
    // construction

    C_PointCloud();
    C_PointCloud(const C_PointCloud& source);
    C_PointCloud(C_PointCloud&&);
    virtual ~C_PointCloud();

    // methods

    C_PointCloud& operator=(const C_PointCloud& source);
    C_PointCloud& operator=(C_PointCloud&&);
    virtual bool Import(const char* filename);
    virtual bool Export(const char* filename) const;
    virtual void Resize(uint32_t new_size);
    virtual uint32_t GetSize() const;
    virtual void Reserve(uint32_t new_capacity);
    uint32_t GetCapacity() const;
    virtual void ShrinkToFit();
    void Clear();
    virtual void Erase(const uint32_t* ids_to_erase, size_t count);
    virtual void Append(const C_PointCloud& pc);
    glm::vec3* GetPositions();
    const glm::vec3* GetPositions() const;
    bool HasNormals() const;
    glm::vec3* GetNormals();
    const glm::vec3* GetNormals() const;
    void AddNormals();
    float* GetIntensities();
    const float* GetIntensities() const;
    void AddIntensities();
    size_t GetPropertyCount() const;
    const cogs::PointCloudProperty* GetProperties() const;
    const cogs::PointCloudProperty AddProperty(const char* key, DataType type);
    const cogs::PointCloudProperty AddProperty(const char* key, size_t bytes_per_point);
    void RemoveProperty(const char* key);
    bool HasProperty(const char* key) const;
    PointCloudProperty GetProperty(const char* key);
    const PointCloudProperty GetProperty(const char* key) const;
    virtual void Transform(const glm::mat4& transform);

protected:
    // construction

    C_PointCloud(cogs::PointCloud* target);

    // methods

    PointCloud& GetPointCloud();
    const PointCloud& GetPointCloud() const;
    void MakeCloneOf(const C_PointCloud& source);
};

Detailed Documentation

Adapter for cogs::PointCloud structure.

Construction

C_PointCloud()

Creates a cloud with no points.

C_PointCloud(const C_PointCloud& source)

Make a deep copy of the source C_PointCloud.

C_PointCloud(C_PointCloud&&)

Move-construct C_PointCloud.

C_PointCloud(cogs::PointCloud* target)

Creates a wrapper for given cogs::PointCloud.

virtual ~C_PointCloud()

Destroys cloud and frees all property data.

Methods

C_PointCloud& operator=(const C_PointCloud& source)

Make a deep copy of the source C_PointCloud.

C_PointCloud& operator=(C_PointCloud&&)

Move-construct C_PointCloud.

virtual bool Import(const char* filename)

Imports point cloud from a file.

virtual bool Export(const char* filename) const

Exports point clouds to a file.

virtual void Resize(uint32_t new_size)

Resizes point count to the new value without initialization of data of newly created points.

virtual uint32_t GetSize() const

Returns number of points currently stored in the cloud.

virtual void Reserve(uint32_t new_capacity)

Changes capacity of cloud. This method is not adding any points.

uint32_t GetCapacity() const

Returns how much points can be added with currently reserved memory.

virtual void ShrinkToFit()

Frees spare memory so that new capacity exactly matches size.

void Clear()

Removes all points from cloud.

virtual void Erase(const uint32_t* ids_to_erase, size_t count)

Removes points with specific ids from cloud.

Method may change order of points.

Parameters:

ids_to_erase

Array of indices which should be erased.

Number

of indices provided in ids_to_erase array.

virtual void Append(const C_PointCloud& pc)

Increments size of this by the size of pc and copies property data available in both.

Properties not available in this will not be copied. To add also properties not currently available in this, use C_PointCloud::ClonePropertiesOf before calling this function.

glm::vec3* GetPositions()

Returns pointer to position data.

Equivalent to PointCloud::GetData<glm::vec3>(PointCloud::POSITIONS);

const glm::vec3* GetPositions() const

Returns pointer to position data.

Equivalent to PointCloud::GetData<glm::vec3>(PointCloud::POSITIONS);

bool HasNormals() const

Checks whether normal property exists.

Equivalent to PointCloud::HasProperty(PointCloud::NORMALS);

glm::vec3* GetNormals()

When normal property exists, returns the pointer to data, nullptr otherwise.

Equivalent to PointCloud::GetData<glm::vec3>(PointCloud::NORMALS);

const glm::vec3* GetNormals() const

When normal property exists, returns the pointer to data, nullptr otherwise.

Equivalent to PointCloud::GetData<glm::vec3>(PointCloud::NORMALS);

void AddNormals()

Creates PointCloud::NORMALS property buffer if it was is not added already.

Do not add this property using PointCloud :AddProperty method.

float* GetIntensities()

When intensity property exists, returns the pointer to data, nullptr otherwise.

Equivalent to PointCloud::GetData<glm::vec3>(PointCloud::INTENSITIES);

const float* GetIntensities() const

When intensity property exists, returns the pointer to data, nullptr otherwise.

Equivalent to PointCloud::GetData<glm::vec3>(PointCloud::INTENSITIES);

void AddIntensities()

Creates PointCloud::INTENSITIES property buffer if it was is not added already.

Equivalent to PointCloud::AddProperty(PointCloud::INTENSITIES, DataType::FVEC3)

size_t GetPropertyCount() const

Returns count of all available properties.

const cogs::PointCloudProperty* GetProperties() const

Returns an array of all available properties.

const cogs::PointCloudProperty AddProperty(const char* key, DataType type)

Creates new property buffer.

Parameters:

key

Property identifier. If it already exists, does nothing and returns existing property.

type

Specific type of data in buffer.

const cogs::PointCloudProperty AddProperty(const char* key, size_t bytes_per_point)

Creates new property buffer.

Parameters:

key

Property identifier. If it already exists, does nothing and returns existing property.

bytes_per_point

Number of bytes reserved for each point.

void RemoveProperty(const char* key)

Remove a single property by key..

bool HasProperty(const char* key) const

Checks whether a specific property exists.

PointCloudProperty GetProperty(const char* key)

Returns property with specified key if it exists, nullptr otherwise.

const PointCloudProperty GetProperty(const char* key) const

Returns property with specified key if it exists, nullptr otherwise.

virtual void Transform(const glm::mat4& transform)

Transforms point positions and normals.

PointCloud& GetPointCloud()

Returns reference to the inner cogs::Pointcloud.

const PointCloud& GetPointCloud() const

Returns const reference to the inner cogs::Pointcloud.

void MakeCloneOf(const C_PointCloud& source)

Make a deep copy of the source C_PointCloud.