ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
GenericCloud.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 <functional>
11 
12 // Local
13 #include "CVConst.h"
14 #include "CVGeom.h"
15 
16 namespace cloudViewer {
17 
21 public:
23  GenericCloud() = default;
24 
26  virtual ~GenericCloud() = default;
27 
30  std::function<void(const CCVector3&, ScalarType&)>;
31 
33 
36  virtual unsigned size() const = 0;
37  inline virtual bool hasPoints() const { return size() != 0; }
38 
40 
44  virtual void forEach(genericPointAction action) = 0;
45 
47 
51  virtual void getBoundingBox(CCVector3& bbMin, CCVector3& bbMax) = 0;
52 
55 
65  virtual inline unsigned char testVisibility(const CCVector3& P) const {
66  return POINT_VISIBLE;
67  }
68 
70 
72  virtual void placeIteratorAtBeginning() = 0;
73 
75 
85  virtual const CCVector3* getNextPoint() = 0;
86 
88 
93  virtual bool enableScalarField() = 0;
94 
96  virtual bool isScalarFieldEnabled() const = 0;
97 
99  virtual void setPointScalarValue(unsigned pointIndex, ScalarType value) = 0;
100 
102  virtual ScalarType getPointScalarValue(unsigned pointIndex) const = 0;
103 };
104 
105 } // namespace cloudViewer
constexpr unsigned char POINT_VISIBLE
Definition: CVConst.h:92
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
int size
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the cloud bounding box.
virtual bool enableScalarField()=0
Enables the scalar field associated to the cloud.
virtual void forEach(genericPointAction action)=0
Fast iteration mechanism.
virtual void placeIteratorAtBeginning()=0
Sets the cloud iterator at the beginning.
virtual unsigned char testVisibility(const CCVector3 &P) const
Definition: GenericCloud.h:65
std::function< void(const CCVector3 &, ScalarType &)> genericPointAction
Generic function applied to a point (used by foreach)
Definition: GenericCloud.h:30
GenericCloud()=default
Default constructor.
virtual ~GenericCloud()=default
Default destructor.
virtual const CCVector3 * getNextPoint()=0
Returns the next point (relatively to the global iterator position)
virtual unsigned size() const =0
Returns the number of points.
virtual ScalarType getPointScalarValue(unsigned pointIndex) const =0
Returns the ith point associated scalar value.
virtual bool hasPoints() const
Definition: GenericCloud.h:37
virtual void setPointScalarValue(unsigned pointIndex, ScalarType value)=0
Sets the ith point associated scalar value.
virtual bool isScalarFieldEnabled() const =0
Returns true if the scalar field is enabled, false otherwise.
Generic file read and write utility for python interface.