COGS
Computer Graphics Structures library
cogs::C_Scan Class Reference

Adapter for cogs::Scan structure. More...

Inheritance diagram for cogs::C_Scan:
[legend]

Public Member Functions

 C_Scan ()
 Creates a scan with no points.
 
virtual ~C_Scan ()
 Destroys scan.
 
 C_Scan (const C_Scan &source)
 Make a deep copy of the source C_Scan.
 
C_Scan & operator= (const C_Scan &source)
 Make a deep copy of the source C_Scan.
 
 C_Scan (C_Scan &&) noexcept=default
 Move-construct C_Scan.
 
C_Scan & operator= (C_Scan &&) noexcept=default
 Move-construct C_Scan.
 
virtual bool Import (const char *filename) override
 Imports scan from a file.
 
virtual bool Export (const char *filename) const override
 Exports scan to a file.
 
void SetResolution (const glm::uvec2 &new_resolution)
 Changes grid resolution new grid points are empty and old points may be erased. More...
 
glm::uvec2 GetResolution () const
 Returns current grid resolution.
 
uint32_t GetWidth () const
 Returns current grid width.
 
uint32_t GetHeight () const
 Returns current grid height.
 
void SetCameraParams (const ScanCameraParams &new_params)
 Sets camera parameters to the new value.
 
const ScanCameraParams & GetCameraParams () const
 Returns currently set camera parameters.
 
void SetCameraPosition (const glm::vec3 &new_position)
 Sets camera position to the new value.
 
const glm::vec3 & GetCameraPosition () const
 Returns currently set camera position.
 
void SetCameraBasis (const glm::mat3 &new_basis)
 Sets camera basis to the new value.
 
glm::mat3 GetCameraBasis () const
 Returns currently set camera basis.
 
const glm::uvec2 * GetCoords () const
 Returns points coordinates.
 
bool IsPointAt (const glm::uvec2 &coord) const
 Checks whether the coordinates are valid and occupied by a point.
 
bool IsPointAt (const uint32_t x_coord, const uint32_t y_coord) const
 Checks whether the coordinates are valid and occupied by a point.
 
uint32_t AddPointAt (const glm::uvec2 &coord)
 Adds new point at grid coordinate. Returns point index.
 
uint32_t AddPointAt (const uint32_t x_coord, const uint32_t y_coord)
 Adds new point at grid coordinate. Returns point index.
 
uint32_t AddPointsAt (const glm::uvec2 *new_coords, uint32_t array_size)
 Adds a vector of new points at grid coordinates. Returns starting point index.
 
uint32_t GetPointAt (const glm::uvec2 &coord) const
 Returns point index at grid coordinate. May return Scan::INVALID_INDEX if there is no point.
 
uint32_t GetPointAt (const uint32_t x_coord, const uint32_t y_coord) const
 Returns point index at grid coordinate. May return Scan::INVALID_INDEX if there is no point.
 
virtual void Transform (const glm::mat4 &transform) override
 Transforms point positions, normals and updates camera.
 
- Public Member Functions inherited from cogs::C_PointCloud
 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 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.
 

Static Public Member Functions

static bool GetCameraUV (const glm::vec3 &point, const ScanCameraParams &cam_params, glm::vec2 &result)
 Get coordinate.
 

Static Public Attributes

static const glm::vec3 CAMERA_SPACE_FORWARD
 
static const glm::vec3 CAMERA_SPACE_UP
 
static const glm::vec3 CAMERA_SPACE_RIGHT
 

Protected Member Functions

class Scan & GetScan ()
 Returns reference to the inner cogs::Scan.
 
const Scan & GetScan () const
 Returns const reference to the inner cogs::Scan.
 
- Protected Member Functions inherited from cogs::C_PointCloud
 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::Scan structure.

Member Function Documentation

◆ SetResolution()

void cogs::C_Scan::SetResolution ( const glm::uvec2 &  new_resolution)

Changes grid resolution new grid points are empty and old points may be erased.

Warning
Camera parameters remain unchanged.