Open3D (C++ API)  0.18.0
TriangleMesh.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <list>
11 
12 #include "open3d/core/Tensor.h"
19 
20 namespace open3d {
21 namespace t {
22 namespace geometry {
23 
24 class LineSet;
25 
92 class TriangleMesh : public Geometry, public DrawableGeometry {
93 public:
97  TriangleMesh(const core::Device &device = core::Device("CPU:0"));
98 
107  TriangleMesh(const core::Tensor &vertex_positions,
108  const core::Tensor &triangle_indices);
109 
110  virtual ~TriangleMesh() override {}
111 
112 public:
114  std::string ToString() const;
115 
121  TriangleMesh To(const core::Device &device, bool copy = false) const;
122 
124  TriangleMesh Clone() const { return To(GetDevice(), /*copy=*/true); }
125 
127  const TensorMap &GetVertexAttr() const { return vertex_attr_; }
128 
131 
136  core::Tensor &GetVertexAttr(const std::string &key) {
137  return vertex_attr_.at(key);
138  }
139 
142  core::Tensor &GetVertexPositions() { return GetVertexAttr("positions"); }
143 
146  core::Tensor &GetVertexColors() { return GetVertexAttr("colors"); }
147 
150  core::Tensor &GetVertexNormals() { return GetVertexAttr("normals"); }
151 
153  const TensorMap &GetTriangleAttr() const { return triangle_attr_; }
154 
157 
162  core::Tensor &GetTriangleAttr(const std::string &key) {
163  return triangle_attr_.at(key);
164  }
165 
169 
173 
177 
181  const core::Tensor &GetVertexAttr(const std::string &key) const {
182  return vertex_attr_.at(key);
183  }
184 
189  void RemoveVertexAttr(const std::string &key) { vertex_attr_.Erase(key); }
190 
194  return GetVertexAttr("positions");
195  }
196 
199  const core::Tensor &GetVertexColors() const {
200  return GetVertexAttr("colors");
201  }
202 
206  return GetVertexAttr("normals");
207  }
208 
213  const core::Tensor &GetTriangleAttr(const std::string &key) const {
214  return triangle_attr_.at(key);
215  }
216 
221  void RemoveTriangleAttr(const std::string &key) {
222  triangle_attr_.Erase(key);
223  }
224 
228  return GetTriangleAttr("indices");
229  }
230 
234  return GetTriangleAttr("normals");
235  }
236 
240  return GetTriangleAttr("colors");
241  }
242 
248  void SetVertexAttr(const std::string &key, const core::Tensor &value) {
250  vertex_attr_[key] = value;
251  }
252 
255  void SetVertexPositions(const core::Tensor &value) {
257  SetVertexAttr("positions", value);
258  }
259 
262  void SetVertexColors(const core::Tensor &value) {
264  SetVertexAttr("colors", value);
265  }
266 
269  void SetVertexNormals(const core::Tensor &value) {
271  SetVertexAttr("normals", value);
272  }
273 
279  void SetTriangleAttr(const std::string &key, const core::Tensor &value) {
281  triangle_attr_[key] = value;
282  }
283 
285  void SetTriangleIndices(const core::Tensor &value) {
287  SetTriangleAttr("indices", value);
288  }
289 
292  void SetTriangleNormals(const core::Tensor &value) {
294  SetTriangleAttr("normals", value);
295  }
296 
299  void SetTriangleColors(const core::Tensor &value) {
301  SetTriangleAttr("colors", value);
302  }
303 
308  bool HasVertexAttr(const std::string &key) const {
309  return vertex_attr_.Contains(key) &&
310  GetVertexAttr(key).GetLength() > 0 &&
311  GetVertexAttr(key).GetLength() ==
313  }
314 
317  bool HasVertexPositions() const { return HasVertexAttr("positions"); }
318 
324  bool HasVertexColors() const { return HasVertexAttr("colors"); }
325 
331  bool HasVertexNormals() const { return HasVertexAttr("normals"); }
332 
337  bool HasTriangleAttr(const std::string &key) const {
338  return triangle_attr_.Contains(key) &&
339  GetTriangleAttr(key).GetLength() > 0 &&
340  GetTriangleAttr(key).GetLength() ==
342  }
343 
347  bool HasTriangleIndices() const { return HasTriangleAttr("indices"); }
348 
354  bool HasTriangleNormals() const { return HasTriangleAttr("normals"); }
355 
361  bool HasTriangleColors() const { return HasTriangleAttr("colors"); }
362 
373  static TriangleMesh CreateBox(
374  double width = 1.0,
375  double height = 1.0,
376  double depth = 1.0,
377  core::Dtype float_dtype = core::Float32,
378  core::Dtype int_dtype = core::Int64,
379  const core::Device &device = core::Device("CPU:0"));
380 
394  static TriangleMesh CreateSphere(
395  double radius = 1.0,
396  int resolution = 20,
397  core::Dtype float_dtype = core::Float32,
398  core::Dtype int_dtype = core::Int64,
399  const core::Device &device = core::Device("CPU:0"));
400 
411  double radius = 1.0,
412  core::Dtype float_dtype = core::Float32,
413  core::Dtype int_dtype = core::Int64,
414  const core::Device &device = core::Device("CPU:0"));
415 
426  double radius = 1.0,
427  core::Dtype float_dtype = core::Float32,
428  core::Dtype int_dtype = core::Int64,
429  const core::Device &device = core::Device("CPU:0"));
430 
441  double radius = 1.0,
442  core::Dtype float_dtype = core::Float32,
443  core::Dtype int_dtype = core::Int64,
444  const core::Device &device = core::Device("CPU:0"));
445 
459  double radius = 1.0,
460  double height = 2.0,
461  int resolution = 20,
462  int split = 4,
463  core::Dtype float_dtype = core::Float32,
464  core::Dtype int_dtype = core::Int64,
465  const core::Device &device = core::Device("CPU:0"));
466 
479  static TriangleMesh CreateCone(
480  double radius = 1.0,
481  double height = 2.0,
482  int resolution = 20,
483  int split = 1,
484  core::Dtype float_dtype = core::Float32,
485  core::Dtype int_dtype = core::Int64,
486  const core::Device &device = core::Device("CPU:0"));
487 
501  static TriangleMesh CreateTorus(
502  double torus_radius = 1.0,
503  double tube_radius = 0.5,
504  int radial_resolution = 30,
505  int tubular_resolution = 20,
506  core::Dtype float_dtype = core::Float32,
507  core::Dtype int_dtype = core::Int64,
508  const core::Device &device = core::Device("CPU:0"));
509 
527  static TriangleMesh CreateArrow(
528  double cylinder_radius = 1.0,
529  double cone_radius = 1.5,
530  double cylinder_height = 5.0,
531  double cone_height = 4.0,
532  int resolution = 20,
533  int cylinder_split = 4,
534  int cone_split = 1,
535  core::Dtype float_dtype = core::Float32,
536  core::Dtype int_dtype = core::Int64,
537  const core::Device &device = core::Device("CPU:0"));
538 
548  double size = 1.0,
549  const Eigen::Vector3d &origin = Eigen::Vector3d(0.0, 0.0, 0.0),
550  core::Dtype float_dtype = core::Float32,
551  core::Dtype int_dtype = core::Int64,
552  const core::Device &device = core::Device("CPU:0"));
553 
569  static TriangleMesh CreateMobius(
570  int length_split = 70,
571  int width_split = 15,
572  int twists = 1,
573  double radius = 1,
574  double flatness = 1,
575  double width = 1,
576  double scale = 1,
577  core::Dtype float_dtype = core::Float32,
578  core::Dtype int_dtype = core::Int64,
579  const core::Device &device = core::Device("CPU:0"));
580 
590  static TriangleMesh CreateText(
591  const std::string &text,
592  double depth = 0.0,
593  core::Dtype float_dtype = core::Float32,
594  core::Dtype int_dtype = core::Int64,
595  const core::Device &device = core::Device("CPU:0"));
596 
597 public:
599  TriangleMesh &Clear() override {
600  vertex_attr_.clear();
601  triangle_attr_.clear();
602  return *this;
603  }
604 
606  bool IsEmpty() const override { return !HasVertexPositions(); }
607 
608  core::Tensor GetMinBound() const { return GetVertexPositions().Min({0}); }
609 
610  core::Tensor GetMaxBound() const { return GetVertexPositions().Max({0}); }
611 
612  core::Tensor GetCenter() const { return GetVertexPositions().Mean({0}); }
613 
633  TriangleMesh &Transform(const core::Tensor &transformation);
634 
639  TriangleMesh &Translate(const core::Tensor &translation,
640  bool relative = true);
641 
647  TriangleMesh &Scale(double scale, const core::Tensor &center);
648 
655  TriangleMesh &Rotate(const core::Tensor &R, const core::Tensor &center);
656 
659 
662  TriangleMesh &ComputeTriangleNormals(bool normalized = true);
663 
666  TriangleMesh &ComputeVertexNormals(bool normalized = true);
667 
670  double GetSurfaceArea() const;
671 
681  TriangleMesh ClipPlane(const core::Tensor &point,
682  const core::Tensor &normal) const;
683 
692  LineSet SlicePlane(const core::Tensor &point,
693  const core::Tensor &normal,
694  const std::vector<double> contour_values = {0.0}) const;
695 
696  core::Device GetDevice() const override { return device_; }
697 
706  const open3d::geometry::TriangleMesh &mesh_legacy,
707  core::Dtype float_dtype = core::Float32,
708  core::Dtype int_dtype = core::Int64,
709  const core::Device &device = core::Device("CPU:0"));
710 
713 
728  TriangleMesh ComputeConvexHull(bool joggle_inputs = false) const;
729 
743  TriangleMesh SimplifyQuadricDecimation(double target_reduction,
744  bool preserve_volume = true) const;
745 
758  double tolerance = 1e-6) const;
759 
771  double tolerance = 1e-6) const;
772 
784  double tolerance = 1e-6) const;
785 
788 
791 
800  TriangleMesh FillHoles(double hole_size = 1e6) const;
801 
832  std::tuple<float, int, int> ComputeUVAtlas(size_t size = 512,
833  float gutter = 1.0f,
834  float max_stretch = 1.f / 6,
835  int parallel_partitions = 1,
836  int nthreads = 0);
837 
863  std::unordered_map<std::string, core::Tensor> BakeVertexAttrTextures(
864  int size,
865  const std::unordered_set<std::string> &vertex_attr = {},
866  double margin = 2.,
867  double fill = 0.,
868  bool update_material = true);
869 
894  std::unordered_map<std::string, core::Tensor> BakeTriangleAttrTextures(
895  int size,
896  const std::unordered_set<std::string> &triangle_attr = {},
897  double margin = 2.,
898  double fill = 0.,
899  bool update_material = true);
900 
909  TriangleMesh ExtrudeRotation(double angle,
910  const core::Tensor &axis,
911  int resolution = 16,
912  double translation = 0.0,
913  bool capping = true) const;
914 
921  double scale = 1.0,
922  bool capping = true) const;
923 
929  int PCAPartition(int max_faces);
930 
936  TriangleMesh SelectFacesByMask(const core::Tensor &mask) const;
937 
946  TriangleMesh SelectByIndex(const core::Tensor &indices) const;
947 
948 protected:
952 };
953 
954 } // namespace geometry
955 } // namespace t
956 } // namespace open3d
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:43
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:58
bool copy
Definition: VtkUtils.cpp:73
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
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:21
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:92
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:245
TriangleMesh ExtrudeRotation(double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const
Definition: TriangleMesh.cpp:998
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:189
TriangleMesh BooleanDifference(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:678
void SetTriangleIndices(const core::Tensor &value)
Set the value of the "indices" attribute in triangle_attr_.
Definition: TriangleMesh.h:285
TriangleMesh FillHoles(double hole_size=1e6) const
Definition: TriangleMesh.cpp:692
const TensorMap & GetVertexAttr() const
Getter for vertex_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:127
core::Tensor & GetTriangleNormals()
Definition: TriangleMesh.h:172
core::Tensor GetMinBound() const
Definition: TriangleMesh.h:608
core::Tensor & GetVertexPositions()
Definition: TriangleMesh.h:142
void SetVertexPositions(const core::Tensor &value)
Definition: TriangleMesh.h:255
void SetVertexAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:248
TriangleMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
Definition: TriangleMesh.cpp:211
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:210
const core::Tensor & GetTriangleNormals() const
Definition: TriangleMesh.h:233
TensorMap & GetVertexAttr()
Getter for vertex_attr_ TensorMap.
Definition: TriangleMesh.h:130
void SetVertexColors(const core::Tensor &value)
Definition: TriangleMesh.h:262
TensorMap triangle_attr_
Definition: TriangleMesh.h:951
void SetTriangleColors(const core::Tensor &value)
Definition: TriangleMesh.h:299
TriangleMesh ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
Definition: TriangleMesh.cpp:1008
virtual ~TriangleMesh() override
Definition: TriangleMesh.h:110
double GetSurfaceArea() const
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces...
Definition: TriangleMesh.cpp:286
bool HasTriangleIndices() const
Definition: TriangleMesh.h:347
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:21
bool HasVertexColors() const
Definition: TriangleMesh.h:324
TriangleMesh SelectByIndex(const core::Tensor &indices) const
Definition: TriangleMesh.cpp:1150
void SetTriangleAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:279
core::Device device_
Definition: TriangleMesh.h:949
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:706
TriangleMesh & Clear() override
Clear all data in the trianglemesh.
Definition: TriangleMesh.h:599
OrientedBoundingBox GetOrientedBoundingBox() const
Create an oriented bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:688
void RemoveTriangleAttr(const std::string &key)
Definition: TriangleMesh.h:221
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMesh.cpp:247
bool HasTriangleNormals() const
Definition: TriangleMesh.h:354
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
Definition: TriangleMesh.cpp:538
bool HasVertexNormals() const
Definition: TriangleMesh.h:331
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:319
void RemoveVertexAttr(const std::string &key)
Definition: TriangleMesh.h:189
TriangleMesh To(const core::Device &device, bool copy=false) const
Definition: TriangleMesh.cpp:524
open3d::geometry::TriangleMesh ToLegacy() const
Convert to a legacy Open3D TriangleMesh.
Definition: TriangleMesh.cpp:404
TriangleMesh & NormalizeNormals()
Normalize both triangle normals and vertex normals to length 1.
Definition: TriangleMesh.cpp:177
TriangleMesh Clone() const
Returns copy of the triangle mesh on the same device.
Definition: TriangleMesh.h:124
core::Device GetDevice() const override
Returns the device of the geometry.
Definition: TriangleMesh.h:696
core::Tensor GetMaxBound() const
Definition: TriangleMesh.h:610
TriangleMesh & Rotate(const core::Tensor &R, const core::Tensor &center)
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
Definition: TriangleMesh.cpp:162
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:543
const core::Tensor & GetTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:213
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:171
TriangleMesh SelectFacesByMask(const core::Tensor &mask) const
Definition: TriangleMesh.cpp:1079
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:111
core::Tensor & GetTriangleAttr(const std::string &key)
Definition: TriangleMesh.h:162
const core::Tensor & GetTriangleColors() const
Definition: TriangleMesh.h:239
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:684
TriangleMesh BooleanIntersection(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:671
TriangleMesh(const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMesh.cpp:44
int PCAPartition(int max_faces)
Definition: TriangleMesh.cpp:1015
TriangleMesh & Scale(double scale, const core::Tensor &center)
Scales the VertexPositions of the TriangleMesh.
Definition: TriangleMesh.cpp:151
void SetTriangleNormals(const core::Tensor &value)
Definition: TriangleMesh.h:292
core::Tensor & GetVertexColors()
Definition: TriangleMesh.h:146
const core::Tensor & GetVertexPositions() const
Definition: TriangleMesh.h:193
core::Tensor & GetTriangleIndices()
Definition: TriangleMesh.h:168
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:944
bool HasTriangleColors() const
Definition: TriangleMesh.h:361
const core::Tensor & GetVertexNormals() const
Definition: TriangleMesh.h:205
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:574
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:224
const core::Tensor & GetVertexAttr(const std::string &key) const
Definition: TriangleMesh.h:181
const core::Tensor & GetTriangleIndices() const
Definition: TriangleMesh.h:227
bool HasTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:337
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:124
bool HasVertexAttr(const std::string &key) const
Definition: TriangleMesh.h:308
TriangleMesh & Transform(const core::Tensor &transformation)
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
Definition: TriangleMesh.cpp:122
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:85
void SetVertexNormals(const core::Tensor &value)
Definition: TriangleMesh.h:269
const core::Tensor & GetVertexColors() const
Definition: TriangleMesh.h:199
core::Tensor GetCenter() const
Definition: TriangleMesh.h:612
TensorMap vertex_attr_
Definition: TriangleMesh.h:950
std::string ToString() const
Text description.
Definition: TriangleMesh.cpp:66
const TensorMap & GetTriangleAttr() const
Getter for triangle_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:153
bool HasVertexPositions() const
Definition: TriangleMesh.h:317
TriangleMesh BooleanUnion(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:665
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:98
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:137
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:878
core::Tensor & GetTriangleColors()
Definition: TriangleMesh.h:176
TensorMap & GetTriangleAttr()
Getter for triangle_attr_ TensorMap.
Definition: TriangleMesh.h:156
core::Tensor & GetVertexAttr(const std::string &key)
Definition: TriangleMesh.h:136
TriangleMesh & Translate(const core::Tensor &translation, bool relative=true)
Translates the VertexPositions of the TriangleMesh.
Definition: TriangleMesh.cpp:137
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:154
TriangleMesh SimplifyQuadricDecimation(double target_reduction, bool preserve_volume=true) const
Definition: TriangleMesh.cpp:612
core::Tensor & GetVertexNormals()
Definition: TriangleMesh.h:150
bool IsEmpty() const override
Returns !HasVertexPositions(), triangles are ignored.
Definition: TriangleMesh.h:606
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
constexpr nullopt_t nullopt
Definition: Optional.h:152
Definition: PinholeCameraIntrinsic.cpp:16