// ---------------------------------------------------------------------------- // - Open3D: www.open3d.org - // ---------------------------------------------------------------------------- // Copyright (c) 2018-2023 www.open3d.org // SPDX-License-Identifier: MIT // ---------------------------------------------------------------------------- #pragma once #include #include #include #include #include "open3d/utility/IJsonConvertible.h" namespace open3d { namespace geometry { class Geometry; class PointCloud; class TriangleMesh; } // namespace geometry namespace visualization { /// \class SelectionPolygonVolume /// /// \brief Select a polygon volume for cropping. class SelectionPolygonVolume : public utility::IJsonConvertible { public: ~SelectionPolygonVolume() override {} public: bool ConvertToJsonValue(Json::Value &value) const override; bool ConvertFromJsonValue(const Json::Value &value) override; /// Function to crop point cloud. /// /// \param input The input point cloud. std::shared_ptr CropPointCloud( const geometry::PointCloud &input) const; /// Function to crop crop triangle mesh. /// /// \param input The input triangle mesh. std::shared_ptr CropTriangleMesh( const geometry::TriangleMesh &input) const; /// Function to crop point cloud with polygon boundaries /// /// \param input The input point Cloud. std::vector CropInPolygon(const geometry::PointCloud &input) const; private: std::shared_ptr CropPointCloudInPolygon( const geometry::PointCloud &input) const; std::shared_ptr CropTriangleMeshInPolygon( const geometry::TriangleMesh &input) const; std::vector CropInPolygon( const std::vector &input) const; public: /// One of `{x, y, z}`. std::string orthogonal_axis_ = ""; /// Bounding polygon boundary. std::vector bounding_polygon_; /// Minimum axis value. double axis_min_ = 0.0; /// Maximum axis value. double axis_max_ = 0.0; }; } // namespace visualization } // namespace open3d