# class cogs::PointCloudSelector

## Overview

API for selecting points from a point cloud by ray-casting. More…

    #include <PointCloudSelector.h>

    class PointCloudSelector {
    public:
        // construction

        PointCloudSelector();
        PointCloudSelector(std::shared_ptr<cogs::PointCloud> pointcloud);

        // methods

        void Initialize(std::shared_ptr<cogs::PointCloud> pointcloud);
        size_t CountSelected() const;
        int32_t SelectPoint(const geom::Ray3& ray);
        int32_t DeselectPoint(const geom::Ray3& ray);
        void SelectPoint(int32_t point_index);
        void DeselectPoint(int32_t point_index);
        void SelectPointsAround(int32_t point_index, float selection_radius);
        void DeselectPointsAround(int32_t point_index, float deselection_radius);
        void DeselectAllPoints();
        const std::set<int32_t>& GetSelectedPoints() const;
    };

## Detailed Documentation

API for selecting points from a point cloud by ray-casting.

### Construction

    PointCloudSelector()

Default constructor.

    PointCloudSelector(std::shared_ptr<cogs::PointCloud> pointcloud)

Prepares the selector to be used over the given point cloud.

Parameters:

pointcloud | Selector will work with this point cloud.

### Methods

    void Initialize(std::shared_ptr<cogs::PointCloud> pointcloud)

Initializes the selector over new point cloud, forgetting the reference and selected points of old one (if any).

Parameters:

pointcloud | Selector will work with this point cloud.

    size_t CountSelected() const

Returns current number of selected points.

    int32_t SelectPoint(const geom::Ray3& ray)

Selects a point of point cloud based on the ray intersection with it.

Parameters:

ray | 3D ray in the point cloud space.
selection_radius | When greater then zero, also points around the intersected point are selected up to the distance.

Returns:

Index of the intersected point, -1 if no point was intersected.

    int32_t DeselectPoint(const geom::Ray3& ray)

Deselects a point of point cloud based on the ray intersection with it.

Parameters:

ray | 3D ray in the point cloud space.
selection_radius | When greater then zero, also points around the intersected point are deselected up to the distance.

Returns:

Index of the intersected point, -1 if no point was intersected.

    void SelectPoint(int32_t point_index)

Internally selects the point with given index.

Parameters:

point_index | Index of the point to select.

    void DeselectPoint(int32_t point_index)

Internally deselects the point with given index.

Parameters:

point_index | Index of the point to deselect.

    void SelectPointsAround(int32_t point_index, float selection_radius)

Selects the points around the target point in a specified radius, including the target point.

Parameters:

point_index | Index of the point to select.
selection_radius | Maximal distance from target point.

    void DeselectPointsAround(int32_t point_index, float deselection_radius)

Deselects the points around the target point in a specified radius, including the target point.

Parameters:

point_index | Index of the point to deselect.
selection_radius | Maximal distance from target point.

    void DeselectAllPoints()

Deselect all previously selected points.

    const std::set<int32_t>& GetSelectedPoints() const

Returns the list of all previously selected points.

Returns:

Vector of selected points.