ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PointProjectionTools.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 // Local
11 #include "CVConst.h"
12 #include "CVPointCloud.h"
13 #include "CVToolbox.h"
14 #include "SquareMatrix.h"
15 
16 // System
17 #include <list>
18 
19 namespace cloudViewer {
20 
24  1,
27 };
28 
29 class GenericIndexedMesh;
30 class GenericProgressCallback;
31 
35 public:
36  static constexpr int IGNORE_MAX_EDGE_LENGTH = 0;
38 
40  struct Transformation {
46  double s;
47 
49  Transformation() : s(1.0) {}
50 
52  inline CCVector3d apply(const CCVector3d& P) const {
53  return s * (R * P) + T;
54  }
55 
57  inline CCVector3 apply(const CCVector3& P) const {
58  return (s * (R * P) + T).toPC();
59  }
60 
62 
66  CV_CORE_LIB_API void apply(GenericIndexedCloudPersist& cloud) const;
67  };
68 
70 
80  static PointCloud* developCloudOnCylinder(
81  GenericCloud* cloud,
82  PointCoordinateType radius,
83  unsigned char dim = 2,
84  CCVector3* center = nullptr,
85  GenericProgressCallback* progressCb = nullptr);
86 
88 
99  static PointCloud* developCloudOnCone(
100  GenericCloud* cloud,
101  unsigned char dim,
102  PointCoordinateType baseRadius,
103  float alpha,
104  const CCVector3& center,
105  GenericProgressCallback* progressCb = nullptr);
106 
108 
114  static PointCloud* applyTransformation(
115  GenericCloud* cloud,
116  Transformation& trans,
117  GenericProgressCallback* progressCb = nullptr);
118 
120 
126  static PointCloud* applyTransformation(
127  GenericIndexedCloud* cloud,
128  Transformation& trans,
129  GenericProgressCallback* progressCb = nullptr);
130 
132 
136  // static CCVector3 applyTransformation(const CCVector3& P, Transformation&
137  // trans);
138 
140 
151  static GenericIndexedMesh* computeTriangulation(
154  PointCoordinateType maxEdgeLength,
155  unsigned char dim,
156  std::string& outputErrorStr);
157 
159 
161  class IndexedCCVector2 : public CCVector2 {
162  public:
164  IndexedCCVector2() : CCVector2(), index(0) {}
167  : CCVector2(x, y), index(0) {}
171  unsigned i)
172  : CCVector2(x, y), index(i) {}
174  IndexedCCVector2(const CCVector2& v) : CCVector2(v), index(0) {}
175 
177  unsigned index;
178  };
179 
181 
191  static bool extractConvexHull2D(std::vector<IndexedCCVector2>& points,
192  std::list<IndexedCCVector2*>& hullPoints);
193 
195 
203  static bool extractConcaveHull2D(std::vector<IndexedCCVector2>& points,
204  std::list<IndexedCCVector2*>& hullPoints,
205  PointCoordinateType maxSquareLength = 0);
206 
208  static bool segmentIntersect(const CCVector2& A,
209  const CCVector2& B,
210  const CCVector2& C,
211  const CCVector2& D);
212 };
213 
214 } // namespace cloudViewer
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
int points
char type
Vector3Tpl< PointCoordinateType > toPC() const
Definition: CVGeom.h:263
Empty class - for classification purpose only.
Definition: CVToolbox.h:15
A generic 3D point cloud with index-based and presistent access to points.
A generic 3D point cloud with index-based point access.
A generic mesh with index-based vertex access.
IndexedCCVector2(PointCoordinateType x, PointCoordinateType y)
Constructor.
IndexedCCVector2(const CCVector2 &v)
Copy constructor.
IndexedCCVector2(PointCoordinateType x, PointCoordinateType y, unsigned i)
Constructor.
Generic file read and write utility for python interface.
TRIANGULATION_TYPES
Triangulation types.
A scaled geometrical transformation (scale + rotation + translation)
CCVector3d apply(const CCVector3d &P) const
Applies the transformation to a point.
CCVector3 apply(const CCVector3 &P) const
Applies the transformation to a point.