ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ManualSegmentationTools.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 "Neighbourhood.h"
12 
13 namespace cloudViewer {
14 
15 class GenericIndexedCloud;
16 class GenericIndexedCloudPersist;
17 class GenericIndexedMesh;
18 class GenericProgressCallback;
19 class ReferenceCloud;
20 class SimpleMesh;
21 class Polyline;
22 
25 public:
28 
38  static ReferenceCloud* segment(GenericIndexedCloudPersist* aCloud,
39  const Polyline* poly,
40  bool keepInside,
41  const float* viewMat = nullptr);
42 
45 
53  static ReferenceCloud* segment(GenericIndexedCloudPersist* cloud,
54  ScalarType minDist,
55  ScalarType maxDist,
56  bool outside = false);
57 
60 
67  static ReferenceCloud* segment(GenericIndexedCloudPersist* cloud,
68  std::vector<ScalarType> values,
69  bool outside = false);
70 
72 
76  static bool isPointInsidePoly(const CCVector2& P,
77  const GenericIndexedCloud* polyVertices);
78 
80 
84  static bool isPointInsidePoly(const CCVector2& P,
85  const std::vector<CCVector2>& polyVertices);
86 
88 
111  static GenericIndexedMesh* segmentMesh(
112  GenericIndexedMesh* mesh,
113  ReferenceCloud* selectedVertexIndexes,
114  bool useSelectedVertices,
115  GenericProgressCallback* progressCb = nullptr,
116  GenericIndexedCloud* destCloud = nullptr,
117  unsigned indexShift = 0,
118  std::vector<int>* triangleIndexMap = nullptr);
119 
125  double epsilon;
126  // for infinite plane intersection
127  unsigned char planeOrthoDim;
128  double planeCoord;
129  // for box intersection
131  // for the reprojection of triangle features
133  std::vector<unsigned> origTriIndexesMapInside;
134  std::vector<unsigned> origTriIndexesMapOutside;
135 
137  : insideMesh(nullptr),
138  outsideMesh(nullptr),
139  generateOutsideMesh(false),
140  epsilon(ZERO_TOLERANCE_D),
141  planeOrthoDim(0),
142  planeCoord(0),
143  bbMin(0, 0, 0),
144  bbMax(0, 0, 0),
145  trackOrigIndexes(false) {}
146  };
147 
148  static bool segmentMeshWithAAPlane(
149  GenericIndexedMesh* mesh,
150  GenericIndexedCloudPersist* vertices,
151  MeshCutterParams& ioParams,
152  GenericProgressCallback* progressCb = nullptr);
153 
154  static bool segmentMeshWithAABox(
155  GenericIndexedMesh* mesh,
156  GenericIndexedCloudPersist* vertices,
157  MeshCutterParams& ioParams,
158  GenericProgressCallback* progressCb = nullptr);
159 };
160 
161 } // namespace cloudViewer
constexpr double ZERO_TOLERANCE_D
Definition: CVConst.h:49
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
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.
Manual segmentation algorithms (inside/outside a polyline, etc.)
A simple polyline class.
Definition: Polyline.h:20
A very simple point cloud (no point duplication)
A simple mesh structure, with index-based vertex access.
Definition: SimpleMesh.h:26
Generic file read and write utility for python interface.
Input/output parameters for the segmentMeshWithAAPlane method.