# class cogs::C_Scan

## Overview

Adapter for cogs::Scan structure. More…

    #include <C_Scan.h>

    class C_Scan: public cogs::C_PointCloud {
    public:
        // fields

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

        // construction

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

        // methods

        C_Scan& operator=(const C_Scan& source);
        C_Scan& operator=(C_Scan&&);
        virtual bool Import(const char* filename);
        virtual bool Export(const char* filename) const;
        void SetResolution(const glm::uvec2& new_resolution);
        glm::uvec2 GetResolution() const;
        uint32_t GetWidth() const;
        uint32_t GetHeight() const;
        void SetCameraParams(const ScanCameraParams& new_params);
        const ScanCameraParams& GetCameraParams() const;
        void SetCameraPosition(const glm::vec3& new_position);
        const glm::vec3& GetCameraPosition() const;
        void SetCameraBasis(const glm::mat3& new_basis);
        glm::mat3 GetCameraBasis() const;
        const glm::uvec2* GetCoords() const;
        bool IsPointAt(const glm::uvec2& coord) const;
        bool IsPointAt(const uint32_t x_coord, const uint32_t y_coord) const;
        uint32_t AddPointAt(const glm::uvec2& coord);
        uint32_t AddPointAt(const uint32_t x_coord, const uint32_t y_coord);
        uint32_t AddPointsAt(const glm::uvec2* new_coords, uint32_t array_size);
        uint32_t GetPointAt(const glm::uvec2& coord) const;
        uint32_t GetPointAt(const uint32_t x_coord, const uint32_t y_coord) const;
        virtual void Transform(const glm::mat4& transform);
        static bool GetCameraUV(const glm::vec3& point, const ScanCameraParams& cam_params, glm::vec2& result);

    protected:
        // methods

        class Scan& GetScan();
        const Scan& GetScan() const;
    };

### Inherited Members

    public:
        // 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:
        // methods

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

## Detailed Documentation

Adapter for cogs::Scan structure.

### Construction

    C_Scan()

Creates a scan with no points.

    C_Scan(const C_Scan& source)

Make a deep copy of the source C_Scan.

    C_Scan(C_Scan&&)

Move-construct C_Scan.

    virtual ~C_Scan()

Destroys scan.

### Methods

    C_Scan& operator=(const C_Scan& source)

Make a deep copy of the source C_Scan.

    C_Scan& operator=(C_Scan&&)

Move-construct C_Scan.

    virtual bool Import(const char* filename)

Imports scan from a file.

    virtual bool Export(const char* filename) const

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.

Camera parameters remain unchanged.

    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)

Transforms point positions, normals and updates camera.

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

Get coordinate.

    class Scan& GetScan()

Returns reference to the inner cogs::Scan.

    const Scan& GetScan() const

Returns const reference to the inner cogs::Scan.