![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Classes | |
| struct | VtkToTensorType |
| struct | VtkToTensorType< long long > |
Functions | |
| int | DtypeToVtkType (const core::Dtype &dtype) |
| static core::Tensor | CreateTensorFromVtkDataArray (vtkDataArray *array, bool copy=false) |
| static vtkSmartPointer< vtkDataArray > | CreateVtkDataArrayFromTensor (core::Tensor &tensor, bool copy) |
| static vtkSmartPointer< vtkPoints > | CreateVtkPointsFromTensor (core::Tensor &tensor, bool copy=false) |
| CLOUDVIEWER_LOCAL vtkSmartPointer< vtkImageData > | CreateVtkImageDataFromTensor (core::Tensor &tensor, bool copy) |
| static vtkSmartPointer< vtkCellArray > | CreateVtkCellArrayFromTensor (core::Tensor &tensor, bool copy=false) |
| static core::Tensor | CreateTensorFromVtkCellArray (vtkCellArray *cells, bool copy=false) |
| static void | AddVtkFieldDataToTensorMap (TensorMap &tmap, vtkFieldData *field_data, bool copy) |
| static void | AddTensorMapToVtkFieldData (vtkFieldData *field_data, TensorMap &tmap, bool copy, std::unordered_set< std::string > include, std::unordered_set< std::string > exclude={}) |
| 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) |
| TriangleMesh | CreateTriangleMeshFromVtkPolyData (vtkPolyData *polydata, bool copy) |
| CLOUDVIEWER_LOCAL LineSet | CreateLineSetFromVtkPolyData (vtkPolyData *polydata, bool copy) |
| static vtkSmartPointer< vtkPolyData > | ExtrudeRotationPolyData (const Geometry &geometry, const double angle, const core::Tensor &axis, int resolution, double translation, bool capping) |
| CLOUDVIEWER_LOCAL TriangleMesh | ExtrudeRotationTriangleMesh (const Geometry &geometry, const double angle, const core::Tensor &axis, int resolution, double translation, bool capping) |
| CLOUDVIEWER_LOCAL LineSet | ExtrudeRotationLineSet (const PointCloud &pointcloud, const double angle, const core::Tensor &axis, int resolution, double translation, bool capping) |
| static vtkSmartPointer< vtkPolyData > | ExtrudeLinearPolyData (const Geometry &geometry, const core::Tensor &vector, double scale, bool capping) |
| CLOUDVIEWER_LOCAL TriangleMesh | ExtrudeLinearTriangleMesh (const Geometry &geometry, const core::Tensor &vector, double scale, bool capping) |
| CLOUDVIEWER_LOCAL LineSet | ExtrudeLinearLineSet (const PointCloud &pointcloud, const core::Tensor &vector, double scale, bool capping) |
| 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) |
|
static |
Adds attribute tensors to vtkFieldData. Primary key tensors will be ignored by this function.
| field_data | The destination vtkFieldData. |
| tmap | The source TensorMap. |
| copy | If true always create a copy for attribute arrays. |
| include | A set of keys to select which attributes should be added. |
| exclude | A set of keys for which attributes will not be added to the vtkFieldData. The exclusion set has precedence over the included keys. |
Definition at line 332 of file VtkUtils.cpp.
Referenced by CreateVtkPolyDataFromGeometry().
|
static |
Adds point or cell attribute arrays to a TensorMap.
| tmap | The destination TensorMap. |
| field_data | The source vtkFieldData. |
| copy | If true always create a copy for attribute arrays. |
Definition at line 312 of file VtkUtils.cpp.
References copy, and CreateTensorFromVtkDataArray().
Referenced by CreateLineSetFromVtkPolyData(), and CreateTriangleMeshFromVtkPolyData().
| TriangleMesh cloudViewer::t::geometry::vtkutils::ComputeNormals | ( | const TriangleMesh & | mesh, |
| bool | vertex_normals, | ||
| bool | face_normals, | ||
| bool | consistency, | ||
| bool | auto_orient_normals, | ||
| bool | splitting, | ||
| double | feature_angle_deg = 30 |
||
| ) |
Computes the normals for a mesh. In addition to computing the normals this function can fix the face vertex order and orient the normals to point outwards. This function can be applied to non-manifold or non-closed meshes but without any guarantees to correctness or quality for the result.
| mesh | A point cloud. |
| vertex_normals | If true compute the vertex normals. |
| face_normals | If true compute the face normals. |
| consistency | If true the algorithm fixes the vertex order of faces. |
| auto_orient_normals | If true normals will be flipped to point outwards |
| splitting | If true allows splitting of edges to account for sharp edges. Splitting an edge will create new vertices. |
| feature_angle_deg | The angle in degrees that defines sharp edges for splitting. |
Definition at line 596 of file VtkUtils.cpp.
References CreateTriangleMeshFromVtkPolyData(), CreateVtkPolyDataFromGeometry(), cloudViewer::t::geometry::TensorMap::GetKeySet(), cloudViewer::t::geometry::TriangleMesh::GetVertexAttr(), and normals.
| LineSet cloudViewer::t::geometry::vtkutils::CreateLineSetFromVtkPolyData | ( | vtkPolyData * | polydata, |
| bool | copy = false |
||
| ) |
Creates a LineSet a vtkPolyData object. The returned LineSet may directly use the memory of the data arrays in the vtkPolyData object. The returned LineSet will hold references to the arrays and it is not necessary to keep other references to the vtkPolyData object or its arrays alive.
| polydata | Input polyData object. |
| copy | If true always create a copy of the data. |
Definition at line 473 of file VtkUtils.cpp.
References AddVtkFieldDataToTensorMap(), copy, CreateTensorFromVtkCellArray(), CreateTensorFromVtkDataArray(), cloudViewer::t::geometry::LineSet::GetLineAttr(), cloudViewer::t::geometry::LineSet::GetPointAttr(), cloudViewer::core::Tensor::GetShape(), and cloudViewer::core::Tensor::Reshape().
Referenced by ExtrudeLinearLineSet(), ExtrudeRotationLineSet(), and cloudViewer::t::geometry::TriangleMesh::SlicePlane().
|
static |
Creates a tensor from a vtkCellArray. The returned Tensor may directly use the memory of the array if device (CPU) and memory layout are compatible. The returned Tensor will hold a reference to the array and it is not necessary to keep other references to the array alive. Note that cell arrays with varying cell sizes cannot be converted and the function will throw an exception.
| array | The source array. |
| copy | If true always create a copy of the data. |
Definition at line 283 of file VtkUtils.cpp.
References copy, CreateTensorFromVtkDataArray(), LogError, and result.
Referenced by CreateLineSetFromVtkPolyData(), and CreateTriangleMeshFromVtkPolyData().
|
static |
Creates a tensor from a vtkDataArray. The returned Tensor may directly use the memory of the array if device (CPU) and memory layout are compatible. The returned Tensor will hold a reference to the array and it is not necessary to keep other references to the array alive.
| array | The source array. |
| copy | If true always create a copy of the data. |
Definition at line 122 of file VtkUtils.cpp.
References copy, and Execute().
Referenced by AddVtkFieldDataToTensorMap(), CreateLineSetFromVtkPolyData(), CreateTensorFromVtkCellArray(), CreateTriangleMeshFromVtkPolyData(), and CreateVtkDataArrayFromTensor().
| TriangleMesh cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData | ( | vtkPolyData * | polydata, |
| bool | copy = false |
||
| ) |
Creates a triangle mesh from a vtkPolyData object. The returned TriangleMesh may directly use the memory of the data arrays in the vtkPolyData object. The returned TriangleMesh will hold references to the arrays and it is not necessary to keep other references to the vtkPolyData object or its arrays alive.
| polydata | Input polyData object. |
| copy | If true always create a copy of the data. |
Definition at line 431 of file VtkUtils.cpp.
References AddVtkFieldDataToTensorMap(), copy, CreateTensorFromVtkCellArray(), CreateTensorFromVtkDataArray(), cloudViewer::core::Tensor::GetShape(), cloudViewer::t::geometry::TriangleMesh::GetTriangleAttr(), cloudViewer::t::geometry::TriangleMesh::GetVertexAttr(), cloudViewer::t::geometry::TriangleMesh::HasTriangleAttr(), cloudViewer::t::geometry::TriangleMesh::HasVertexAttr(), cloudViewer::t::geometry::TriangleMesh::RemoveTriangleAttr(), cloudViewer::t::geometry::TriangleMesh::RemoveVertexAttr(), cloudViewer::core::Tensor::Reshape(), cloudViewer::t::geometry::TriangleMesh::SetTriangleAttr(), and cloudViewer::t::geometry::TriangleMesh::SetVertexAttr().
Referenced by cloudViewer::t::geometry::TriangleMesh::ClipPlane(), ComputeNormals(), cloudViewer::t::geometry::TriangleMesh::CreateIsosurfaces(), cloudViewer::t::geometry::TriangleMesh::CreateText(), ExtrudeLinearTriangleMesh(), ExtrudeRotationTriangleMesh(), cloudViewer::t::geometry::TriangleMesh::FillHoles(), and cloudViewer::t::geometry::TriangleMesh::SimplifyQuadricDecimation().
|
static |
Creates a vtkCellArray from a Tensor. The returned array may directly use the memory of the tensor and the tensor must be kept alive until the returned vtkPoints is deleted.
| tensor | The source tensor. |
| copy | If true always create a copy of the data. |
Definition at line 237 of file VtkUtils.cpp.
References AssertTensorDtypes, AssertTensorShape, copy, CreateVtkDataArrayFromTensor(), Execute(), cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::core::Tensor::GetShape(), cloudViewer::core::Int32, cloudViewer::core::Int64, cloudViewer::core::None, cloudViewer::core::Tensor::NumElements(), and cloudViewer::core::Tensor::Reshape().
Referenced by CreateVtkPolyDataFromGeometry().
|
static |
Creates a vtkDataArray from a Tensor. The returned array may directly use the memory of the tensor and the tensor must be kept alive until the returned vtkDataArray is deleted.
| tensor | The source tensor. |
| copy | If true always create a copy of the data. |
Definition at line 138 of file VtkUtils.cpp.
References AssertTensorShape, cloudViewer::core::Bool, copy, CreateTensorFromVtkDataArray(), data_array, DtypeToVtkType(), cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::core::Tensor::GetDevice(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Tensor::GetShape(), cloudViewer::core::Tensor::IsContiguous(), LogError, cloudViewer::core::None, and cloudViewer::core::Tensor::NumElements().
Referenced by CreateVtkCellArrayFromTensor(), CreateVtkImageDataFromTensor(), and CreateVtkPointsFromTensor().
| vtkSmartPointer< vtkImageData > cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor | ( | core::Tensor & | tensor, |
| bool | copy = false |
||
| ) |
Creates a vtkImageData object from a Tensor. The returned object may directly use the memory of the tensor and the tensor must be kept alive until the returned vtkImageData is deleted.
| tensor | The source tensor. |
| copy | If true always create a copy of the data. |
Definition at line 186 of file VtkUtils.cpp.
References AssertTensorDtypes, copy, CreateVtkDataArrayFromTensor(), data_array, cloudViewer::core::Float32, cloudViewer::core::Float64, cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::core::Tensor::GetShape(), LogError, cloudViewer::core::Tensor::NumDims(), cloudViewer::core::Tensor::NumElements(), cloudViewer::core::Tensor::Reshape(), size, and cloudViewer::core::UInt8.
Referenced by cloudViewer::t::geometry::TriangleMesh::CreateIsosurfaces().
|
static |
Creates a vtkPoints object from a Tensor. The returned array may directly use the memory of the tensor and the tensor must be kept alive until the returned vtkPoints is deleted.
| tensor | The source tensor. |
| copy | If true always create a copy of the data. |
Definition at line 175 of file VtkUtils.cpp.
References AssertTensorDtypes, AssertTensorShape, copy, CreateVtkDataArrayFromTensor(), data_array, cloudViewer::core::Float32, cloudViewer::core::Float64, and cloudViewer::core::None.
Referenced by CreateVtkPolyDataFromGeometry().
| vtkSmartPointer< vtkPolyData > cloudViewer::t::geometry::vtkutils::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 = false |
||
| ) |
Creates a vtkPolyData object from a point cloud or triangle mesh. The returned vtkPolyData object may directly use the memory of the tensors stored inside the Geometry object. Therefore, the Geometry object must be kept alive until the returned vtkPolyData object is deleted.
| geometry | CloudViewer geometry object, e.g., a TriangleMesh. |
| copy | If true always create a copy of the data. |
| point_attr_include | A set of keys to select which point/vertex attributes should be added. Note that the primary key may be included and will silently be ignored. |
| face_attr_include | A set of keys to select which face attributes should be added. Note that the primary key may be included and will silently be ignored. |
| point_attr_exclude | A set of keys for which point/vertex attributes will not be added to the vtkPolyData. The exclusion set has precedence over the included keys. |
| face_attr_exclude | A set of keys for which face attributes will not be added to the vtkPolyData. The exclusion set has precedence over the included keys. |
Definition at line 369 of file VtkUtils.cpp.
References AddTensorMapToVtkFieldData(), copy, CreateVtkCellArrayFromTensor(), CreateVtkPointsFromTensor(), cloudViewer::t::geometry::Geometry::GetGeometryType(), cloudViewer::t::geometry::Geometry::LineSet, LogError, cloudViewer::t::geometry::Geometry::PointCloud, cloudViewer::t::geometry::PointCloud::SetPoints(), and cloudViewer::t::geometry::Geometry::TriangleMesh.
Referenced by cloudViewer::t::geometry::TriangleMesh::ClipPlane(), ComputeNormals(), ExtrudeLinearPolyData(), ExtrudeRotationPolyData(), cloudViewer::t::geometry::TriangleMesh::FillHoles(), cloudViewer::t::geometry::TriangleMesh::SimplifyQuadricDecimation(), and cloudViewer::t::geometry::TriangleMesh::SlicePlane().
| int cloudViewer::t::geometry::vtkutils::DtypeToVtkType | ( | const core::Dtype & | dtype | ) |
Returns the corresponding vtk data type for core::Dtype Logs an error if no conversion exists.
Definition at line 30 of file VtkUtils.cpp.
References cloudViewer::core::Bool, cloudViewer::core::Float32, cloudViewer::core::Float64, cloudViewer::core::Int16, cloudViewer::core::Int32, cloudViewer::core::Int64, cloudViewer::core::Int8, LogError, cloudViewer::core::Dtype::ToString(), cloudViewer::core::UInt16, cloudViewer::core::UInt32, cloudViewer::core::UInt64, and cloudViewer::core::UInt8.
Referenced by CreateVtkDataArrayFromTensor().
| LineSet cloudViewer::t::geometry::vtkutils::ExtrudeLinearLineSet | ( | const PointCloud & | pointcloud, |
| const core::Tensor & | vector, | ||
| double | scale, | ||
| bool | capping | ||
| ) |
Sweeps the geometry along a direction vector.
| pointcloud | A point cloud. |
| vector | The direction vector. |
| scale | Scalar factor which essentially scales the direction vector. |
| capping | If true adds caps to the mesh. |
Definition at line 588 of file VtkUtils.cpp.
References CreateLineSetFromVtkPolyData(), and ExtrudeLinearPolyData().
Referenced by cloudViewer::t::geometry::PointCloud::ExtrudeLinear().
|
static |
Definition at line 551 of file VtkUtils.cpp.
References AssertTensorDtypes, AssertTensorShape, cloudViewer::core::Tensor::Contiguous(), CreateVtkPolyDataFromGeometry(), cloudViewer::core::Float32, cloudViewer::core::Float64, cloudViewer::core::Int32, cloudViewer::core::Int64, and cloudViewer::core::Tensor::To().
Referenced by ExtrudeLinearLineSet(), and ExtrudeLinearTriangleMesh().
| TriangleMesh cloudViewer::t::geometry::vtkutils::ExtrudeLinearTriangleMesh | ( | const Geometry & | geometry, |
| const core::Tensor & | vector, | ||
| double | scale, | ||
| bool | capping | ||
| ) |
Sweeps the geometry along a direction vector.
| geometry | CloudViewer geometry object, e.g., a TriangleMesh. |
| vector | The direction vector. |
| scale | Scalar factor which essentially scales the direction vector. |
| capping | If true adds caps to the mesh. |
Definition at line 580 of file VtkUtils.cpp.
References CreateTriangleMeshFromVtkPolyData(), and ExtrudeLinearPolyData().
Referenced by cloudViewer::t::geometry::LineSet::ExtrudeLinear(), and cloudViewer::t::geometry::TriangleMesh::ExtrudeLinear().
| LineSet cloudViewer::t::geometry::vtkutils::ExtrudeRotationLineSet | ( | const PointCloud & | pointcloud, |
| double | angle, | ||
| const core::Tensor & | axis, | ||
| int | resolution = 16, |
||
| double | translation = 0.0, |
||
| bool | capping = true |
||
| ) |
Sweeps the geometry rotationally about an axis.
| pointcloud | A point cloud. |
| angle | The rotation angle in degree. |
| axis | The rotation axis. |
| resolution | The resolution defines the number of intermediate sweeps about the rotation axis. |
| translation | The translation along the rotation axis. |
| capping | If true adds caps to the mesh. |
Definition at line 540 of file VtkUtils.cpp.
References CreateLineSetFromVtkPolyData(), and ExtrudeRotationPolyData().
Referenced by cloudViewer::t::geometry::PointCloud::ExtrudeRotation().
|
static |
Definition at line 497 of file VtkUtils.cpp.
References AssertTensorDtypes, AssertTensorShape, cloudViewer::core::Tensor::Contiguous(), CreateVtkPolyDataFromGeometry(), cloudViewer::core::Float32, cloudViewer::core::Float64, cloudViewer::core::Int32, cloudViewer::core::Int64, and cloudViewer::core::Tensor::To().
Referenced by ExtrudeRotationLineSet(), and ExtrudeRotationTriangleMesh().
| TriangleMesh cloudViewer::t::geometry::vtkutils::ExtrudeRotationTriangleMesh | ( | const Geometry & | geometry, |
| double | angle, | ||
| const core::Tensor & | axis, | ||
| int | resolution = 16, |
||
| double | translation = 0.0, |
||
| bool | capping = true |
||
| ) |
Sweeps the geometry rotationally about an axis.
| geometry | CloudViewer geometry object, e.g., a TriangleMesh. |
| angle | The rotation angle in degree. |
| axis | The rotation axis. |
| resolution | The resolution defines the number of intermediate sweeps about the rotation axis. |
| translation | The translation along the rotation axis. |
| capping | If true adds caps to the mesh. |
Definition at line 529 of file VtkUtils.cpp.
References CreateTriangleMeshFromVtkPolyData(), and ExtrudeRotationPolyData().
Referenced by cloudViewer::t::geometry::LineSet::ExtrudeRotation(), and cloudViewer::t::geometry::TriangleMesh::ExtrudeRotation().