ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PclTools.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 <Utils/PCLCloud.h>
12 #include <Utils/PCLConv.h>
13 
14 #include "qPCL.h"
15 
16 // CV_CORE_LIB
17 #include <CVLog.h>
18 
19 // CV_DB_LIB
20 #include <ecvDrawContext.h>
21 
22 // PCL_SURFACING
23 #include <pcl/surface/texture_mapping.h>
24 
25 // PCL COMMON
26 #include <pcl/ModelCoefficients.h>
27 #include <pcl/point_cloud.h>
28 #include <vtkPolyData.h>
29 #include <vtkSmartPointer.h>
30 
31 class vtkDataSet;
32 class vtkActor;
33 class vtkLODActor;
34 class vtkPoints;
35 class vtkPropAssembly;
36 class vtkAbstractWidget;
37 class vtkUnstructuredGrid;
38 
39 namespace cloudViewer {
40 namespace geometry {
41 class LineSet;
42 }
43 namespace camera {
44 class PinholeCameraTrajectory;
45 }
46 } // namespace cloudViewer
47 
48 class ccMesh;
49 class ccGBLSensor;
50 class ccCameraSensor;
51 namespace PclTools {
52 
53 QPCL_ENGINE_LIB_API PCLTextureMesh::Ptr CreateTexturingMesh(
54  const std::string& filePath,
55  bool show_cameras = false,
56  bool verbose = false);
57 QPCL_ENGINE_LIB_API PCLTextureMesh::Ptr CreateTexturingMesh(
58  const std::string& filePath,
59  const cloudViewer::camera::PinholeCameraTrajectory& cameraTrajectory,
60  bool show_cameras = false,
61  bool verbose = false);
62 PCLTextureMesh::Ptr CreateTexturingMesh(
63  const PCLMesh::ConstPtr& triangles,
64  const pcl::texture_mapping::CameraVector& cameras,
65  bool show_cameras = false,
66  bool verbose = false);
67 
68 // Helper function called by createActorFromVTKDataSet () methods.
69 // This function determines the default setting of
70 // vtkMapper::InterpolateScalarsBeforeMapping. Return 0, interpolation off, if
71 // data is a vtkPolyData that contains only vertices. Return 1, interpolation
72 // on, for anything else.
74  vtkPolyData* polyData = vtkPolyData::SafeDownCast(
75  data); // Check that polyData != nullptr in case of segfault
76  return (polyData &&
77  polyData->GetNumberOfCells() != polyData->GetNumberOfVerts());
78 }
79 
88  bool use_scalars = true,
89  bool use_vbos = false);
90 
99  bool use_scalars = true,
100  bool use_vbos = false);
101 
106 
107 bool UpdateScalarBar(vtkAbstractWidget* widget, const CC_DRAW_CONTEXT& CONTEXT);
108 
110  const ccGLMatrixd& trans);
112  const ccGLMatrixd& trans);
113 
115  const cloudViewer::geometry::LineSet& lineset);
117  const cloudViewer::geometry::LineSet& lineset,
121 
123  const cloudViewer::geometry::LineSet& lineset);
125  const cloudViewer::geometry::LineSet& lineset,
126  bool useLineSource = true);
127 
129  const ecvColor::Rgb& color,
130  bool is_cell = false);
138  double height,
139  double depth,
140  const ccGLMatrixd& trans);
142  double height,
143  double depth);
146  const ccCameraSensor* cameraSensor,
147  const ecvColor::Rgb& lineColor,
148  const ecvColor::Rgb& planeColor);
150  const pcl::ModelCoefficients& coefficients,
151  double x,
152  double y,
153  double z,
154  double scale = 1);
156  const pcl::ModelCoefficients& coefficients);
158  double axesLength = 1.5,
159  const std::string& xLabel = "x",
160  const std::string& yLabel = "y",
161  const std::string& zLabel = "z",
162  const std::string& xPlus = "R",
163  const std::string& xMinus = "L",
164  const std::string& yPlus = "A",
165  const std::string& yMinus = "P",
166  const std::string& zPlus = "I",
167  const std::string& zMinus = "S");
168 }; // namespace PclTools
int width
int height
int points
math::float4 color
Camera (projective) sensor.
Ground-based Laser sensor.
Definition: ecvGBLSensor.h:26
Double version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:56
Triangular mesh.
Definition: ecvMesh.h:35
LineSet define a sets of lines in 3D. A typical application is to display the point cloud corresponde...
Definition: LineSet.h:29
RGB color structure.
Definition: ecvColorTypes.h:49
double colors[3]
GraphType data
Definition: graph_cut.cc:138
normal_z y
normal_z x
normal_z z
vtkSmartPointer< vtkPolyData > CreateCoordinateFromLineSet(const cloudViewer::geometry::LineSet &lineset)
Definition: PclTools.cpp:393
QPCL_ENGINE_LIB_API PCLTextureMesh::Ptr CreateTexturingMesh(const std::string &filePath, bool show_cameras=false, bool verbose=false)
Definition: PclTools.cpp:1381
vtkSmartPointer< vtkPolyData > CreatePolyDataFromLineSet(const cloudViewer::geometry::LineSet &lineset, bool useLineSource=true)
Definition: PclTools.cpp:1124
int GetDefaultScalarInterpolationForDataSet(vtkDataSet *data)
Definition: PclTools.h:73
vtkSmartPointer< vtkPoints > GetVtkPointsFromLineSet(const cloudViewer::geometry::LineSet &lineset)
Definition: PclTools.cpp:260
void AddPolyDataCell(vtkSmartPointer< vtkPolyData > polyData)
Definition: PclTools.cpp:371
vtkSmartPointer< vtkPolyData > CreateLine(vtkSmartPointer< vtkPoints > points)
Definition: PclTools.cpp:316
vtkSmartPointer< vtkPropAssembly > CreateCoordinate(double axesLength=1.5, const std::string &xLabel="x", const std::string &yLabel="y", const std::string &zLabel="z", const std::string &xPlus="R", const std::string &xMinus="L", const std::string &yPlus="A", const std::string &yMinus="P", const std::string &zPlus="I", const std::string &zMinus="S")
Definition: PclTools.cpp:581
bool TransformVtkPoints(vtkSmartPointer< vtkPoints > points, const ccGLMatrixd &trans)
Definition: PclTools.cpp:1087
bool GetVtkPointsAndLinesFromLineSet(const cloudViewer::geometry::LineSet &lineset, vtkSmartPointer< vtkPoints > points, vtkSmartPointer< vtkCellArray > lines, vtkSmartPointer< vtkUnsignedCharArray > colors)
Definition: PclTools.cpp:276
vtkSmartPointer< vtkPolyData > CreateCameraSensor(const ccCameraSensor *cameraSensor, const ecvColor::Rgb &lineColor, const ecvColor::Rgb &planeColor)
Definition: PclTools.cpp:464
void SetPolyDataColor(vtkSmartPointer< vtkPolyData > polyData, const ecvColor::Rgb &color, bool is_cell=false)
Definition: PclTools.cpp:347
bool UpdateScalarBar(vtkAbstractWidget *widget, const CC_DRAW_CONTEXT &CONTEXT)
Definition: PclTools.cpp:719
void AllocVtkUnstructuredGrid(vtkSmartPointer< vtkUnstructuredGrid > &polydata)
Allocate a new unstructured grid smartpointer. For internal use only.
Definition: PclTools.cpp:255
vtkSmartPointer< vtkPolyData > CreatePlane(const pcl::ModelCoefficients &coefficients, double x, double y, double z, double scale=1)
Definition: PclTools.cpp:517
vtkSmartPointer< vtkPolyData > CreateGBLSensor(const ccGBLSensor *gBLSensor)
Definition: PclTools.cpp:436
vtkSmartPointer< vtkPolyData > CreateCube(double width, double height, double depth, const ccGLMatrixd &trans)
Definition: PclTools.cpp:1101
void CreateActorFromVTKDataSet(const vtkSmartPointer< vtkDataSet > &data, vtkSmartPointer< vtkActor > &actor, bool use_scalars=true, bool use_vbos=false)
Internal method. Creates a vtk actor from a vtk polydata object.
Definition: PclTools.cpp:166
bool TransformPolyData(vtkSmartPointer< vtkPolyData > polyData, const ccGLMatrixd &trans)
Definition: PclTools.cpp:1074
Generic file read and write utility for python interface.
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15
Display context.