![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
A triangle mesh contains vertices and triangles. More...
#include <TriangleMesh.h>


Public Member Functions | |
| TriangleMesh (const core::Device &device=core::Device("CPU:0")) | |
| TriangleMesh (const core::Tensor &vertex_positions, const core::Tensor &triangle_indices) | |
| virtual | ~TriangleMesh () override |
| std::string | ToString () const |
| Text description. More... | |
| TriangleMesh | To (const core::Device &device, bool copy=false) const |
| TriangleMesh | Clone () const |
| Returns copy of the triangle mesh on the same device. More... | |
| const TensorMap & | GetVertexAttr () const |
| Getter for vertex_attr_ TensorMap. Used in Pybind. More... | |
| TensorMap & | GetVertexAttr () |
| Getter for vertex_attr_ TensorMap. More... | |
| core::Tensor & | GetVertexAttr (const std::string &key) |
| core::Tensor & | GetVertexPositions () |
| core::Tensor & | GetVertexColors () |
| core::Tensor & | GetVertexNormals () |
| const TensorMap & | GetTriangleAttr () const |
| Getter for triangle_attr_ TensorMap. Used in Pybind. More... | |
| TensorMap & | GetTriangleAttr () |
| Getter for triangle_attr_ TensorMap. More... | |
| core::Tensor & | GetTriangleAttr (const std::string &key) |
| core::Tensor & | GetTriangleIndices () |
| core::Tensor & | GetTriangleNormals () |
| core::Tensor & | GetTriangleColors () |
| const core::Tensor & | GetVertexAttr (const std::string &key) const |
| void | RemoveVertexAttr (const std::string &key) |
| const core::Tensor & | GetVertexPositions () const |
| const core::Tensor & | GetVertexColors () const |
| const core::Tensor & | GetVertexNormals () const |
| const core::Tensor & | GetTriangleAttr (const std::string &key) const |
| void | RemoveTriangleAttr (const std::string &key) |
| const core::Tensor & | GetTriangleIndices () const |
| const core::Tensor & | GetTriangleNormals () const |
| const core::Tensor & | GetTriangleColors () const |
| void | SetVertexAttr (const std::string &key, const core::Tensor &value) |
| void | SetVertexPositions (const core::Tensor &value) |
| void | SetVertexColors (const core::Tensor &value) |
| void | SetVertexNormals (const core::Tensor &value) |
| void | SetTriangleAttr (const std::string &key, const core::Tensor &value) |
| void | SetTriangleIndices (const core::Tensor &value) |
| Set the value of the "indices" attribute in triangle_attr_. More... | |
| void | SetTriangleNormals (const core::Tensor &value) |
| void | SetTriangleColors (const core::Tensor &value) |
| bool | HasVertexAttr (const std::string &key) const |
| bool | HasVertexPositions () const |
| bool | HasVertexColors () const |
| bool | HasVertexNormals () const |
| bool | HasTriangleAttr (const std::string &key) const |
| bool | HasTriangleIndices () const |
| bool | HasTriangleNormals () const |
| bool | HasTriangleColors () const |
| TriangleMesh & | Clear () override |
| Clear all data in the trianglemesh. More... | |
| bool | IsEmpty () const override |
| Returns !HasVertexPositions(), triangles are ignored. More... | |
| core::Tensor | GetMinBound () const |
| core::Tensor | GetMaxBound () const |
| core::Tensor | GetCenter () const |
| TriangleMesh & | Transform (const core::Tensor &transformation) |
| Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh. More... | |
| TriangleMesh & | Translate (const core::Tensor &translation, bool relative=true) |
| Translates the VertexPositions of the TriangleMesh. More... | |
| TriangleMesh & | Scale (double scale, const core::Tensor ¢er) |
| Scales the VertexPositions of the TriangleMesh. More... | |
| TriangleMesh & | Rotate (const core::Tensor &R, const core::Tensor ¢er) |
| Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists). More... | |
| TriangleMesh & | NormalizeNormals () |
| Normalize both triangle normals and vertex normals to length 1. More... | |
| TriangleMesh & | ComputeTriangleNormals (bool normalized=true) |
| Function to compute triangle normals, usually called before rendering. More... | |
| TriangleMesh & | ComputeVertexNormals (bool normalized=true) |
| Function to compute vertex normals, usually called before rendering. More... | |
| double | GetSurfaceArea () const |
| Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces. More... | |
| TriangleMesh & | ComputeTriangleAreas () |
| Function to compute triangle areas and save it as a triangle attribute "areas". Prints a warning, if mesh is empty or has no triangles. More... | |
| TriangleMesh | ClipPlane (const core::Tensor &point, const core::Tensor &normal) const |
| Clip mesh with a plane. This method clips the triangle mesh with the specified plane. Parts of the mesh on the positive side of the plane will be kept and triangles intersected by the plane will be cut. More... | |
| LineSet | SlicePlane (const core::Tensor &point, const core::Tensor &normal, const std::vector< double > contour_values={0.0}) const |
| Extract contour slices given a plane. This method extracts slices as LineSet from the mesh at specific contour values defined by the specified plane. More... | |
| core::Device | GetDevice () const override |
| Returns the device of the geometry. More... | |
| ccMesh | ToLegacy () const |
| Convert to a legacy CloudViewer TriangleMesh. More... | |
| TriangleMesh | ComputeConvexHull (bool joggle_inputs=false) const |
| TriangleMesh | SimplifyQuadricDecimation (double target_reduction, bool preserve_volume=true) const |
| TriangleMesh | BooleanUnion (const TriangleMesh &mesh, double tolerance=1e-6) const |
| TriangleMesh | BooleanIntersection (const TriangleMesh &mesh, double tolerance=1e-6) const |
| TriangleMesh | BooleanDifference (const TriangleMesh &mesh, double tolerance=1e-6) const |
| AxisAlignedBoundingBox | GetAxisAlignedBoundingBox () const |
| Create an axis-aligned bounding box from vertex attribute "positions". More... | |
| OrientedBoundingBox | GetOrientedBoundingBox () const |
| Create an oriented bounding box from vertex attribute "positions". More... | |
| TriangleMesh | FillHoles (double hole_size=1e6) const |
| std::tuple< float, int, int > | ComputeUVAtlas (size_t size=512, float gutter=1.0f, float max_stretch=1.f/6, int parallel_partitions=1, int nthreads=0) |
| std::unordered_map< std::string, core::Tensor > | BakeVertexAttrTextures (int size, const std::unordered_set< std::string > &vertex_attr={}, double margin=2., double fill=0., bool update_material=true) |
| std::unordered_map< std::string, core::Tensor > | BakeTriangleAttrTextures (int size, const std::unordered_set< std::string > &triangle_attr={}, double margin=2., double fill=0., bool update_material=true) |
| TriangleMesh | ExtrudeRotation (double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const |
| TriangleMesh | ExtrudeLinear (const core::Tensor &vector, double scale=1.0, bool capping=true) const |
| int | PCAPartition (int max_faces) |
| TriangleMesh | SelectFacesByMask (const core::Tensor &mask) const |
| TriangleMesh | SelectByIndex (const core::Tensor &indices, bool copy_attributes=true) const |
| TriangleMesh | RemoveUnreferencedVertices () |
| Image | ProjectImagesToAlbedo (const std::vector< Image > &images, const std::vector< core::Tensor > &intrinsic_matrices, const std::vector< core::Tensor > &extrinsic_matrices, int tex_size=1024, bool update_material=true) |
| TriangleMesh | RemoveNonManifoldEdges () |
| core::Tensor | GetNonManifoldEdges (bool allow_boundary_edges=true) const |
| PointCloud | SamplePointsUniformly (size_t number_of_points, bool use_triangle_normal=false) |
| core::Tensor | ComputeMetrics (const TriangleMesh &mesh2, std::vector< Metric > metrics={Metric::ChamferDistance}, MetricParameters params=MetricParameters()) const |
Public Member Functions inherited from cloudViewer::t::geometry::Geometry | |
| virtual | ~Geometry () |
| GeometryType | GetGeometryType () const |
| Returns one of registered geometry types. More... | |
| int | Dimension () const |
| Returns whether the geometry is 2D or 3D. More... | |
| std::string | GetName () const |
| void | SetName (const std::string &name) |
Public Member Functions inherited from cloudViewer::core::IsDevice | |
| IsDevice ()=default | |
| virtual | ~IsDevice ()=default |
| bool | IsCPU () const |
| bool | IsCUDA () const |
| bool | IsSYCL () const |
Public Member Functions inherited from cloudViewer::t::geometry::DrawableGeometry | |
| DrawableGeometry () | |
| ~DrawableGeometry () | |
| bool | HasMaterial () const |
| Check if a material has been applied to this Geometry with SetMaterial. More... | |
| visualization::rendering::Material & | GetMaterial () |
| Get material associated with this Geometry. More... | |
| const visualization::rendering::Material & | GetMaterial () const |
| Get const reference to material associated with this Geometry. More... | |
| void | SetMaterial (const visualization::rendering::Material &material) |
| Set the material properties associate with this Geometry. More... | |
Static Public Member Functions | |
| static TriangleMesh | CreateBox (double width=1.0, double height=1.0, double depth=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateSphere (double radius=1.0, int resolution=20, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateTetrahedron (double radius=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateOctahedron (double radius=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateIcosahedron (double radius=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateCylinder (double radius=1.0, double height=2.0, int resolution=20, int split=4, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateCone (double radius=1.0, double height=2.0, int resolution=20, int split=1, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateTorus (double torus_radius=1.0, double tube_radius=0.5, int radial_resolution=30, int tubular_resolution=20, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateArrow (double cylinder_radius=1.0, double cone_radius=1.5, double cylinder_height=5.0, double cone_height=4.0, int resolution=20, int cylinder_split=4, int cone_split=1, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateCoordinateFrame (double size=1.0, const Eigen::Vector3d &origin=Eigen::Vector3d(0.0, 0.0, 0.0), core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateMobius (int length_split=70, int width_split=15, int twists=1, double radius=1, double flatness=1, double width=1, double scale=1, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateText (const std::string &text, double depth=0.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static TriangleMesh | CreateIsosurfaces (const core::Tensor &volume, const std::vector< double > contour_values={0.0}, const core::Device &device=core::Device("CPU:0")) |
| static geometry::TriangleMesh | FromLegacy (const ccMesh &mesh_legacy, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
| static std::unordered_map< std::string, geometry::TriangleMesh > | FromTriangleMeshModel (const cloudViewer::visualization::rendering::TriangleMeshModel &model, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0")) |
Protected Attributes | |
| core::Device | device_ = core::Device("CPU:0") |
| TensorMap | vertex_attr_ |
| TensorMap | triangle_attr_ |
Additional Inherited Members | |
Public Types inherited from cloudViewer::t::geometry::Geometry | |
| enum class | GeometryType { Unspecified = 0 , PointCloud = 1 , VoxelGrid = 2 , Octree = 3 , LineSet = 4 , MeshBase = 5 , TriangleMesh = 6 , HalfEdgeTriangleMesh = 7 , Image = 8 , RGBDImage = 9 , TetraMesh = 10 , OrientedBoundingBox = 11 , AxisAlignedBoundingBox = 12 } |
| Specifies possible geometry types. More... | |
Protected Member Functions inherited from cloudViewer::t::geometry::Geometry | |
| Geometry (GeometryType type, int dimension) | |
| Parameterized Constructor. More... | |
A triangle mesh contains vertices and triangles.
The triangle mesh class stores the attribute data in key-value maps. There are two maps: the vertex attributes map, and the triangle attribute map.
Note that the we can also use the generalized helper functions for the default and common attributes.
Definition at line 98 of file TriangleMesh.h.
| cloudViewer::t::geometry::TriangleMesh::TriangleMesh | ( | const core::Device & | device = core::Device("CPU:0") | ) |
Construct an empty trianglemesh on the provided device.
| device | The device on which to initialize the trianglemesh (default: 'CPU:0'). |
Definition at line 74 of file TriangleMesh.cpp.
| cloudViewer::t::geometry::TriangleMesh::TriangleMesh | ( | const core::Tensor & | vertex_positions, |
| const core::Tensor & | triangle_indices | ||
| ) |
Construct a trianglemesh from vertices and triangles.
The input tensors will be directly used as the underlying storage of the triangle mesh (no memory copy). The device for vertex_positions must be consistent with triangle_indices.
| vertex_positions | A tensor with element shape {3}. |
| triangle_indices | A tensor with element shape {3}. |
Definition at line 80 of file TriangleMesh.cpp.
References cloudViewer::core::Tensor::GetDevice(), LogError, and cloudViewer::core::Device::ToString().
|
inlineoverridevirtual |
Definition at line 116 of file TriangleMesh.h.
| std::unordered_map< std::string, core::Tensor > cloudViewer::t::geometry::TriangleMesh::BakeTriangleAttrTextures | ( | int | size, |
| const std::unordered_set< std::string > & | triangle_attr = {}, |
||
| double | margin = 2., |
||
| double | fill = 0., |
||
| bool | update_material = true |
||
| ) |
Bake triangle attributes into textures.
This function assumes a triangle attribute with name 'texture_uvs'.
This function always uses the CPU device.
| size | The width and height of the texture in pixels. Only square textures are supported. |
| vertex_attr | The vertex attributes for which textures should be generated. |
| margin | The margin in pixels. The recommended value is 2. The margin are additional pixels around the UV islands to avoid discontinuities. |
| fill | The value used for filling texels outside the UV islands. |
| update_material | If true updates the material of the mesh. Baking a vertex attribute with the name 'albedo' will become the albedo texture in the material. Existing textures in the material will be overwritten. |
Definition at line 1041 of file TriangleMesh.cpp.
References AssertTensorDtype, AssertTensorShape, cloudViewer::t::geometry::TensorMap::Contains(), cloudViewer::t::geometry::TensorMap::Contiguous(), DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, cloudViewer::core::Float32, cloudViewer::core::Tensor::GetDtype(), GetTriangleIndices(), cloudViewer::core::Int64, LogError, cloudViewer::core::None, result, size, and triangle_attr_.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| std::unordered_map< std::string, core::Tensor > cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures | ( | int | size, |
| const std::unordered_set< std::string > & | vertex_attr = {}, |
||
| double | margin = 2., |
||
| double | fill = 0., |
||
| bool | update_material = true |
||
| ) |
Bake vertex attributes into textures.
This function assumes a triangle attribute with name 'texture_uvs'. Only float type attributes can be baked to textures.
This function always uses the CPU device.
| size | The width and height of the texture in pixels. Only square textures are supported. |
| vertex_attr | The vertex attributes for which textures should be generated. |
| margin | The margin in pixels. The recommended value is 2. The margin are additional pixels around the UV islands to avoid discontinuities. |
| fill | The value used for filling texels outside the UV islands. |
| update_material | If true updates the material of the mesh. Baking a vertex attribute with the name 'albedo' will become the albedo texture in the material. Existing textures in the material will be overwritten. |
Definition at line 975 of file TriangleMesh.cpp.
References AssertTensorDtype, AssertTensorShape, cloudViewer::t::geometry::TensorMap::Contains(), cloudViewer::t::geometry::TensorMap::Contiguous(), DISPATCH_FLOAT_INT_DTYPE_TO_TEMPLATE, cloudViewer::core::Tensor::Empty(), cloudViewer::core::Float32, cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Tensor::GetLength(), cloudViewer::t::geometry::DrawableGeometry::GetMaterial(), GetTriangleIndices(), LogError, cloudViewer::core::None, cloudViewer::core::Tensor::NumElements(), result, size, triangle_attr_, cloudViewer::core::UInt32, and vertex_attr_.
Referenced by ProjectImagesToAlbedo(), and cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::BooleanDifference | ( | const TriangleMesh & | mesh, |
| double | tolerance = 1e-6 |
||
| ) | const |
Computes the mesh that encompasses the volume after subtracting the volume of the second operand. Both meshes should be manifold.
This function always uses the CPU device.
| mesh | This is the second operand for the boolean operation. |
| tolerance | Threshold which determines when point distances are considered to be 0. |
Definition at line 775 of file TriangleMesh.cpp.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::BooleanIntersection | ( | const TriangleMesh & | mesh, |
| double | tolerance = 1e-6 |
||
| ) | const |
Computes the mesh that encompasses the intersection of the volumes of two meshes. Both meshes should be manifold.
This function always uses the CPU device.
| mesh | This is the second operand for the boolean operation. |
| tolerance | Threshold which determines when point distances are considered to be 0. |
Definition at line 768 of file TriangleMesh.cpp.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::BooleanUnion | ( | const TriangleMesh & | mesh, |
| double | tolerance = 1e-6 |
||
| ) | const |
Computes the mesh that encompasses the union of the volumes of two meshes. Both meshes should be manifold.
This function always uses the CPU device.
| mesh | This is the second operand for the boolean operation. |
| tolerance | Threshold which determines when point distances are considered to be 0. |
Definition at line 762 of file TriangleMesh.cpp.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
inlineoverridevirtual |
Clear all data in the trianglemesh.
Implements cloudViewer::t::geometry::Geometry.
Definition at line 619 of file TriangleMesh.h.
References triangle_attr_, and vertex_attr_.
Referenced by cloudViewer::t::io::ReadTriangleMeshUsingASSIMP().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::ClipPlane | ( | const core::Tensor & | point, |
| const core::Tensor & | normal | ||
| ) | const |
Clip mesh with a plane. This method clips the triangle mesh with the specified plane. Parts of the mesh on the positive side of the plane will be kept and triangles intersected by the plane will be cut.
| point | A point on the plane as [Tensor of dim {3}]. |
| normal | The normal of the plane as [Tensor of dim {3}]. The normal points to the positive side of the plane for which the geometry will be kept. |
Definition at line 640 of file TriangleMesh.cpp.
References AssertTensorDtypes, AssertTensorShape, cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkPolyDataFromGeometry(), cloudViewer::core::Float32, cloudViewer::core::Float64, GetTriangleAttr(), GetVertexAttr(), cloudViewer::core::Int32, cloudViewer::core::Int64, and normal.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Returns copy of the triangle mesh on the same device.
Definition at line 130 of file TriangleMesh.h.
References GetDevice(), and To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::ComputeConvexHull | ( | bool | joggle_inputs = false | ) | const |
Compute the convex hull of the triangle mesh using qhull.
This runs on the CPU.
| joggle_inputs | (default False). Handle precision problems by randomly perturbing the input data. Set to True if perturbing the input iis acceptable but you need convex simplicial output. If False, neighboring facets may be merged in case of precision problems. See QHull docs for more details. |
Definition at line 635 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::PointCloud::ComputeConvexHull(), and GetVertexPositions().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| core::Tensor cloudViewer::t::geometry::TriangleMesh::ComputeMetrics | ( | const TriangleMesh & | mesh2, |
| std::vector< Metric > | metrics = {Metric::ChamferDistance}, |
||
| MetricParameters | params = MetricParameters() |
||
| ) | const |
Compute various metrics between two triangle meshes. This uses ray casting for distance computations between a sampled point cloud and a triangle mesh. Currently, Chamfer distance, Hausdorff distance and F-Score [[Knapitsch2017]] are supported. The Chamfer distance is the sum of the mean distance to the nearest neighbor from the sampled surface points of the first mesh to the second mesh and vice versa. The F-Score at a fixed threshold radius is the harmonic mean of the Precision and Recall. Recall is the percentage of surface points from the first mesh that have the second mesh within the threshold radius, while Precision is the percentage of sampled points from the second mesh that have the first mesh surface within the threshold radius.
As a side effect, the triangle areas are saved in the "areas" attribute.
| mesh2 | Other point cloud to compare with. |
| metrics | List of Metric s to compute. Multiple metrics can be computed at once for efficiency. |
| params | MetricParameters struct holds parameters required by different metrics. |
Definition at line 1894 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::RaycastingScene::AddTriangles(), cloudViewer::t::geometry::RaycastingScene::ComputeDistance(), cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::core::IsDevice::IsCPU(), IsEmpty(), LogError, LogWarning, params, and To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::ComputeTriangleAreas | ( | ) |
Function to compute triangle areas and save it as a triangle attribute "areas". Prints a warning, if mesh is empty or has no triangles.
Definition at line 335 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::ComputeTriangleAreasHelper(), cloudViewer::core::Tensor::Empty(), GetDevice(), cloudViewer::core::Tensor::GetDtype(), GetVertexPositions(), HasTriangleAttr(), HasTriangleIndices(), IsEmpty(), LogWarning, and SetTriangleAttr().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh(), RemoveNonManifoldEdges(), and SamplePointsUniformly().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::ComputeTriangleNormals | ( | bool | normalized = true | ) |
Function to compute triangle normals, usually called before rendering.
Definition at line 241 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::kernel::trianglemesh::ComputeTriangleNormalsCPU(), CUDA_CALL, GetDevice(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Tensor::GetLength(), GetTriangleIndices(), GetVertexPositions(), HasTriangleIndices(), cloudViewer::core::IsDevice::IsCPU(), cloudViewer::core::IsDevice::IsCUDA(), IsEmpty(), LogError, LogWarning, NormalizeNormals(), SetTriangleIndices(), SetTriangleNormals(), and SetVertexPositions().
Referenced by ComputeVertexNormals(), cloudViewer::t::geometry::pybind_trianglemesh(), and SamplePointsUniformly().
| std::tuple< float, int, int > cloudViewer::t::geometry::TriangleMesh::ComputeUVAtlas | ( | size_t | size = 512, |
| float | gutter = 1.0f, |
||
| float | max_stretch = 1.f / 6, |
||
| int | parallel_partitions = 1, |
||
| int | nthreads = 0 |
||
| ) |
Creates an UV atlas and adds it as triangle attr 'texture_uvs' to the mesh.
Input meshes must be manifold for this method to work.
The algorithm is based on:
This function always uses the CPU device.
| size | The target size of the texture (size x size). The uv coordinates will still be in the range [0..1] but parameters like gutter use pixels as units. |
| gutter | This is the space around the uv islands in pixels. |
| max_stretch | The maximum amount of stretching allowed. The parameter range is [0..1] with 0 meaning no stretch allowed. |
| parallel_partitions | The approximate number of partitions created before computing the UV atlas for parallelizing the computation. Parallelization can be enabled with values > 1. Note that parallelization increases the number of UV islands and can lead to results with lower quality. |
| nthreads | The number of threads used when parallel_partitions is > 1. Set to 0 for automatic number of thread detection. |
Definition at line 803 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), and size.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::ComputeVertexNormals | ( | bool | normalized = true | ) |
Function to compute vertex normals, usually called before rendering.
Definition at line 277 of file TriangleMesh.cpp.
References ComputeTriangleNormals(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeVertexNormalsCPU(), CUDA_CALL, GetDevice(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Tensor::GetLength(), GetTriangleIndices(), GetTriangleNormals(), GetVertexPositions(), HasTriangleIndices(), cloudViewer::core::IsDevice::IsCPU(), cloudViewer::core::IsDevice::IsCUDA(), IsEmpty(), LogError, LogWarning, NormalizeNormals(), SetTriangleIndices(), SetTriangleNormals(), SetVertexNormals(), vertex_num, and cloudViewer::core::Tensor::Zeros().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a arrow triangle mesh.
| cylinder_radius | defines the radius of the cylinder. |
| cone_radius | defines the radius of the cone. |
| cylinder_height | defines the height of the cylinder. The axis of cylinder is from (0, 0, 0) to (0, 0, cylinder_height). |
| cone_height | defines the height of the cone. The axis of the cone will be from (0, 0, cylinder_height) to (0, 0, cylinder_height + cone_height). |
| resolution | defines the resolution of the cone. The circle will be split into resolution segments. |
| cylinder_split | defines the number of segments along the cylinder_height direction. |
| cone_split | defines the number of segments along the cone_height direction. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 183 of file TriangleMeshFactory.cpp.
References ccMesh::CreateArrow(), and FromLegacy().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a box triangle mesh. One vertex of the box will be placed at the origin and the box aligns with the positive x, y, and z axes.
| width | is x-directional length. |
| height | is y-directional length. |
| depth | is z-directional length. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 22 of file TriangleMeshFactory.cpp.
References cloudViewer::core::Float32, cloudViewer::core::Float64, height, cloudViewer::core::Int32, cloudViewer::core::Int64, LogError, cloudViewer::core::Tensor::To(), cloudViewer::core::Dtype::ToString(), and width.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a cone triangle mesh.
| radius | defines the radius of the cone. |
| height | defines the height of the cone. The axis of the cone will be from (0, 0, 0) to (0, 0, height). |
| resolution | defines the resolution of the cone. The circle will be split into resolution segments. |
| split | defines the number of segments along the height direction. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 151 of file TriangleMeshFactory.cpp.
References ccMesh::CreateCone(), FromLegacy(), and height.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a coordinate frame mesh.
| size | defines the size of the coordinate frame. |
| origin | defines the origin of the coordinate frame. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 203 of file TriangleMeshFactory.cpp.
References ccMesh::CreateCoordinateFrame(), FromLegacy(), and size.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a cylinder triangle mesh.
| radius | defines the radius of the cylinder. |
| height | defines the height of the cylinder. The axis of the cylinder will be from (0, 0, -height/2) to (0, 0, height/2). |
| resolution | defines the resolution of the cylinder. The circle will be split into resolution segments |
| split | defines the number of segments along the height direction. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 135 of file TriangleMeshFactory.cpp.
References ccMesh::CreateCylinder(), FromLegacy(), and height.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a icosahedron triangle mesh. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.
| radius | defines the distance from centroid to mesh vertices. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 123 of file TriangleMeshFactory.cpp.
References ccMesh::CreateIcosahedron(), and FromLegacy().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a mesh from a 3D scalar field (volume) by computing the isosurface. This method uses the Flying Edges dual contouring method that computes the isosurface similar to Marching Cubes. The center of the first voxel of the volume is at the origin (0,0,0). The center of the voxel at index [z,y,x] will be at (x,y,z).
| volume | 3D tensor with the volume. |
| contour_values | A list of contour values at which isosurfaces will be generated. The default value is 0. |
| device | The device for the returned mesh. |
Definition at line 279 of file TriangleMeshFactory.cpp.
References AssertTensorDtypes, AssertTensorShape, cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor(), cloudViewer::core::Float32, cloudViewer::core::Float64, and cloudViewer::core::None.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a Mobius strip.
| length_split | defines the number of segments along the Mobius strip. |
| width_split | defines the number of segments along the width of the Mobius strip. |
| twists | defines the number of twists of the strip. |
| radius | defines the radius of the Mobius strip. |
| flatness | controls the height of the strip. |
| width | controls the width of the Mobius strip. |
| scale | is used to scale the entire Mobius strip. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 217 of file TriangleMeshFactory.cpp.
References ccMesh::CreateMobius(), FromLegacy(), and width.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a octahedron triangle mesh. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.
| radius | defines the distance from centroid to mesh vertices. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 111 of file TriangleMeshFactory.cpp.
References ccMesh::CreateOctahedron(), and FromLegacy().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a sphere triangle mesh. The sphere with radius will be centered at (0, 0, 0). Its axis is aligned with z-axis.
| radius | defines the radius of the sphere. |
| resolution | defines the resolution of the sphere. The longitudes will be split into resolution segments (i.e. there are resolution + 1 latitude lines including the north and south pole). The latitudes will be split into `2 * resolution segments (i.e. there are 2 * resolution longitude lines.) |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 86 of file TriangleMeshFactory.cpp.
References ccMesh::CreateSphere(), and FromLegacy().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a tetrahedron triangle mesh. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.
| radius | defines the distance from centroid to mesh vertices. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 99 of file TriangleMeshFactory.cpp.
References ccMesh::CreateTetrahedron(), and FromLegacy().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a text triangle mesh.
| text | The text for generating the mesh. ASCII characters 32-126 are supported (includes alphanumeric characters and punctuation). In addition the line feed ' ' is supported to start a new line. |
| depth | The depth of the generated mesh. If depth is 0 then a flat mesh will be generated. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 236 of file TriangleMeshFactory.cpp.
References cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::core::Float32, cloudViewer::core::Float64, cloudViewer::core::Int32, cloudViewer::core::Int64, LogError, and cloudViewer::core::Dtype::ToString().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a torus triangle mesh.
| torus_radius | defines the radius from the center of the torus to the center of the tube. |
| tube_radius | defines the radius of the torus tube. |
| radial_resolution | defines the number of segments along the radial direction. |
| tubular_resolution | defines the number of segments along the tubular direction. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in. |
Definition at line 167 of file TriangleMeshFactory.cpp.
References ccMesh::CreateTorus(), and FromLegacy().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::ExtrudeLinear | ( | const core::Tensor & | vector, |
| double | scale = 1.0, |
||
| bool | capping = true |
||
| ) | const |
Sweeps the triangle mesh along a direction vector.
| vector | The direction vector. |
| scale | Scalar factor which essentially scales the direction vector. |
| capping | If true adds caps to the mesh. |
Definition at line 1105 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::vtkutils::ExtrudeLinearTriangleMesh().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::ExtrudeRotation | ( | double | angle, |
| const core::Tensor & | axis, | ||
| int | resolution = 16, |
||
| double | translation = 0.0, |
||
| bool | capping = true |
||
| ) | const |
Sweeps the triangle mesh rotationally about an axis.
| 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 1095 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::vtkutils::ExtrudeRotationTriangleMesh().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::FillHoles | ( | double | hole_size = 1e6 | ) | const |
Fill holes by triangulating boundary edges.
This function always uses the CPU device.
| hole_size | This is the approximate threshold for filling holes. The value describes the maximum radius of holes to be filled. |
Definition at line 789 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkPolyDataFromGeometry(), GetVertexAttr(), and result.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
static |
Create a TriangleMesh from a legacy CloudViewer TriangleMesh.
| mesh_legacy | Legacy CloudViewer TriangleMesh. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in (default CPU:0). |
Definition at line 379 of file TriangleMesh.cpp.
References colors, cloudViewer::core::eigen_converter::EigenVector2dVectorToTensor(), cloudViewer::core::eigen_converter::EigenVector3dVectorToTensor(), cloudViewer::core::eigen_converter::EigenVector3iVectorToTensor(), cloudViewer::core::Float32, cloudViewer::core::Float64, cloudViewer::t::geometry::Image::FromLegacy(), ccMesh::getEigenVertices(), cloudViewer::t::geometry::DrawableGeometry::GetMaterial(), ccMesh::getTriangleVertIndexes(), ccMesh::getVertexColors(), ccMesh::getVertexNormals(), ccMesh::hasTriangleUvs(), ccMesh::HasVertices(), cloudViewer::core::Int32, cloudViewer::core::Int64, LogError, LogWarning, ccMesh::materials_, normals, cloudViewer::core::Tensor::Reshape(), cloudViewer::visualization::rendering::Material::SetDefaultProperties(), SetTriangleAttr(), SetTriangleIndices(), SetVertexColors(), SetVertexNormals(), SetVertexPositions(), ccMesh::size(), cloudViewer::core::Dtype::ToString(), and ccMesh::triangle_uvs_.
Referenced by CreateArrow(), CreateCone(), CreateCoordinateFrame(), CreateCylinder(), CreateIcosahedron(), CreateMobius(), CreateOctahedron(), CreateSphere(), CreateTetrahedron(), CreateTorus(), FromTriangleMeshModel(), cloudViewer::t::geometry::pybind_trianglemesh(), and cloudViewer::t::io::ReadTriangleMesh().
|
static |
Convert a TriangleMeshModel (e.g. as read from a file with cloudViewer::io::ReadTriangleMeshModel) to an unordered map of mesh names to TriangleMeshes. Only one material is supported per mesh. Materials common to multiple meshes will be dupicated. Textures (as t::geometry::Image) will use shared storage.
| model | TriangleMeshModel to convert. |
| float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
| int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
| device | The device where the resulting TriangleMesh resides in (default CPU:0). Material textures use CPU storage - GPU resident texture images are not yet supported. |
Definition at line 602 of file TriangleMesh.cpp.
References FromLegacy(), cloudViewer::visualization::rendering::Material::FromMaterialRecord(), cloudViewer::visualization::rendering::TriangleMeshModel::materials_, and cloudViewer::visualization::rendering::TriangleMeshModel::meshes_.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| AxisAlignedBoundingBox cloudViewer::t::geometry::TriangleMesh::GetAxisAlignedBoundingBox | ( | ) | const |
Create an axis-aligned bounding box from vertex attribute "positions".
Definition at line 781 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::AxisAlignedBoundingBox::CreateFromPoints(), and GetVertexPositions().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Definition at line 632 of file TriangleMesh.h.
References GetVertexPositions(), and cloudViewer::core::Tensor::Mean().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh(), and Translate().
|
inlineoverridevirtual |
Returns the device of the geometry.
Implements cloudViewer::t::geometry::Geometry.
Definition at line 721 of file TriangleMesh.h.
References device_.
Referenced by Clone(), ComputeTriangleAreas(), cloudViewer::t::geometry::ComputeTriangleAreasHelper(), ComputeTriangleNormals(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), ComputeVertexNormals(), PCAPartition(), ProjectImagesToAlbedo(), cloudViewer::t::geometry::pybind_trianglemesh(), RemoveUnreferencedVertices(), SamplePointsUniformly(), Scale(), To(), ToString(), and Translate().
|
inline |
Definition at line 630 of file TriangleMesh.h.
References GetVertexPositions(), and cloudViewer::core::Tensor::Max().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ComputeAABB(), and cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Definition at line 628 of file TriangleMesh.h.
References GetVertexPositions(), and cloudViewer::core::Tensor::Min().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ComputeAABB(), and cloudViewer::t::geometry::pybind_trianglemesh().
| core::Tensor cloudViewer::t::geometry::TriangleMesh::GetNonManifoldEdges | ( | bool | allow_boundary_edges = true | ) | const |
Returns the non-manifold edges of the triangle mesh. If
| allow_boundary_edges | is set to false, then also boundary edges are returned. |
Definition at line 1781 of file TriangleMesh.cpp.
References cloudViewer::core::Tensor::Contiguous(), DISPATCH_INT_DTYPE_PREFIX_TO_TEMPLATE, cloudViewer::core::Tensor::GetDevice(), cloudViewer::core::Tensor::GetDtype(), GetTriangleIndices(), HasTriangleIndices(), HasVertexPositions(), LogWarning, result, and cloudViewer::core::Tensor::To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| OrientedBoundingBox cloudViewer::t::geometry::TriangleMesh::GetOrientedBoundingBox | ( | ) | const |
Create an oriented bounding box from vertex attribute "positions".
Definition at line 785 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::OrientedBoundingBox::CreateFromPoints(), and GetVertexPositions().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| double cloudViewer::t::geometry::TriangleMesh::GetSurfaceArea | ( | ) | const |
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces.
Definition at line 361 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::ComputeTriangleAreasHelper(), cloudViewer::core::Float64, HasTriangleIndices(), IsEmpty(), LogWarning, cloudViewer::core::Tensor::Sum(), and To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Getter for triangle_attr_ TensorMap.
Definition at line 162 of file TriangleMesh.h.
References triangle_attr_.
|
inline |
Getter for triangle_attr_ TensorMap. Used in Pybind.
Definition at line 159 of file TriangleMesh.h.
References triangle_attr_.
Referenced by ClipPlane(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::geometry::CopyAttributesByMasks(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::io::rpc::GeometryToMeshData(), GetTriangleColors(), GetTriangleIndices(), GetTriangleNormals(), HasTriangleAttr(), ProjectImagesToAlbedo(), cloudViewer::t::geometry::pybind_trianglemesh(), RemoveNonManifoldEdges(), RemoveUnreferencedVertices(), SamplePointsUniformly(), SelectByIndex(), SelectFacesByMask(), cloudViewer::io::rpc::SetTriangleMesh(), and ToLegacy().
|
inline |
Get triangle attributes in triangle_attr_. Throws exception if the attribute does not exist.
| key | Attribute name. |
Definition at line 168 of file TriangleMesh.h.
References triangle_attr_.
|
inline |
Get triangle attributes in triangle_attr_. Throws exception if the attribute does not exist.
| key | Attribute name. |
Definition at line 219 of file TriangleMesh.h.
References triangle_attr_.
|
inline |
Get the value of the "colors" attribute in triangle_attr_. Convenience function.
Definition at line 182 of file TriangleMesh.h.
References GetTriangleAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers().
|
inline |
Get the value of the "colors" attribute in triangle_attr_. Convenience function.
Definition at line 245 of file TriangleMesh.h.
References GetTriangleAttr().
|
inline |
Get the value of the "indices" attribute in triangle_attr_. Convenience function.
Definition at line 174 of file TriangleMesh.h.
References GetTriangleAttr().
Referenced by cloudViewer::t::geometry::RaycastingScene::AddTriangles(), BakeTriangleAttrTextures(), BakeVertexAttrTextures(), cloudViewer::t::geometry::ComputeTriangleAreasHelper(), ComputeTriangleNormals(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), ComputeVertexNormals(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), GetNonManifoldEdges(), HasTriangleAttr(), PCAPartition(), cloudViewer::t::io::ReadTriangleMesh(), RemoveNonManifoldEdges(), RemoveUnreferencedVertices(), SamplePointsUniformly(), SelectByIndex(), SelectFacesByMask(), cloudViewer::io::rpc::SetTriangleMesh(), ToLegacy(), and ToString().
|
inline |
Get the value of the "indices" attribute in triangle_attr_. Convenience function.
Definition at line 233 of file TriangleMesh.h.
References GetTriangleAttr().
|
inline |
Get the value of the "normals" attribute in triangle_attr_. Convenience function.
Definition at line 178 of file TriangleMesh.h.
References GetTriangleAttr().
Referenced by ComputeVertexNormals(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), NormalizeNormals(), Rotate(), SamplePointsUniformly(), and Transform().
|
inline |
Get the value of the "normals" attribute in triangle_attr_. Convenience function.
Definition at line 239 of file TriangleMesh.h.
References GetTriangleAttr().
|
inline |
Getter for vertex_attr_ TensorMap.
Definition at line 136 of file TriangleMesh.h.
References vertex_attr_.
|
inline |
Getter for vertex_attr_ TensorMap. Used in Pybind.
Definition at line 133 of file TriangleMesh.h.
References vertex_attr_.
Referenced by ClipPlane(), cloudViewer::t::geometry::vtkutils::ComputeNormals(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::geometry::CopyAttributesByMasks(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), FillHoles(), cloudViewer::io::rpc::GeometryToMeshData(), GetVertexColors(), GetVertexNormals(), GetVertexPositions(), HasVertexAttr(), cloudViewer::t::geometry::pybind_trianglemesh(), RemoveNonManifoldEdges(), RemoveUnreferencedVertices(), SelectByIndex(), SelectFacesByMask(), cloudViewer::io::rpc::SetTriangleMesh(), and SlicePlane().
|
inline |
Get vertex attributes in vertex_attr_. Throws exception if the attribute does not exist.
| key | Attribute name. |
Definition at line 142 of file TriangleMesh.h.
References vertex_attr_.
|
inline |
Get vertex attributes. Throws exception if the attribute does not exist.
| key | Attribute name. |
Definition at line 187 of file TriangleMesh.h.
References vertex_attr_.
|
inline |
Get the value of the "colors" attribute in vertex_attr_. Convenience function.
Definition at line 152 of file TriangleMesh.h.
References GetVertexAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), SamplePointsUniformly(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), and ToLegacy().
|
inline |
Get the value of the "colors" attribute in vertex_attr_. Convenience function.
Definition at line 205 of file TriangleMesh.h.
References GetVertexAttr().
|
inline |
Get the value of the "normals" attribute in vertex_attr_. Convenience function.
Definition at line 156 of file TriangleMesh.h.
References GetVertexAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), NormalizeNormals(), Rotate(), SamplePointsUniformly(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), ToLegacy(), and Transform().
|
inline |
Get the value of the "normals" attribute in vertex_attr_. Convenience function.
Definition at line 211 of file TriangleMesh.h.
References GetVertexAttr().
|
inline |
Get the value of the "positions" attribute in vertex_attr_. Convenience function.
Definition at line 148 of file TriangleMesh.h.
References GetVertexAttr().
Referenced by cloudViewer::t::geometry::RaycastingScene::AddTriangles(), ComputeConvexHull(), ComputeTriangleAreas(), cloudViewer::t::geometry::ComputeTriangleAreasHelper(), ComputeTriangleNormals(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), ComputeVertexNormals(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), GetAxisAlignedBoundingBox(), GetCenter(), GetMaxBound(), GetMinBound(), GetOrientedBoundingBox(), HasVertexAttr(), PCAPartition(), ProjectImagesToAlbedo(), cloudViewer::t::io::ReadTriangleMesh(), RemoveNonManifoldEdges(), RemoveUnreferencedVertices(), Rotate(), SamplePointsUniformly(), Scale(), SelectByIndex(), SelectFacesByMask(), cloudViewer::io::rpc::SetTriangleMesh(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), ToLegacy(), ToString(), Transform(), and Translate().
|
inline |
Get the value of the "positions" attribute in vertex_attr_. Convenience function.
Definition at line 199 of file TriangleMesh.h.
References GetVertexAttr().
|
inline |
Returns true if all of the following are true in triangle_attr_: 1) attribute key exist 2) attribute's length as triangles' length 3) attribute's length > 0
Definition at line 343 of file TriangleMesh.h.
References cloudViewer::t::geometry::TensorMap::Contains(), cloudViewer::core::Tensor::GetLength(), GetTriangleAttr(), GetTriangleIndices(), and triangle_attr_.
Referenced by ComputeTriangleAreas(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::geometry::CopyAttributesByMasks(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), HasTriangleColors(), HasTriangleIndices(), HasTriangleNormals(), ProjectImagesToAlbedo(), RemoveNonManifoldEdges(), SamplePointsUniformly(), and ToLegacy().
|
inline |
Returns true if all of the following are true in triangle_attr_: 1) attribute "colors" exist 2) attribute "colors"'s length as vertices' length 3) attribute "colors"'s length > 0 Convenience function.
Definition at line 367 of file TriangleMesh.h.
References HasTriangleAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers().
|
inline |
Check if the "indices" attribute's value in triangle_attr_ has length
0.
Convenience function.
Definition at line 353 of file TriangleMesh.h.
References HasTriangleAttr().
Referenced by ComputeTriangleAreas(), ComputeTriangleNormals(), ComputeVertexNormals(), cloudViewer::t::geometry::CopyAttributesByMasks(), GetNonManifoldEdges(), GetSurfaceArea(), cloudViewer::t::io::ReadTriangleMesh(), RemoveNonManifoldEdges(), RemoveUnreferencedVertices(), SamplePointsUniformly(), SelectByIndex(), SelectFacesByMask(), and ToLegacy().
|
inline |
Returns true if all of the following are true in triangle_attr_: 1) attribute "normals" exist 2) attribute "normals"'s length as vertices' length 3) attribute "normals"'s length > 0 Convenience function.
Definition at line 360 of file TriangleMesh.h.
References HasTriangleAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), NormalizeNormals(), Rotate(), SamplePointsUniformly(), and Transform().
|
inline |
Returns true if all of the following are true in vertex_attr_: 1) attribute key exist 2) attribute's length as vertices' length 3) attribute's length > 0
Definition at line 314 of file TriangleMesh.h.
References cloudViewer::t::geometry::TensorMap::Contains(), cloudViewer::core::Tensor::GetLength(), GetVertexAttr(), GetVertexPositions(), and vertex_attr_.
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::geometry::CopyAttributesByMasks(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), HasVertexColors(), HasVertexNormals(), HasVertexPositions(), and ToLegacy().
|
inline |
Returns true if all of the following are true in vertex_attr_: 1) attribute "colors" exist 2) attribute "colors"'s length as vertices' length 3) attribute "colors"'s length > 0 Convenience function.
Definition at line 330 of file TriangleMesh.h.
References HasVertexAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), SamplePointsUniformly(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), and ToLegacy().
|
inline |
Returns true if all of the following are true in vertex_attr_: 1) attribute "normals" exist 2) attribute "normals"'s length as vertices' length 3) attribute "normals"'s length > 0 Convenience function.
Definition at line 337 of file TriangleMesh.h.
References HasVertexAttr().
Referenced by cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), NormalizeNormals(), Rotate(), SamplePointsUniformly(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), ToLegacy(), and Transform().
|
inline |
Check if the "positions" attribute's value in vertex_attr_ has length > 0. Convenience function.
Definition at line 323 of file TriangleMesh.h.
References HasVertexAttr().
Referenced by cloudViewer::t::geometry::CopyAttributesByMasks(), GetNonManifoldEdges(), IsEmpty(), cloudViewer::t::io::ReadTriangleMesh(), RemoveNonManifoldEdges(), RemoveUnreferencedVertices(), SelectByIndex(), SelectFacesByMask(), and ToLegacy().
|
inlineoverridevirtual |
Returns !HasVertexPositions(), triangles are ignored.
Implements cloudViewer::t::geometry::Geometry.
Definition at line 626 of file TriangleMesh.h.
References HasVertexPositions().
Referenced by ComputeMetrics(), ComputeTriangleAreas(), ComputeTriangleNormals(), ComputeVertexNormals(), GetSurfaceArea(), and SamplePointsUniformly().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::NormalizeNormals | ( | ) |
Normalize both triangle normals and vertex normals to length 1.
Definition at line 207 of file TriangleMesh.cpp.
References CUDA_CALL, GetTriangleNormals(), GetVertexNormals(), HasTriangleNormals(), HasVertexNormals(), cloudViewer::core::IsDevice::IsCPU(), cloudViewer::core::IsDevice::IsCUDA(), LogError, LogWarning, cloudViewer::t::geometry::kernel::trianglemesh::NormalizeNormalsCPU(), SetTriangleNormals(), and SetVertexNormals().
Referenced by ComputeTriangleNormals(), ComputeVertexNormals(), and cloudViewer::t::geometry::pybind_trianglemesh().
| int cloudViewer::t::geometry::TriangleMesh::PCAPartition | ( | int | max_faces | ) |
Partition the mesh by recursively doing PCA. This function creates a new triangle attribute with the name "partition_ids".
| max_faces | The maximum allowed number of faces in a partition. |
Definition at line 1112 of file TriangleMesh.cpp.
References GetDevice(), cloudViewer::core::Tensor::GetLength(), GetTriangleIndices(), GetVertexPositions(), cloudViewer::core::Tensor::IndexGet(), LogError, cloudViewer::t::geometry::kernel::pcapartition::PCAPartition(), SetTriangleAttr(), and cloudViewer::core::Tensor::To().
Referenced by cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), and cloudViewer::t::geometry::pybind_trianglemesh().
| Image cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo | ( | const std::vector< Image > & | images, |
| const std::vector< core::Tensor > & | intrinsic_matrices, | ||
| const std::vector< core::Tensor > & | extrinsic_matrices, | ||
| int | tex_size = 1024, |
||
| bool | update_material = true |
||
| ) |
Create an albedo for the triangle mesh using calibrated images. The triangle mesh must have texture coordinates ("texture_uvs" triangle attribute). This works by back projecting the images onto the texture surface. Overlapping images are blended together in the resulting albedo. For best results, use images captured with exposure and white balance lock to reduce the chance of seams in the output texture.
This function is only supported on the CPU device.
| images | vector of images. |
| intrinsic_matrices | vector of {3,3} intrinsic matrices describing the pinhole camera. |
| extrinsic_matrices | vector of {4,4} extrinsic matrices describing the position and orientation of the camera. |
| tex_size | Output albedo texture size. This is a square image, so only one side is needed. |
| update_material | Whether to update the material of the triangle mesh, possibly overwriting an existing albedo texture. |
Definition at line 1471 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::RaycastingScene::AddTriangles(), AssertTensorDtype, AssertTensorShape, BakeVertexAttrTextures(), cloudViewer::t::geometry::RaycastingScene::CastRays(), cloudViewer::core::Tensor::Contiguous(), cloudViewer::t::geometry::TensorMap::Contiguous(), cloudViewer::t::geometry::RaycastingScene::CreateRaysPinhole(), cloudViewer::core::Tensor::Empty(), cloudViewer::ml::contrib::EPS, cloudViewer::core::Tensor::Fill(), cloudViewer::core::Float32, cloudViewer::core::Tensor::GetDataPtr(), GetDevice(), cloudViewer::core::Tensor::GetItem(), cloudViewer::t::geometry::DrawableGeometry::GetMaterial(), GetTriangleAttr(), GetVertexPositions(), cloudViewer::t::geometry::DrawableGeometry::HasMaterial(), HasTriangleAttr(), cloudViewer::t::geometry::Image::HAVE_IPP, height, IPP_CALL, cloudViewer::core::IsDevice::IsCPU(), cloudViewer::t::geometry::Image::Linear, LogDebug, LogError, min(), cloudViewer::core::None, cloudViewer::core::Tensor::NumElements(), cloudViewer::core::Tensor::Permute(), cloudViewer::t::geometry::kernel::pointcloud::Project(), cloudViewer::t::geometry::ipp::Remap(), result, cloudViewer::visualization::rendering::Material::SetAlbedoMap(), cloudViewer::visualization::rendering::Material::SetDefaultProperties(), cloudViewer::t::geometry::DrawableGeometry::SetMaterial(), cloudViewer::core::Tensor::Slice(), cloudViewer::t::geometry::Image::To(), cloudViewer::core::UInt8, width, and cloudViewer::core::Tensor::Zeros().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::RemoveNonManifoldEdges | ( | ) |
Removes all non-manifold edges, by successively deleting triangles with the smallest surface area adjacent to the non-manifold edge until the number of adjacent triangles to the edge is <= 2. If mesh is empty or has no triangles, prints a warning and returns immediately.
Definition at line 1697 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::TensorMap::AssertSizeSynchronized(), ComputeTriangleAreas(), cloudViewer::core::Tensor::Contiguous(), cloudViewer::t::geometry::TensorMap::Contiguous(), DISPATCH_FLOAT_INT_DTYPE_TO_TEMPLATE, cloudViewer::core::Tensor::GetDtype(), GetTriangleAttr(), GetTriangleIndices(), GetVertexAttr(), GetVertexPositions(), HasTriangleAttr(), HasTriangleIndices(), HasVertexPositions(), LogWarning, and cloudViewer::core::Tensor::To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Removes triangle attribute by key value. Primary attribute "indices" cannot be removed. Throws warning if attribute key does not exists.
| key | Attribute name. |
Definition at line 227 of file TriangleMesh.h.
References cloudViewer::t::geometry::TensorMap::Erase(), and triangle_attr_.
Referenced by cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices | ( | ) |
Removes unreferenced vertices from the mesh.
Definition at line 1354 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::TensorMap::AssertSizeSynchronized(), cloudViewer::core::Bool, cloudViewer::core::Tensor::Contiguous(), DISPATCH_INT_DTYPE_PREFIX_TO_TEMPLATE, cloudViewer::core::Tensor::GetDataPtr(), GetDevice(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Tensor::GetLength(), GetTriangleAttr(), GetTriangleIndices(), GetVertexAttr(), GetVertexPositions(), HasTriangleIndices(), HasVertexPositions(), cloudViewer::core::Int64, LogDebug, LogWarning, SetTriangleIndices(), SetVertexAttr(), cloudViewer::core::Tensor::To(), and cloudViewer::core::Tensor::Zeros().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Removes vertex attribute by key value. Primary attribute "positions" cannot be removed. Throws warning if attribute key does not exists.
| key | Attribute name. |
Definition at line 195 of file TriangleMesh.h.
References cloudViewer::t::geometry::TensorMap::Erase(), and vertex_attr_.
Referenced by cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::Rotate | ( | const core::Tensor & | R, |
| const core::Tensor & | center | ||
| ) |
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
| R | Rotation [Tensor of dim {3,3}]. |
| center | Center [Tensor of dim {3}] about which the TriangleMesh is to be scaled. |
Definition at line 192 of file TriangleMesh.cpp.
References AssertTensorShape, GetTriangleNormals(), GetVertexNormals(), GetVertexPositions(), HasTriangleNormals(), HasVertexNormals(), cloudViewer::t::geometry::kernel::transform::RotateNormals(), and cloudViewer::t::geometry::kernel::transform::RotatePoints().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| PointCloud cloudViewer::t::geometry::TriangleMesh::SamplePointsUniformly | ( | size_t | number_of_points, |
| bool | use_triangle_normal = false |
||
| ) |
Sample points uniformly from the triangle mesh surface and return as a PointCloud. Normals and colors are interpolated from the triangle mesh. If texture_uvs and albedo are present, these are used to estimate the sampled point color, otherwise vertex colors are used, if present. During sampling, triangle areas are computed and saved in the "areas" attribute.
| number_of_points | The number of points to sample. |
| use_triangle_normal | If true, use the triangle normal as the normal of the sampled point. Otherwise, interpolate the vertex normals. |
Definition at line 1821 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::Image::AsTensor(), ComputeTriangleAreas(), ComputeTriangleNormals(), cloudViewer::core::Tensor::Contiguous(), cloudViewer::t::geometry::TensorMap::Contiguous(), cloudViewer::core::Float32, cloudViewer::visualization::rendering::Material::GetAlbedoMap(), GetDevice(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::t::geometry::DrawableGeometry::GetMaterial(), GetTriangleAttr(), GetTriangleIndices(), GetTriangleNormals(), GetVertexColors(), GetVertexNormals(), GetVertexPositions(), cloudViewer::visualization::rendering::Material::HasAlbedoMap(), HasTriangleAttr(), HasTriangleIndices(), HasTriangleNormals(), HasVertexColors(), HasVertexNormals(), cloudViewer::core::IsDevice::IsCPU(), IsEmpty(), LogError, LogWarning, result, cloudViewer::t::geometry::kernel::trianglemesh::SamplePointsUniformlyCPU(), cloudViewer::t::geometry::PointCloud::SetPointColors(), cloudViewer::t::geometry::PointCloud::SetPointNormals(), cloudViewer::t::geometry::Image::To(), cloudViewer::t::geometry::PointCloud::To(), cloudViewer::core::Tensor::To(), cloudViewer::core::UInt16, and cloudViewer::core::UInt8.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::Scale | ( | double | scale, |
| const core::Tensor & | center | ||
| ) |
Scales the VertexPositions of the TriangleMesh.
| scale | Scale [double] of dimension |
| center | Center [Tensor of dim {3}] about which the TriangleMesh is to be scaled. |
Definition at line 181 of file TriangleMesh.cpp.
References cloudViewer::core::Tensor::Add_(), AssertTensorDevice, AssertTensorShape, device_, GetDevice(), GetVertexPositions(), cloudViewer::core::Tensor::Mul_(), cloudViewer::core::Tensor::Sub_(), and cloudViewer::core::Tensor::To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::SelectByIndex | ( | const core::Tensor & | indices, |
| bool | copy_attributes = true |
||
| ) | const |
Returns a new mesh with the vertices selected by a vector of indices. If an item from the indices list exceeds the max vertex number of the mesh or has a negative value, it is ignored.
| indices | An integer list of indices. Duplicates are allowed, but ignored. Signed and unsigned integral types are allowed. |
| copy_attributes | Indicates if vertex attributes (other than positions) and triangle attributes (other than indices) should be copied to the returned mesh. |
Definition at line 1247 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::TensorMap::AssertSizeSynchronized(), AssertTensorShape, cloudViewer::core::Bool, cloudViewer::core::Tensor::Contiguous(), DISPATCH_INT_DTYPE_PREFIX_TO_TEMPLATE, cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Dtype::GetDtypeCode(), cloudViewer::core::Tensor::GetLength(), GetTriangleAttr(), GetTriangleIndices(), GetVertexAttr(), GetVertexPositions(), HasTriangleIndices(), HasVertexPositions(), cloudViewer::core::Tensor::IndexGet(), cloudViewer::core::Dtype::Int, cloudViewer::core::Int64, LogError, LogWarning, cloudViewer::core::Tensor::NumElements(), cloudViewer::core::Tensor::To(), cloudViewer::core::Dtype::ToString(), cloudViewer::core::Dtype::UInt, cloudViewer::core::Undefined, and cloudViewer::core::Tensor::Zeros().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask | ( | const core::Tensor & | mask | ) | const |
Returns a new mesh with the faces selected by a boolean mask.
| mask | A boolean mask with the shape (N) with N as the number of faces in the mesh. |
Definition at line 1176 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::TensorMap::AssertSizeSynchronized(), AssertTensorDtype, AssertTensorShape, cloudViewer::core::Bool, cloudViewer::core::Tensor::Contiguous(), DISPATCH_INT_DTYPE_PREFIX_TO_TEMPLATE, cloudViewer::core::Tensor::GetDataPtr(), cloudViewer::core::Tensor::GetDtype(), cloudViewer::core::Tensor::GetLength(), GetTriangleAttr(), GetTriangleIndices(), GetVertexAttr(), GetVertexPositions(), HasTriangleIndices(), HasVertexPositions(), cloudViewer::core::Tensor::IndexGet(), LogWarning, and cloudViewer::core::Tensor::To().
Referenced by cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), and cloudViewer::t::geometry::pybind_trianglemesh().
|
inline |
Set triangle attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.
| key | Attribute name. |
| value | A tensor. |
Definition at line 285 of file TriangleMesh.h.
References AssertTensorDevice, device_, and triangle_attr_.
Referenced by ComputeTriangleAreas(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::t::geometry::CopyAttributesByMasks(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), FromLegacy(), PCAPartition(), cloudViewer::t::io::ReadTriangleMeshFromNPZ(), cloudViewer::t::io::ReadTriangleMeshUsingASSIMP(), SetTriangleColors(), SetTriangleIndices(), SetTriangleNormals(), and To().
|
inline |
Set the value of the "colors" attribute in triangle_attr_. This is a convenience function.
Definition at line 305 of file TriangleMesh.h.
References AssertTensorShape, cloudViewer::utility::nullopt, and SetTriangleAttr().
Referenced by cloudViewer::t::io::ReadTriangleMeshFromNPZ().
|
inline |
Set the value of the "indices" attribute in triangle_attr_.
Definition at line 291 of file TriangleMesh.h.
References AssertTensorShape, cloudViewer::utility::nullopt, and SetTriangleAttr().
Referenced by ComputeTriangleNormals(), ComputeVertexNormals(), FromLegacy(), cloudViewer::t::io::ReadTriangleMeshFromNPZ(), cloudViewer::t::io::ReadTriangleMeshUsingASSIMP(), and RemoveUnreferencedVertices().
|
inline |
Set the value of the "normals" attribute in triangle_attr_. This is a convenience function.
Definition at line 298 of file TriangleMesh.h.
References AssertTensorShape, cloudViewer::utility::nullopt, and SetTriangleAttr().
Referenced by ComputeTriangleNormals(), ComputeVertexNormals(), NormalizeNormals(), and cloudViewer::t::io::ReadTriangleMeshFromNPZ().
|
inline |
Set vertex attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.
| key | Attribute name. |
| value | A tensor. |
Definition at line 254 of file TriangleMesh.h.
References AssertTensorDevice, device_, and vertex_attr_.
Referenced by cloudViewer::t::geometry::PointCloud::ComputeConvexHull(), cloudViewer::t::geometry::CopyAttributesByMasks(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::io::ReadTriangleMeshFromNPZ(), RemoveUnreferencedVertices(), SetVertexColors(), SetVertexNormals(), SetVertexPositions(), and To().
|
inline |
Set the value of the "colors" attribute in vertex_attr_. Convenience function.
Definition at line 268 of file TriangleMesh.h.
References AssertTensorShape, cloudViewer::utility::nullopt, and SetVertexAttr().
Referenced by cloudViewer::t::geometry::VoxelBlockGrid::ExtractTriangleMesh(), FromLegacy(), cloudViewer::t::io::ReadTriangleMeshFromNPZ(), and cloudViewer::t::io::ReadTriangleMeshUsingASSIMP().
|
inline |
Set the value of the "normals" attribute in vertex_attr_. This is a convenience function.
Definition at line 275 of file TriangleMesh.h.
References AssertTensorShape, cloudViewer::utility::nullopt, and SetVertexAttr().
Referenced by ComputeVertexNormals(), cloudViewer::t::geometry::VoxelBlockGrid::ExtractTriangleMesh(), FromLegacy(), NormalizeNormals(), cloudViewer::t::io::ReadTriangleMeshFromNPZ(), and cloudViewer::t::io::ReadTriangleMeshUsingASSIMP().
|
inline |
Set the value of the "positions" attribute in vertex_attr_. Convenience function.
Definition at line 261 of file TriangleMesh.h.
References AssertTensorShape, cloudViewer::utility::nullopt, and SetVertexAttr().
Referenced by ComputeTriangleNormals(), FromLegacy(), cloudViewer::t::io::ReadTriangleMeshFromNPZ(), and cloudViewer::t::io::ReadTriangleMeshUsingASSIMP().
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::SimplifyQuadricDecimation | ( | double | target_reduction, |
| bool | preserve_volume = true |
||
| ) | const |
Function to simplify mesh using Quadric Error Metric Decimation by Garland and Heckbert.
This function always uses the CPU device.
| target_reduction | The factor of triangles to delete, i.e., setting this to 0.9 will return a mesh with about 10% of the original triangle count. It is not guaranteed that the target reduction factor will be reached. |
| preserve_volume | If set to true this enables volume preservation which reduces the error in triangle normal direction. |
Definition at line 709 of file TriangleMesh.cpp.
References cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkPolyDataFromGeometry(), and LogError.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| LineSet cloudViewer::t::geometry::TriangleMesh::SlicePlane | ( | const core::Tensor & | point, |
| const core::Tensor & | normal, | ||
| const std::vector< double > | contour_values = {0.0} |
||
| ) | const |
Extract contour slices given a plane. This method extracts slices as LineSet from the mesh at specific contour values defined by the specified plane.
| point | A point on the plane as [Tensor of dim {3}]. |
| normal | The normal of the plane as [Tensor of dim {3}]. |
| contour_values | Contour values at which slices will be generated. The value describes the signed distance to the plane. |
Definition at line 671 of file TriangleMesh.cpp.
References AssertTensorDtypes, AssertTensorShape, cloudViewer::t::geometry::vtkutils::CreateLineSetFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkPolyDataFromGeometry(), cloudViewer::core::Float32, cloudViewer::core::Float64, GetVertexAttr(), cloudViewer::core::Int32, cloudViewer::core::Int64, and normal.
| TriangleMesh cloudViewer::t::geometry::TriangleMesh::To | ( | const core::Device & | device, |
| bool | copy = false |
||
| ) | const |
Transfer the triangle mesh to a specified device.
| device | The targeted device to convert to. |
| copy | If true, a new triangle mesh is always created; if false, the copy is avoided when the original triangle mesh is already on the targeted device. |
Definition at line 621 of file TriangleMesh.cpp.
References copy, GetDevice(), SetTriangleAttr(), SetVertexAttr(), triangle_attr_, and vertex_attr_.
Referenced by Clone(), cloudViewer::t::geometry::PointCloud::ComputeConvexHull(), ComputeMetrics(), GetSurfaceArea(), cloudViewer::t::geometry::pybind_trianglemesh(), and cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder().
| ccMesh cloudViewer::t::geometry::TriangleMesh::ToLegacy | ( | ) | const |
Convert to a legacy CloudViewer TriangleMesh.
Definition at line 479 of file TriangleMesh.cpp.
References ccMesh::addEigenVertices(), ccMesh::addTriangle(), ccMesh::addVertexColors(), ccMesh::addVertexNormals(), cloudViewer::t::geometry::DrawableGeometry::GetMaterial(), GetTriangleAttr(), GetTriangleIndices(), GetVertexColors(), GetVertexNormals(), GetVertexPositions(), HasTriangleAttr(), HasTriangleIndices(), HasVertexAttr(), HasVertexColors(), HasVertexNormals(), HasVertexPositions(), LogWarning, ccMesh::materials_, cloudViewer::core::eigen_converter::TensorToEigenVector2dVector(), cloudViewer::core::eigen_converter::TensorToEigenVector3dVector(), cloudViewer::core::eigen_converter::TensorToEigenVector3iVector(), and ccMesh::triangle_uvs_.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh(), and cloudViewer::visualization::visualizer::O3DVisualizer::Impl::UpdateGeometryForWireframeMode().
| std::string cloudViewer::t::geometry::TriangleMesh::ToString | ( | ) | const |
Text description.
Definition at line 96 of file TriangleMesh.cpp.
References format, GetDevice(), cloudViewer::core::Tensor::GetLength(), cloudViewer::t::geometry::TensorMap::GetPrimaryKey(), GetTriangleIndices(), GetVertexPositions(), triangle_attr_, and vertex_attr_.
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::Transform | ( | const core::Tensor & | transformation | ) |
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
Transformation matrix is a 4x4 matrix. T (4x4) = [[ R(3x3) t(3x1) ], [ O(1x3) s(1x1) ]] (s = 1 for Transformation without scaling)
It applies the following general transform to each positions and normals. |x'| | R(0,0) R(0,1) R(0,2) t(0)| |x| |y'| = | R(1,0) R(1,1) R(1,2) t(1)| @ |y| |z'| | R(2,0) R(2,1) R(2,2) t(2)| |z| |w'| | O(0,0) O(0,1) O(0,2) s | |1|
[x, y, z] = [x', y', z'] / w'
| transformation | Transformation [Tensor of dim {4,4}]. |
Definition at line 152 of file TriangleMesh.cpp.
References AssertTensorShape, GetTriangleNormals(), GetVertexNormals(), GetVertexPositions(), HasTriangleNormals(), HasVertexNormals(), cloudViewer::t::geometry::kernel::transform::TransformNormals(), and cloudViewer::t::geometry::kernel::transform::TransformPoints().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
| TriangleMesh & cloudViewer::t::geometry::TriangleMesh::Translate | ( | const core::Tensor & | translation, |
| bool | relative = true |
||
| ) |
Translates the VertexPositions of the TriangleMesh.
| translation | translation tensor of dimension {3} |
| relative | if true (default): translates relative to Center |
Definition at line 167 of file TriangleMesh.cpp.
References AssertTensorShape, GetCenter(), GetDevice(), GetVertexPositions(), and cloudViewer::core::Tensor::To().
Referenced by cloudViewer::t::geometry::pybind_trianglemesh().
|
protected |
Definition at line 1099 of file TriangleMesh.h.
Referenced by GetDevice(), Scale(), SetTriangleAttr(), and SetVertexAttr().
|
protected |
Definition at line 1101 of file TriangleMesh.h.
Referenced by BakeTriangleAttrTextures(), BakeVertexAttrTextures(), Clear(), GetTriangleAttr(), HasTriangleAttr(), RemoveTriangleAttr(), SetTriangleAttr(), To(), and ToString().
|
protected |
Definition at line 1100 of file TriangleMesh.h.
Referenced by BakeVertexAttrTextures(), Clear(), GetVertexAttr(), HasVertexAttr(), RemoveVertexAttr(), SetVertexAttr(), To(), and ToString().