Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
TriangleMesh.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2024 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10#include <list>
11#include <type_traits>
12#include <unordered_map>
13
14#include "open3d/core/Tensor.h"
22
23namespace open3d {
24namespace t {
25namespace geometry {
26
27class LineSet;
28class PointCloud;
29
96class TriangleMesh : public Geometry, public DrawableGeometry {
97public:
101 TriangleMesh(const core::Device &device = core::Device("CPU:0"));
102
111 TriangleMesh(const core::Tensor &vertex_positions,
112 const core::Tensor &triangle_indices);
113
114 virtual ~TriangleMesh() override {}
115
116public:
118 std::string ToString() const;
119
125 TriangleMesh To(const core::Device &device, bool copy = false) const;
126
128 TriangleMesh Clone() const { return To(GetDevice(), /*copy=*/true); }
129
131 const TensorMap &GetVertexAttr() const { return vertex_attr_; }
132
135
140 core::Tensor &GetVertexAttr(const std::string &key) {
141 return vertex_attr_.at(key);
142 }
143
147
151
155
157 const TensorMap &GetTriangleAttr() const { return triangle_attr_; }
158
161
166 core::Tensor &GetTriangleAttr(const std::string &key) {
167 return triangle_attr_.at(key);
168 }
169
173
177
181
185 const core::Tensor &GetVertexAttr(const std::string &key) const {
186 return vertex_attr_.at(key);
187 }
188
193 void RemoveVertexAttr(const std::string &key) { vertex_attr_.Erase(key); }
194
198 return GetVertexAttr("positions");
199 }
200
204 return GetVertexAttr("colors");
205 }
206
210 return GetVertexAttr("normals");
211 }
212
217 const core::Tensor &GetTriangleAttr(const std::string &key) const {
218 return triangle_attr_.at(key);
219 }
220
225 void RemoveTriangleAttr(const std::string &key) {
227 }
228
232 return GetTriangleAttr("indices");
233 }
234
238 return GetTriangleAttr("normals");
239 }
240
244 return GetTriangleAttr("colors");
245 }
246
252 void SetVertexAttr(const std::string &key, const core::Tensor &value) {
253 core::AssertTensorDevice(value, device_);
254 vertex_attr_[key] = value;
255 }
256
259 void SetVertexPositions(const core::Tensor &value) {
260 core::AssertTensorShape(value, {utility::nullopt, 3});
261 SetVertexAttr("positions", value);
262 }
263
266 void SetVertexColors(const core::Tensor &value) {
267 core::AssertTensorShape(value, {utility::nullopt, 3});
268 SetVertexAttr("colors", value);
269 }
270
273 void SetVertexNormals(const core::Tensor &value) {
274 core::AssertTensorShape(value, {utility::nullopt, 3});
275 SetVertexAttr("normals", value);
276 }
277
283 void SetTriangleAttr(const std::string &key, const core::Tensor &value) {
284 core::AssertTensorDevice(value, device_);
285 triangle_attr_[key] = value;
286 }
287
289 void SetTriangleIndices(const core::Tensor &value) {
290 core::AssertTensorShape(value, {utility::nullopt, 3});
291 SetTriangleAttr("indices", value);
292 }
293
296 void SetTriangleNormals(const core::Tensor &value) {
297 core::AssertTensorShape(value, {utility::nullopt, 3});
298 SetTriangleAttr("normals", value);
299 }
300
303 void SetTriangleColors(const core::Tensor &value) {
304 core::AssertTensorShape(value, {utility::nullopt, 3});
305 SetTriangleAttr("colors", value);
306 }
307
312 bool HasVertexAttr(const std::string &key) const {
313 return vertex_attr_.Contains(key) &&
314 GetVertexAttr(key).GetLength() > 0 &&
315 GetVertexAttr(key).GetLength() ==
317 }
318
321 bool HasVertexPositions() const { return HasVertexAttr("positions"); }
322
328 bool HasVertexColors() const { return HasVertexAttr("colors"); }
329
335 bool HasVertexNormals() const { return HasVertexAttr("normals"); }
336
341 bool HasTriangleAttr(const std::string &key) const {
342 return triangle_attr_.Contains(key) &&
343 GetTriangleAttr(key).GetLength() > 0 &&
344 GetTriangleAttr(key).GetLength() ==
346 }
347
351 bool HasTriangleIndices() const { return HasTriangleAttr("indices"); }
352
358 bool HasTriangleNormals() const { return HasTriangleAttr("normals"); }
359
365 bool HasTriangleColors() const { return HasTriangleAttr("colors"); }
366
377 static TriangleMesh CreateBox(
378 double width = 1.0,
379 double height = 1.0,
380 double depth = 1.0,
381 core::Dtype float_dtype = core::Float32,
382 core::Dtype int_dtype = core::Int64,
383 const core::Device &device = core::Device("CPU:0"));
384
399 double radius = 1.0,
400 int resolution = 20,
401 core::Dtype float_dtype = core::Float32,
402 core::Dtype int_dtype = core::Int64,
403 const core::Device &device = core::Device("CPU:0"));
404
415 double radius = 1.0,
416 core::Dtype float_dtype = core::Float32,
417 core::Dtype int_dtype = core::Int64,
418 const core::Device &device = core::Device("CPU:0"));
419
430 double radius = 1.0,
431 core::Dtype float_dtype = core::Float32,
432 core::Dtype int_dtype = core::Int64,
433 const core::Device &device = core::Device("CPU:0"));
434
445 double radius = 1.0,
446 core::Dtype float_dtype = core::Float32,
447 core::Dtype int_dtype = core::Int64,
448 const core::Device &device = core::Device("CPU:0"));
449
463 double radius = 1.0,
464 double height = 2.0,
465 int resolution = 20,
466 int split = 4,
467 core::Dtype float_dtype = core::Float32,
468 core::Dtype int_dtype = core::Int64,
469 const core::Device &device = core::Device("CPU:0"));
470
484 double radius = 1.0,
485 double height = 2.0,
486 int resolution = 20,
487 int split = 1,
488 core::Dtype float_dtype = core::Float32,
489 core::Dtype int_dtype = core::Int64,
490 const core::Device &device = core::Device("CPU:0"));
491
506 double torus_radius = 1.0,
507 double tube_radius = 0.5,
508 int radial_resolution = 30,
509 int tubular_resolution = 20,
510 core::Dtype float_dtype = core::Float32,
511 core::Dtype int_dtype = core::Int64,
512 const core::Device &device = core::Device("CPU:0"));
513
532 double cylinder_radius = 1.0,
533 double cone_radius = 1.5,
534 double cylinder_height = 5.0,
535 double cone_height = 4.0,
536 int resolution = 20,
537 int cylinder_split = 4,
538 int cone_split = 1,
539 core::Dtype float_dtype = core::Float32,
540 core::Dtype int_dtype = core::Int64,
541 const core::Device &device = core::Device("CPU:0"));
542
552 double size = 1.0,
553 const Eigen::Vector3d &origin = Eigen::Vector3d(0.0, 0.0, 0.0),
554 core::Dtype float_dtype = core::Float32,
555 core::Dtype int_dtype = core::Int64,
556 const core::Device &device = core::Device("CPU:0"));
557
574 int length_split = 70,
575 int width_split = 15,
576 int twists = 1,
577 double radius = 1,
578 double flatness = 1,
579 double width = 1,
580 double scale = 1,
581 core::Dtype float_dtype = core::Float32,
582 core::Dtype int_dtype = core::Int64,
583 const core::Device &device = core::Device("CPU:0"));
584
595 const std::string &text,
596 double depth = 0.0,
597 core::Dtype float_dtype = core::Float32,
598 core::Dtype int_dtype = core::Int64,
599 const core::Device &device = core::Device("CPU:0"));
600
611 const core::Tensor &volume,
612 const std::vector<double> contour_values = {0.0},
613 const core::Device &device = core::Device("CPU:0"));
614
615public:
617 TriangleMesh &Clear() override {
618 vertex_attr_.clear();
619 triangle_attr_.clear();
620 return *this;
621 }
622
624 bool IsEmpty() const override { return !HasVertexPositions(); }
625
627
629
631
651 TriangleMesh &Transform(const core::Tensor &transformation);
652
657 TriangleMesh &Translate(const core::Tensor &translation,
658 bool relative = true);
659
665 TriangleMesh &Scale(double scale, const core::Tensor &center);
666
673 TriangleMesh &Rotate(const core::Tensor &R, const core::Tensor &center);
674
677
680 TriangleMesh &ComputeTriangleNormals(bool normalized = true);
681
684 TriangleMesh &ComputeVertexNormals(bool normalized = true);
685
688 double GetSurfaceArea() const;
689
694
705 const core::Tensor &normal) const;
706
716 const core::Tensor &normal,
717 const std::vector<double> contour_values = {0.0}) const;
718
719 core::Device GetDevice() const override { return device_; }
720
730 const open3d::geometry::TriangleMesh &mesh_legacy,
731 core::Dtype float_dtype = core::Float32,
732 core::Dtype int_dtype = core::Int64,
733 const core::Device &device = core::Device("CPU:0"));
734
737
753 static std::unordered_map<std::string, geometry::TriangleMesh>
756 core::Dtype float_dtype = core::Float32,
757 core::Dtype int_dtype = core::Int64,
758 const core::Device &device = core::Device("CPU:0"));
759
774 TriangleMesh ComputeConvexHull(bool joggle_inputs = false) const;
775
789 TriangleMesh SimplifyQuadricDecimation(double target_reduction,
790 bool preserve_volume = true) const;
791
804 double tolerance = 1e-6) const;
805
817 double tolerance = 1e-6) const;
818
830 double tolerance = 1e-6) const;
831
834
837
846 TriangleMesh FillHoles(double hole_size = 1e6) const;
847
878 std::tuple<float, int, int> ComputeUVAtlas(size_t size = 512,
879 float gutter = 1.0f,
880 float max_stretch = 1.f / 6,
881 int parallel_partitions = 1,
882 int nthreads = 0);
883
909 std::unordered_map<std::string, core::Tensor> BakeVertexAttrTextures(
910 int size,
911 const std::unordered_set<std::string> &vertex_attr = {},
912 double margin = 2.,
913 double fill = 0.,
914 bool update_material = true);
915
940 std::unordered_map<std::string, core::Tensor> BakeTriangleAttrTextures(
941 int size,
942 const std::unordered_set<std::string> &triangle_attr = {},
943 double margin = 2.,
944 double fill = 0.,
945 bool update_material = true);
946
955 TriangleMesh ExtrudeRotation(double angle,
956 const core::Tensor &axis,
957 int resolution = 16,
958 double translation = 0.0,
959 bool capping = true) const;
960
967 double scale = 1.0,
968 bool capping = true) const;
969
975 int PCAPartition(int max_faces);
976
983
996 bool copy_attributes = true) const;
997
1001
1022 const std::vector<Image> &images,
1023 const std::vector<core::Tensor> &intrinsic_matrices,
1024 const std::vector<core::Tensor> &extrinsic_matrices,
1025 int tex_size = 1024,
1026 bool update_material = true);
1027
1034
1040 core::Tensor GetNonManifoldEdges(bool allow_boundary_edges = true) const;
1041
1051 PointCloud SamplePointsUniformly(size_t number_of_points,
1052 bool use_triangle_normal = false);
1053
1067
1082
1091 const TriangleMesh &mesh2,
1092 std::vector<Metric> metrics = {Metric::ChamferDistance},
1093 MetricParameters params = MetricParameters()) const;
1094
1095protected:
1099};
1100
1101} // namespace geometry
1102} // namespace t
1103} // namespace open3d
double t
Definition SurfaceReconstructionPoisson.cpp:172
Point< Real, 3 > point
Definition SurfaceReconstructionPoisson.cpp:163
bool copy
Definition VtkUtils.cpp:74
Definition Device.h:18
Definition Dtype.h:20
Definition Tensor.h:32
int64_t GetLength() const
Definition Tensor.h:1124
Tensor Min(const SizeVector &dims, bool keepdim=false) const
Definition Tensor.cpp:1236
Tensor Mean(const SizeVector &dims, bool keepdim=false) const
Definition Tensor.cpp:1215
Tensor Max(const SizeVector &dims, bool keepdim=false) const
Definition Tensor.cpp:1243
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition Image.h:34
A point cloud consists of point coordinates, and optionally point colors and point normals.
Definition PointCloud.h:36
Triangle mesh contains vertices and triangles represented by the indices to the vertices.
Definition TriangleMesh.h:35
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.
Definition BoundingVolume.h:46
Mix-in class for geometry types that can be visualized.
Definition DrawableGeometry.h:19
The base geometry class.
Definition Geometry.h:23
A LineSet contains points and lines joining them and optionally attributes on the points and lines.
Definition LineSet.h:84
A bounding box oriented along an arbitrary frame of reference.
Definition BoundingVolume.h:257
Definition TensorMap.h:31
std::size_t Erase(const std::string key)
Erase elements for the TensorMap by key value, if the key exists. If the key does not exists,...
Definition TensorMap.h:92
bool Contains(const std::string &key) const
Definition TensorMap.h:187
A triangle mesh contains vertices and triangles.
Definition TriangleMesh.h:96
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"))
Definition TriangleMeshFactory.cpp:246
TriangleMesh ExtrudeRotation(double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const
Definition TriangleMesh.cpp:1074
core::Tensor & GetVertexAttr(const std::string &key)
Definition TriangleMesh.h:140
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"))
Definition TriangleMeshFactory.cpp:190
TriangleMesh BooleanDifference(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition TriangleMesh.cpp:750
core::Tensor ComputeMetrics(const TriangleMesh &mesh2, std::vector< Metric > metrics={Metric::ChamferDistance}, MetricParameters params=MetricParameters()) const
Definition TriangleMesh.cpp:1874
void SetTriangleIndices(const core::Tensor &value)
Set the value of the "indices" attribute in triangle_attr_.
Definition TriangleMesh.h:289
TriangleMesh FillHoles(double hole_size=1e6) const
Definition TriangleMesh.cpp:764
core::Tensor GetMinBound() const
Definition TriangleMesh.h:626
void SetVertexPositions(const core::Tensor &value)
Definition TriangleMesh.h:259
void SetVertexAttr(const std::string &key, const core::Tensor &value)
Definition TriangleMesh.h:252
TriangleMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
Definition TriangleMesh.cpp:234
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"))
Definition TriangleMeshFactory.cpp:211
core::Tensor & GetTriangleNormals()
Definition TriangleMesh.h:176
core::Tensor & GetTriangleAttr(const std::string &key)
Definition TriangleMesh.h:166
void SetVertexColors(const core::Tensor &value)
Definition TriangleMesh.h:266
TensorMap triangle_attr_
Definition TriangleMesh.h:1098
void SetTriangleColors(const core::Tensor &value)
Definition TriangleMesh.h:303
TriangleMesh ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
Definition TriangleMesh.cpp:1084
virtual ~TriangleMesh() override
Definition TriangleMesh.h:114
double GetSurfaceArea() const
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces...
Definition TriangleMesh.cpp:354
bool HasTriangleIndices() const
Definition TriangleMesh.h:351
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)
Definition TriangleMesh.cpp:1450
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"))
Definition TriangleMeshFactory.cpp:22
bool HasVertexColors() const
Definition TriangleMesh.h:328
static std::unordered_map< std::string, geometry::TriangleMesh > FromTriangleMeshModel(const open3d::visualization::rendering::TriangleMeshModel &model, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition TriangleMesh.cpp:577
void SetTriangleAttr(const std::string &key, const core::Tensor &value)
Definition TriangleMesh.h:283
core::Device device_
Definition TriangleMesh.h:1096
TensorMap & GetVertexAttr()
Getter for vertex_attr_ TensorMap.
Definition TriangleMesh.h:134
TriangleMesh & Clear() override
Clear all data in the trianglemesh.
Definition TriangleMesh.h:617
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)
Definition TriangleMesh.cpp:778
OrientedBoundingBox GetOrientedBoundingBox() const
Create an oriented bounding box from vertex attribute "positions".
Definition TriangleMesh.cpp:760
void RemoveTriangleAttr(const std::string &key)
Definition TriangleMesh.h:225
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition TriangleMesh.cpp:270
bool HasTriangleNormals() const
Definition TriangleMesh.h:358
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
Definition TriangleMesh.cpp:610
bool HasVertexNormals() const
Definition TriangleMesh.h:335
static geometry::TriangleMesh FromLegacy(const open3d::geometry::TriangleMesh &mesh_legacy, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition TriangleMesh.cpp:372
void RemoveVertexAttr(const std::string &key)
Definition TriangleMesh.h:193
TriangleMesh To(const core::Device &device, bool copy=false) const
Definition TriangleMesh.cpp:596
open3d::geometry::TriangleMesh ToLegacy() const
Convert to a legacy Open3D TriangleMesh.
Definition TriangleMesh.cpp:460
TensorMap & GetTriangleAttr()
Getter for triangle_attr_ TensorMap.
Definition TriangleMesh.h:160
const core::Tensor & GetTriangleNormals() const
Definition TriangleMesh.h:237
TriangleMesh & NormalizeNormals()
Normalize both triangle normals and vertex normals to length 1.
Definition TriangleMesh.cpp:200
const TensorMap & GetTriangleAttr() const
Getter for triangle_attr_ TensorMap. Used in Pybind.
Definition TriangleMesh.h:157
TriangleMesh Clone() const
Returns copy of the triangle mesh on the same device.
Definition TriangleMesh.h:128
core::Device GetDevice() const override
Returns the device of the geometry.
Definition TriangleMesh.h:719
core::Tensor GetMaxBound() const
Definition TriangleMesh.h:628
TriangleMesh & Rotate(const core::Tensor &R, const core::Tensor &center)
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
Definition TriangleMesh.cpp:185
PointCloud SamplePointsUniformly(size_t number_of_points, bool use_triangle_normal=false)
Definition TriangleMesh.cpp:1801
core::Tensor & GetVertexColors()
Definition TriangleMesh.h:150
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....
Definition TriangleMesh.cpp:615
core::Tensor GetNonManifoldEdges(bool allow_boundary_edges=true) const
Definition TriangleMesh.cpp:1761
static TriangleMesh CreateIsosurfaces(const core::Tensor &volume, const std::vector< double > contour_values={0.0}, const core::Device &device=core::Device("CPU:0"))
Definition TriangleMeshFactory.cpp:289
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"))
Definition TriangleMeshFactory.cpp:172
TriangleMesh SelectFacesByMask(const core::Tensor &mask) const
Definition TriangleMesh.cpp:1155
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"))
Definition TriangleMeshFactory.cpp:112
core::Tensor & GetTriangleIndices()
Definition TriangleMesh.h:172
const core::Tensor & GetTriangleIndices() const
Definition TriangleMesh.h:231
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from vertex attribute "positions".
Definition TriangleMesh.cpp:756
TriangleMesh BooleanIntersection(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition TriangleMesh.cpp:743
TriangleMesh RemoveUnreferencedVertices()
Definition TriangleMesh.cpp:1333
int PCAPartition(int max_faces)
Definition TriangleMesh.cpp:1091
const core::Tensor & GetVertexColors() const
Definition TriangleMesh.h:203
TriangleMesh & Scale(double scale, const core::Tensor &center)
Scales the VertexPositions of the TriangleMesh.
Definition TriangleMesh.cpp:174
void SetTriangleNormals(const core::Tensor &value)
Definition TriangleMesh.h:296
core::Tensor & GetVertexPositions()
Definition TriangleMesh.h:146
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)
Definition TriangleMesh.cpp:1020
bool HasTriangleColors() const
Definition TriangleMesh.h:365
const core::Tensor & GetTriangleColors() const
Definition TriangleMesh.h:243
TriangleMesh SelectByIndex(const core::Tensor &indices, bool copy_attributes=true) const
Definition TriangleMesh.cpp:1226
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 specifi...
Definition TriangleMesh.cpp:646
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"))
Definition TriangleMeshFactory.cpp:225
const core::Tensor & GetVertexPositions() const
Definition TriangleMesh.h:197
bool HasTriangleAttr(const std::string &key) const
Definition TriangleMesh.h:341
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"))
Definition TriangleMeshFactory.cpp:125
bool HasVertexAttr(const std::string &key) const
Definition TriangleMesh.h:312
const core::Tensor & GetVertexAttr(const std::string &key) const
Definition TriangleMesh.h:185
TriangleMesh & Transform(const core::Tensor &transformation)
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
Definition TriangleMesh.cpp:145
const TensorMap & GetVertexAttr() const
Getter for vertex_attr_ TensorMap. Used in Pybind.
Definition TriangleMesh.h:131
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"))
Definition TriangleMeshFactory.cpp:86
void SetVertexNormals(const core::Tensor &value)
Definition TriangleMesh.h:273
const core::Tensor & GetTriangleAttr(const std::string &key) const
Definition TriangleMesh.h:217
core::Tensor GetCenter() const
Definition TriangleMesh.h:630
TensorMap vertex_attr_
Definition TriangleMesh.h:1097
core::Tensor & GetTriangleColors()
Definition TriangleMesh.h:180
std::string ToString() const
Text description.
Definition TriangleMesh.cpp:89
core::Tensor & GetVertexNormals()
Definition TriangleMesh.h:154
TriangleMesh RemoveNonManifoldEdges()
Definition TriangleMesh.cpp:1677
const core::Tensor & GetVertexNormals() const
Definition TriangleMesh.h:209
bool HasVertexPositions() const
Definition TriangleMesh.h:321
TriangleMesh BooleanUnion(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition TriangleMesh.cpp:737
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"))
Definition TriangleMeshFactory.cpp:99
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"))
Definition TriangleMeshFactory.cpp:138
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)
Definition TriangleMesh.cpp:954
TriangleMesh & Translate(const core::Tensor &translation, bool relative=true)
Translates the VertexPositions of the TriangleMesh.
Definition TriangleMesh.cpp:160
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"))
Definition TriangleMeshFactory.cpp:155
TriangleMesh & ComputeTriangleAreas()
Function to compute triangle areas and save it as a triangle attribute "areas". Prints a warning,...
Definition TriangleMesh.cpp:328
TriangleMesh SimplifyQuadricDecimation(double target_reduction, bool preserve_volume=true) const
Definition TriangleMesh.cpp:684
bool IsEmpty() const override
Returns !HasVertexPositions(), triangles are ignored.
Definition TriangleMesh.h:624
int width
Definition FilePCD.cpp:52
int size
Definition FilePCD.cpp:40
int height
Definition FilePCD.cpp:53
const Dtype Int64
Definition Dtype.cpp:47
const Dtype Float32
Definition Dtype.cpp:42
@ ChamferDistance
Chamfer Distance.
constexpr nullopt_t nullopt
Definition Optional.h:152
Definition PinholeCameraIntrinsic.cpp:16