ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Geometry.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <fmt/format.h>
11 
12 #include <string>
13 
15 
16 namespace cloudViewer {
17 namespace t {
18 namespace geometry {
19 
23 class Geometry : public core::IsDevice {
24 public:
28  enum class GeometryType {
30  Unspecified = 0,
32  PointCloud = 1,
34  VoxelGrid = 2,
36  Octree = 3,
38  LineSet = 4,
40  MeshBase = 5,
42  TriangleMesh = 6,
46  Image = 8,
48  RGBDImage = 9,
50  TetraMesh = 10,
55  };
56 
57 public:
58  virtual ~Geometry() {}
59 
60 protected:
65  Geometry(GeometryType type, int dimension)
66  : geometry_type_(type), dimension_(dimension) {}
67 
68 public:
70  virtual Geometry& Clear() = 0;
71 
73  virtual bool IsEmpty() const = 0;
74 
76  virtual core::Device GetDevice() const = 0;
77 
79  GeometryType GetGeometryType() const { return geometry_type_; }
80 
82  int Dimension() const { return dimension_; }
83 
84  std::string GetName() const { return name_; }
85  void SetName(const std::string& name) { name_ = name; }
86 
87 private:
89  GeometryType geometry_type_ = GeometryType::Unspecified;
90 
92  int dimension_;
93  std::string name_;
94 };
96 enum class Metric {
99  FScore
100 };
101 
106  std::vector<float> fscore_radius = {0.01};
110  size_t n_sampled_points = 1000;
111  std::string ToString() const {
112  return fmt::format(
113  "MetricParameters: fscore_radius={}, n_sampled_points={}",
115  }
116 };
117 
118 enum class MethodOBBCreate {
119  PCA,
122 };
123 
124 } // namespace geometry
125 } // namespace t
126 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::t::geometry::MetricParameters::n_sampled_points
size_t n_sampled_points
Definition: Geometry.h:110
cloudViewer::t::geometry::Geometry::GetGeometryType
GeometryType GetGeometryType() const
Returns one of registered geometry types.
Definition: Geometry.h:79
cloudViewer::t::geometry::Metric::HausdorffDistance
@ HausdorffDistance
Hausdorff Distance.
Device.h
cloudViewer::geometry::VoxelGrid
VoxelGrid is a collection of voxels which are aligned in grid.
Definition: VoxelGrid.h:64
cloudViewer::t::geometry::Geometry::SetName
void SetName(const std::string &name)
Definition: Geometry.h:85
cloudViewer::t::geometry::MethodOBBCreate::MINIMAL_APPROX
@ MINIMAL_APPROX
Minimal OBB approximation.
cloudViewer::t::geometry::MetricParameters::ToString
std::string ToString() const
Definition: Geometry.h:111
cloudViewer::t::geometry::AxisAlignedBoundingBox
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.
Definition: BoundingVolume.h:47
format
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:181
cloudViewer::t::geometry::Geometry::~Geometry
virtual ~Geometry()
Definition: Geometry.h:58
cloudViewer::t::geometry::MethodOBBCreate::MINIMAL_JYLANKI
@ MINIMAL_JYLANKI
Minimal OBB by Jylanki.
cloudViewer::t::geometry::MethodOBBCreate
MethodOBBCreate
Definition: Geometry.h:118
cloudViewer::geometry::TetraMesh
Tetra mesh contains vertices and tetrahedra represented by the indices to the vertices.
Definition: ecvTetraMesh.h:29
cloudViewer::t::geometry::Image
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
cloudViewer::t::geometry::PointCloud
A point cloud contains a list of 3D points.
Definition: PointCloud.h:82
cloudViewer::t::geometry::OrientedBoundingBox
A bounding box oriented along an arbitrary frame of reference.
Definition: BoundingVolume.h:258
cloudViewer::t::geometry::TriangleMesh
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:98
cloudViewer::t::geometry::Geometry::GetName
std::string GetName() const
Definition: Geometry.h:84
cloudViewer::t::geometry::MetricParameters
Holder for various parameters required by metrics.
Definition: Geometry.h:103
cloudViewer::t::geometry::Geometry::GeometryType
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:28
cloudViewer::t::geometry::Geometry::GetDevice
virtual core::Device GetDevice() const =0
Returns the device of the geometry.
cloudViewer::core::Device
Definition: Device.h:18
cloudViewer::t::geometry::Geometry::IsEmpty
virtual bool IsEmpty() const =0
Returns true iff the geometry is empty.
cloudViewer::t::geometry::Geometry::Dimension
int Dimension() const
Returns whether the geometry is 2D or 3D.
Definition: Geometry.h:82
cloudViewer::geometry::Octree
Octree datastructure.
Definition: Octree.h:249
cloudViewer::t::geometry::MetricParameters::fscore_radius
std::vector< float > fscore_radius
Definition: Geometry.h:106
cloudViewer::t::geometry::MethodOBBCreate::PCA
@ PCA
Principal Component Analysis.
cloudViewer::t::geometry::Geometry::Clear
virtual Geometry & Clear()=0
Clear all elements in the geometry.
cloudViewer::geometry::HalfEdgeTriangleMesh
HalfEdgeTriangleMesh inherits TriangleMesh class with the addition of HalfEdge data structure for eac...
Definition: HalfEdgeTriangleMesh.h:24
cloudViewer::t::geometry::LineSet
A LineSet contains points and lines joining them and optionally attributes on the points and lines.
Definition: LineSet.h:85
cloudViewer::core::IsDevice
Definition: Device.h:88
cloudViewer::t::geometry::Geometry::Geometry
Geometry(GeometryType type, int dimension)
Parameterized Constructor.
Definition: Geometry.h:65
cloudViewer::t::geometry::Metric::ChamferDistance
@ ChamferDistance
Chamfer Distance.
cloudViewer::t::geometry::Metric
Metric
Metrics for comparing point clouds and triangle meshes.
Definition: Geometry.h:96
type
char type
Definition: FileIOFactory.cpp:131
cloudViewer::t::geometry::Metric::FScore
@ FScore
F-Score.
cloudViewer::t::geometry::Geometry
The base geometry class.
Definition: Geometry.h:23
cloudViewer::t::geometry::RGBDImage
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:21
name
std::string name
Definition: FileIOFactory.cpp:129