ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
LocalModel.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 "Neighbourhood.h"
11 
12 namespace cloudViewer {
13 
15 
17 class LocalModel {
18 public:
20 
26  Neighbourhood& subset,
27  const CCVector3& center,
28  PointCoordinateType squaredRadius);
29 
31  virtual ~LocalModel() = default;
32 
34  virtual CV_LOCAL_MODEL_TYPES getType() const = 0;
35 
37  inline const CCVector3& getCenter() const { return m_modelCenter; }
38 
41 
43 
48  virtual ScalarType computeDistanceFromModelToPoint(
49  const CCVector3* P, CCVector3* nearestPoint = nullptr) const = 0;
50 
51 protected:
53 
56  LocalModel(const CCVector3& center, PointCoordinateType squaredRadius);
57 
60 
63 };
64 
65 } // namespace cloudViewer
CV_LOCAL_MODEL_TYPES
Definition: CVConst.h:121
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
char type
Local modelization (generic interface)
Definition: LocalModel.h:17
LocalModel(const CCVector3 &center, PointCoordinateType squaredRadius)
Constructor.
Definition: LocalModel.cpp:161
static LocalModel * New(CV_LOCAL_MODEL_TYPES type, Neighbourhood &subset, const CCVector3 &center, PointCoordinateType squaredRadius)
Factory.
Definition: LocalModel.cpp:165
PointCoordinateType m_squaredRadius
Max radius (squared)
Definition: LocalModel.h:62
PointCoordinateType getSquareSize() const
Returns the model max radius (squared)
Definition: LocalModel.h:40
const CCVector3 & getCenter() const
Returns the model center.
Definition: LocalModel.h:37
virtual ~LocalModel()=default
Destructor.
virtual CV_LOCAL_MODEL_TYPES getType() const =0
Returns the model type.
CCVector3 m_modelCenter
Center.
Definition: LocalModel.h:59
virtual ScalarType computeDistanceFromModelToPoint(const CCVector3 *P, CCVector3 *nearestPoint=nullptr) const =0
Compute the (unsigned) distance between a 3D point and this model.
Generic file read and write utility for python interface.