COGS
Computer Graphics Structures library
cogs::C_PointCloud Class Reference

Adapter for cogs::PointCloud structure. More...

Inheritance diagram for cogs::C_PointCloud:
[legend]

Public Member Functions

 C_PointCloud ()
 Creates a cloud with no points.
 
virtual ~C_PointCloud ()
 Destroys cloud and frees all property data.
 
 C_PointCloud (const C_PointCloud &source)
 Make a deep copy of the source C_PointCloud.
 
C_PointCloud & operator= (const C_PointCloud &source)
 Make a deep copy of the source C_PointCloud.
 
 C_PointCloud (C_PointCloud &&) noexcept=default
 Move-construct C_PointCloud.
 
C_PointCloud & operator= (C_PointCloud &&) noexcept=default
 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. More...
 
virtual void Append (const C_PointCloud &pc)
 Increments size of this by the size of pc and copies property data available in both. More...
 
glm::vec3 * GetPositions ()
 Returns pointer to position data. More...
 
const glm::vec3 * GetPositions () const
 Returns pointer to position data. More...
 
bool HasNormals () const
 Checks whether normal property exists. More...
 
glm::vec3 * GetNormals ()
 When normal property exists, returns the pointer to data, nullptr otherwise. More...
 
const glm::vec3 * GetNormals () const
 When normal property exists, returns the pointer to data, nullptr otherwise. More...
 
void AddNormals ()
 Creates PointCloud::NORMALS property buffer if it was is not added already. More...
 
float * GetIntensities ()
 When intensity property exists, returns the pointer to data, nullptr otherwise. More...
 
const float * GetIntensities () const
 When intensity property exists, returns the pointer to data, nullptr otherwise. More...
 
void AddIntensities ()
 Creates PointCloud::INTENSITIES property buffer if it was is not added already. More...
 
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. More...
 
const cogs::PointCloudProperty AddProperty (const char *key, size_t bytes_per_point)
 Creates new property buffer. More...
 
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.
 

Protected Member Functions

 C_PointCloud (cogs::PointCloud *target)
 Creates a wrapper for given cogs::PointCloud.
 
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.
 

Detailed Description

Adapter for cogs::PointCloud structure.

Member Function Documentation

◆ AddIntensities()

void cogs::C_PointCloud::AddIntensities ( )

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

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

◆ AddNormals()

void cogs::C_PointCloud::AddNormals ( )

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

Note
Do not add this property using PointCloud:AddProperty method.

◆ AddProperty() [1/2]

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

Creates new property buffer.

Parameters
keyProperty identifier. If it already exists, does nothing and returns existing property.
typeSpecific type of data in buffer.

◆ AddProperty() [2/2]

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

Creates new property buffer.

Parameters
keyProperty identifier. If it already exists, does nothing and returns existing property.
bytes_per_pointNumber of bytes reserved for each point.

◆ Append()

virtual void cogs::C_PointCloud::Append ( const C_PointCloud &  pc)
virtual

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

Note
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.

◆ Erase()

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

Removes points with specific ids from cloud.

Parameters
ids_to_eraseArray of indices which should be erased.
Numberof indices provided in ids_to_erase array.
Warning
Method may change order of points.

◆ GetIntensities() [1/2]

float* cogs::C_PointCloud::GetIntensities ( )

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

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

◆ GetIntensities() [2/2]

const float* cogs::C_PointCloud::GetIntensities ( ) const

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

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

◆ GetNormals() [1/2]

glm::vec3* cogs::C_PointCloud::GetNormals ( )

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

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

◆ GetNormals() [2/2]

const glm::vec3* cogs::C_PointCloud::GetNormals ( ) const

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

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

◆ GetPositions() [1/2]

glm::vec3* cogs::C_PointCloud::GetPositions ( )

Returns pointer to position data.

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

◆ GetPositions() [2/2]

const glm::vec3* cogs::C_PointCloud::GetPositions ( ) const

Returns pointer to position data.

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

◆ HasNormals()

bool cogs::C_PointCloud::HasNormals ( ) const

Checks whether normal property exists.

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