ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
VtkUtils.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 // ----------------------------------------------------------------------------
9 // Include guard to avoid multiple inclusion and default argument redefinitions
10 #pragma once
11 // ----------------------------------------------------------------------------
12 // - CloudViewer: www.cloudViewer.org -
13 // ----------------------------------------------------------------------------
14 // Copyright (c) 2018-2024 www.cloudViewer.org
15 // SPDX-License-Identifier: MIT
16 // ----------------------------------------------------------------------------
17 
18 #include <vtkImageData.h>
19 #include <vtkPolyData.h>
20 #include <vtkSmartPointer.h>
21 
22 #include <string>
23 #include <unordered_set>
24 
29 
30 namespace cloudViewer {
31 namespace t {
32 namespace geometry {
33 namespace vtkutils {
36 int DtypeToVtkType(const core::Dtype& dtype);
37 
43 vtkSmartPointer<vtkImageData> CreateVtkImageDataFromTensor(core::Tensor& tensor,
44  bool copy = false);
45 
64 vtkSmartPointer<vtkPolyData> CreateVtkPolyDataFromGeometry(
65  const Geometry& geometry,
66  const std::unordered_set<std::string>& point_attr_include,
67  const std::unordered_set<std::string>& face_attr_include,
68  const std::unordered_set<std::string>& point_attr_exclude = {},
69  const std::unordered_set<std::string>& face_attr_exclude = {},
70  bool copy = false);
71 
81  bool copy = false);
82 
91 LineSet CreateLineSetFromVtkPolyData(vtkPolyData* polydata, bool copy = false);
92 
102 TriangleMesh ExtrudeRotationTriangleMesh(const Geometry& geometry,
103  double angle,
104  const core::Tensor& axis,
105  int resolution = 16,
106  double translation = 0.0,
107  bool capping = true);
108 
118 LineSet ExtrudeRotationLineSet(const PointCloud& pointcloud,
119  double angle,
120  const core::Tensor& axis,
121  int resolution = 16,
122  double translation = 0.0,
123  bool capping = true);
124 
131 TriangleMesh ExtrudeLinearTriangleMesh(const Geometry& geometry,
132  const core::Tensor& vector,
133  double scale,
134  bool capping);
135 
142 LineSet ExtrudeLinearLineSet(const PointCloud& pointcloud,
143  const core::Tensor& vector,
144  double scale,
145  bool capping);
146 
164  bool vertex_normals,
165  bool face_normals,
166  bool consistency,
167  bool auto_orient_normals,
168  bool splitting,
169  double feature_angle_deg = 30);
170 } // namespace vtkutils
171 } // namespace geometry
172 } // namespace t
173 } // namespace cloudViewer
bool copy
Definition: VtkUtils.cpp:74
::ccPointCloud PointCloud
Definition: PointCloud.h:19
vtkSmartPointer< vtkPolyData > CreateVtkPolyDataFromGeometry(const Geometry &geometry, const std::unordered_set< std::string > &point_attr_include, const std::unordered_set< std::string > &face_attr_include, const std::unordered_set< std::string > &point_attr_exclude, const std::unordered_set< std::string > &face_attr_exclude, bool copy)
Definition: VtkUtils.cpp:369
CLOUDVIEWER_LOCAL TriangleMesh ComputeNormals(const TriangleMesh &mesh, bool vertex_normals, bool face_normals, bool consistency, bool auto_orient_normals, bool splitting, double feature_angle_deg)
Definition: VtkUtils.cpp:596
TriangleMesh CreateTriangleMeshFromVtkPolyData(vtkPolyData *polydata, bool copy)
Definition: VtkUtils.cpp:431
CLOUDVIEWER_LOCAL vtkSmartPointer< vtkImageData > CreateVtkImageDataFromTensor(core::Tensor &tensor, bool copy)
Definition: VtkUtils.cpp:186
int DtypeToVtkType(const core::Dtype &dtype)
Definition: VtkUtils.cpp:30
CLOUDVIEWER_LOCAL TriangleMesh ExtrudeLinearTriangleMesh(const Geometry &geometry, const core::Tensor &vector, double scale, bool capping)
Definition: VtkUtils.cpp:580
CLOUDVIEWER_LOCAL LineSet ExtrudeLinearLineSet(const PointCloud &pointcloud, const core::Tensor &vector, double scale, bool capping)
Definition: VtkUtils.cpp:588
CLOUDVIEWER_LOCAL TriangleMesh ExtrudeRotationTriangleMesh(const Geometry &geometry, const double angle, const core::Tensor &axis, int resolution, double translation, bool capping)
Definition: VtkUtils.cpp:529
CLOUDVIEWER_LOCAL LineSet CreateLineSetFromVtkPolyData(vtkPolyData *polydata, bool copy)
Definition: VtkUtils.cpp:473
CLOUDVIEWER_LOCAL LineSet ExtrudeRotationLineSet(const PointCloud &pointcloud, const double angle, const core::Tensor &axis, int resolution, double translation, bool capping)
Definition: VtkUtils.cpp:540
Generic file read and write utility for python interface.