Open3D (C++ API)  0.18.0+f02e7d2
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 #include <unordered_map>
12 
13 #include "open3d/core/Tensor.h"
21 
22 namespace open3d {
23 namespace t {
24 namespace geometry {
25 
26 class LineSet;
27 
94 class TriangleMesh : public Geometry, public DrawableGeometry {
95 public:
99  TriangleMesh(const core::Device &device = core::Device("CPU:0"));
100 
109  TriangleMesh(const core::Tensor &vertex_positions,
110  const core::Tensor &triangle_indices);
111 
112  virtual ~TriangleMesh() override {}
113 
114 public:
116  std::string ToString() const;
117 
123  TriangleMesh To(const core::Device &device, bool copy = false) const;
124 
126  TriangleMesh Clone() const { return To(GetDevice(), /*copy=*/true); }
127 
129  const TensorMap &GetVertexAttr() const { return vertex_attr_; }
130 
133 
138  core::Tensor &GetVertexAttr(const std::string &key) {
139  return vertex_attr_.at(key);
140  }
141 
144  core::Tensor &GetVertexPositions() { return GetVertexAttr("positions"); }
145 
148  core::Tensor &GetVertexColors() { return GetVertexAttr("colors"); }
149 
152  core::Tensor &GetVertexNormals() { return GetVertexAttr("normals"); }
153 
155  const TensorMap &GetTriangleAttr() const { return triangle_attr_; }
156 
159 
164  core::Tensor &GetTriangleAttr(const std::string &key) {
165  return triangle_attr_.at(key);
166  }
167 
171 
175 
179 
183  const core::Tensor &GetVertexAttr(const std::string &key) const {
184  return vertex_attr_.at(key);
185  }
186 
191  void RemoveVertexAttr(const std::string &key) { vertex_attr_.Erase(key); }
192 
196  return GetVertexAttr("positions");
197  }
198 
201  const core::Tensor &GetVertexColors() const {
202  return GetVertexAttr("colors");
203  }
204 
208  return GetVertexAttr("normals");
209  }
210 
215  const core::Tensor &GetTriangleAttr(const std::string &key) const {
216  return triangle_attr_.at(key);
217  }
218 
223  void RemoveTriangleAttr(const std::string &key) {
224  triangle_attr_.Erase(key);
225  }
226 
230  return GetTriangleAttr("indices");
231  }
232 
236  return GetTriangleAttr("normals");
237  }
238 
242  return GetTriangleAttr("colors");
243  }
244 
250  void SetVertexAttr(const std::string &key, const core::Tensor &value) {
252  vertex_attr_[key] = value;
253  }
254 
257  void SetVertexPositions(const core::Tensor &value) {
259  SetVertexAttr("positions", value);
260  }
261 
264  void SetVertexColors(const core::Tensor &value) {
266  SetVertexAttr("colors", value);
267  }
268 
271  void SetVertexNormals(const core::Tensor &value) {
273  SetVertexAttr("normals", value);
274  }
275 
281  void SetTriangleAttr(const std::string &key, const core::Tensor &value) {
283  triangle_attr_[key] = value;
284  }
285 
287  void SetTriangleIndices(const core::Tensor &value) {
289  SetTriangleAttr("indices", value);
290  }
291 
294  void SetTriangleNormals(const core::Tensor &value) {
296  SetTriangleAttr("normals", value);
297  }
298 
301  void SetTriangleColors(const core::Tensor &value) {
303  SetTriangleAttr("colors", value);
304  }
305 
310  bool HasVertexAttr(const std::string &key) const {
311  return vertex_attr_.Contains(key) &&
312  GetVertexAttr(key).GetLength() > 0 &&
313  GetVertexAttr(key).GetLength() ==
315  }
316 
319  bool HasVertexPositions() const { return HasVertexAttr("positions"); }
320 
326  bool HasVertexColors() const { return HasVertexAttr("colors"); }
327 
333  bool HasVertexNormals() const { return HasVertexAttr("normals"); }
334 
339  bool HasTriangleAttr(const std::string &key) const {
340  return triangle_attr_.Contains(key) &&
341  GetTriangleAttr(key).GetLength() > 0 &&
342  GetTriangleAttr(key).GetLength() ==
344  }
345 
349  bool HasTriangleIndices() const { return HasTriangleAttr("indices"); }
350 
356  bool HasTriangleNormals() const { return HasTriangleAttr("normals"); }
357 
363  bool HasTriangleColors() const { return HasTriangleAttr("colors"); }
364 
375  static TriangleMesh CreateBox(
376  double width = 1.0,
377  double height = 1.0,
378  double depth = 1.0,
379  core::Dtype float_dtype = core::Float32,
380  core::Dtype int_dtype = core::Int64,
381  const core::Device &device = core::Device("CPU:0"));
382 
396  static TriangleMesh CreateSphere(
397  double radius = 1.0,
398  int resolution = 20,
399  core::Dtype float_dtype = core::Float32,
400  core::Dtype int_dtype = core::Int64,
401  const core::Device &device = core::Device("CPU:0"));
402 
413  double radius = 1.0,
414  core::Dtype float_dtype = core::Float32,
415  core::Dtype int_dtype = core::Int64,
416  const core::Device &device = core::Device("CPU:0"));
417 
428  double radius = 1.0,
429  core::Dtype float_dtype = core::Float32,
430  core::Dtype int_dtype = core::Int64,
431  const core::Device &device = core::Device("CPU:0"));
432 
443  double radius = 1.0,
444  core::Dtype float_dtype = core::Float32,
445  core::Dtype int_dtype = core::Int64,
446  const core::Device &device = core::Device("CPU:0"));
447 
461  double radius = 1.0,
462  double height = 2.0,
463  int resolution = 20,
464  int split = 4,
465  core::Dtype float_dtype = core::Float32,
466  core::Dtype int_dtype = core::Int64,
467  const core::Device &device = core::Device("CPU:0"));
468 
481  static TriangleMesh CreateCone(
482  double radius = 1.0,
483  double height = 2.0,
484  int resolution = 20,
485  int split = 1,
486  core::Dtype float_dtype = core::Float32,
487  core::Dtype int_dtype = core::Int64,
488  const core::Device &device = core::Device("CPU:0"));
489 
503  static TriangleMesh CreateTorus(
504  double torus_radius = 1.0,
505  double tube_radius = 0.5,
506  int radial_resolution = 30,
507  int tubular_resolution = 20,
508  core::Dtype float_dtype = core::Float32,
509  core::Dtype int_dtype = core::Int64,
510  const core::Device &device = core::Device("CPU:0"));
511 
529  static TriangleMesh CreateArrow(
530  double cylinder_radius = 1.0,
531  double cone_radius = 1.5,
532  double cylinder_height = 5.0,
533  double cone_height = 4.0,
534  int resolution = 20,
535  int cylinder_split = 4,
536  int cone_split = 1,
537  core::Dtype float_dtype = core::Float32,
538  core::Dtype int_dtype = core::Int64,
539  const core::Device &device = core::Device("CPU:0"));
540 
550  double size = 1.0,
551  const Eigen::Vector3d &origin = Eigen::Vector3d(0.0, 0.0, 0.0),
552  core::Dtype float_dtype = core::Float32,
553  core::Dtype int_dtype = core::Int64,
554  const core::Device &device = core::Device("CPU:0"));
555 
571  static TriangleMesh CreateMobius(
572  int length_split = 70,
573  int width_split = 15,
574  int twists = 1,
575  double radius = 1,
576  double flatness = 1,
577  double width = 1,
578  double scale = 1,
579  core::Dtype float_dtype = core::Float32,
580  core::Dtype int_dtype = core::Int64,
581  const core::Device &device = core::Device("CPU:0"));
582 
592  static TriangleMesh CreateText(
593  const std::string &text,
594  double depth = 0.0,
595  core::Dtype float_dtype = core::Float32,
596  core::Dtype int_dtype = core::Int64,
597  const core::Device &device = core::Device("CPU:0"));
598 
609  const core::Tensor &volume,
610  const std::vector<double> contour_values = {0.0},
611  const core::Device &device = core::Device("CPU:0"));
612 
613 public:
615  TriangleMesh &Clear() override {
616  vertex_attr_.clear();
617  triangle_attr_.clear();
618  return *this;
619  }
620 
622  bool IsEmpty() const override { return !HasVertexPositions(); }
623 
624  core::Tensor GetMinBound() const { return GetVertexPositions().Min({0}); }
625 
626  core::Tensor GetMaxBound() const { return GetVertexPositions().Max({0}); }
627 
628  core::Tensor GetCenter() const { return GetVertexPositions().Mean({0}); }
629 
649  TriangleMesh &Transform(const core::Tensor &transformation);
650 
655  TriangleMesh &Translate(const core::Tensor &translation,
656  bool relative = true);
657 
663  TriangleMesh &Scale(double scale, const core::Tensor &center);
664 
671  TriangleMesh &Rotate(const core::Tensor &R, const core::Tensor &center);
672 
675 
678  TriangleMesh &ComputeTriangleNormals(bool normalized = true);
679 
682  TriangleMesh &ComputeVertexNormals(bool normalized = true);
683 
686  double GetSurfaceArea() const;
687 
692 
702  TriangleMesh ClipPlane(const core::Tensor &point,
703  const core::Tensor &normal) const;
704 
713  LineSet SlicePlane(const core::Tensor &point,
714  const core::Tensor &normal,
715  const std::vector<double> contour_values = {0.0}) const;
716 
717  core::Device GetDevice() const override { return device_; }
718 
728  const open3d::geometry::TriangleMesh &mesh_legacy,
729  core::Dtype float_dtype = core::Float32,
730  core::Dtype int_dtype = core::Int64,
731  const core::Device &device = core::Device("CPU:0"));
732 
735 
751  static std::unordered_map<std::string, geometry::TriangleMesh>
754  core::Dtype float_dtype = core::Float32,
755  core::Dtype int_dtype = core::Int64,
756  const core::Device &device = core::Device("CPU:0"));
757 
772  TriangleMesh ComputeConvexHull(bool joggle_inputs = false) const;
773 
787  TriangleMesh SimplifyQuadricDecimation(double target_reduction,
788  bool preserve_volume = true) const;
789 
802  double tolerance = 1e-6) const;
803 
815  double tolerance = 1e-6) const;
816 
828  double tolerance = 1e-6) const;
829 
832 
835 
844  TriangleMesh FillHoles(double hole_size = 1e6) const;
845 
876  std::tuple<float, int, int> ComputeUVAtlas(size_t size = 512,
877  float gutter = 1.0f,
878  float max_stretch = 1.f / 6,
879  int parallel_partitions = 1,
880  int nthreads = 0);
881 
907  std::unordered_map<std::string, core::Tensor> BakeVertexAttrTextures(
908  int size,
909  const std::unordered_set<std::string> &vertex_attr = {},
910  double margin = 2.,
911  double fill = 0.,
912  bool update_material = true);
913 
938  std::unordered_map<std::string, core::Tensor> BakeTriangleAttrTextures(
939  int size,
940  const std::unordered_set<std::string> &triangle_attr = {},
941  double margin = 2.,
942  double fill = 0.,
943  bool update_material = true);
944 
953  TriangleMesh ExtrudeRotation(double angle,
954  const core::Tensor &axis,
955  int resolution = 16,
956  double translation = 0.0,
957  bool capping = true) const;
958 
965  double scale = 1.0,
966  bool capping = true) const;
967 
973  int PCAPartition(int max_faces);
974 
980  TriangleMesh SelectFacesByMask(const core::Tensor &mask) const;
981 
990  TriangleMesh SelectByIndex(const core::Tensor &indices) const;
991 
995 
1002 
1008  core::Tensor GetNonManifoldEdges(bool allow_boundary_edges = true) const;
1009 
1010 protected:
1014 };
1015 
1016 } // namespace geometry
1017 } // namespace t
1018 } // namespace open3d
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:43
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:58
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
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:94
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:1041
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:721
void SetTriangleIndices(const core::Tensor &value)
Set the value of the "indices" attribute in triangle_attr_.
Definition: TriangleMesh.h:287
TriangleMesh FillHoles(double hole_size=1e6) const
Definition: TriangleMesh.cpp:735
const TensorMap & GetVertexAttr() const
Getter for vertex_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:129
core::Tensor & GetTriangleNormals()
Definition: TriangleMesh.h:174
core::Tensor GetMinBound() const
Definition: TriangleMesh.h:624
core::Tensor & GetVertexPositions()
Definition: TriangleMesh.h:144
void SetVertexPositions(const core::Tensor &value)
Definition: TriangleMesh.h:257
void SetVertexAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:250
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:211
const core::Tensor & GetTriangleNormals() const
Definition: TriangleMesh.h:235
TensorMap & GetVertexAttr()
Getter for vertex_attr_ TensorMap.
Definition: TriangleMesh.h:132
void SetVertexColors(const core::Tensor &value)
Definition: TriangleMesh.h:264
TensorMap triangle_attr_
Definition: TriangleMesh.h:1013
void SetTriangleColors(const core::Tensor &value)
Definition: TriangleMesh.h:301
TriangleMesh ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
Definition: TriangleMesh.cpp:1051
virtual ~TriangleMesh() override
Definition: TriangleMesh.h:112
double GetSurfaceArea() const
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces...
Definition: TriangleMesh.cpp:325
bool HasTriangleIndices() const
Definition: TriangleMesh.h:349
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:326
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:548
TriangleMesh SelectByIndex(const core::Tensor &indices) const
Definition: TriangleMesh.cpp:1193
void SetTriangleAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:281
core::Device device_
Definition: TriangleMesh.h:1011
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:749
TriangleMesh & Clear() override
Clear all data in the trianglemesh.
Definition: TriangleMesh.h:615
OrientedBoundingBox GetOrientedBoundingBox() const
Create an oriented bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:731
void RemoveTriangleAttr(const std::string &key)
Definition: TriangleMesh.h:223
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMesh.cpp:247
bool HasTriangleNormals() const
Definition: TriangleMesh.h:356
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
Definition: TriangleMesh.cpp:581
bool HasVertexNormals() const
Definition: TriangleMesh.h:333
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:343
void RemoveVertexAttr(const std::string &key)
Definition: TriangleMesh.h:191
TriangleMesh To(const core::Device &device, bool copy=false) const
Definition: TriangleMesh.cpp:567
open3d::geometry::TriangleMesh ToLegacy() const
Convert to a legacy Open3D TriangleMesh.
Definition: TriangleMesh.cpp:431
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:126
core::Device GetDevice() const override
Returns the device of the geometry.
Definition: TriangleMesh.h:717
core::Tensor GetMaxBound() const
Definition: TriangleMesh.h:626
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:586
const core::Tensor & GetTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:215
core::Tensor GetNonManifoldEdges(bool allow_boundary_edges=true) const
Definition: TriangleMesh.cpp:1470
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:1122
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 & GetTriangleAttr(const std::string &key)
Definition: TriangleMesh.h:164
const core::Tensor & GetTriangleColors() const
Definition: TriangleMesh.h:241
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:727
TriangleMesh BooleanIntersection(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:714
TriangleMesh RemoveUnreferencedVertices()
Definition: TriangleMesh.cpp:1298
TriangleMesh(const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMesh.cpp:44
int PCAPartition(int max_faces)
Definition: TriangleMesh.cpp:1058
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:294
core::Tensor & GetVertexColors()
Definition: TriangleMesh.h:148
const core::Tensor & GetVertexPositions() const
Definition: TriangleMesh.h:195
core::Tensor & GetTriangleIndices()
Definition: TriangleMesh.h:170
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:987
bool HasTriangleColors() const
Definition: TriangleMesh.h:363
const core::Tensor & GetVertexNormals() const
Definition: TriangleMesh.h:207
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:617
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 & GetVertexAttr(const std::string &key) const
Definition: TriangleMesh.h:183
const core::Tensor & GetTriangleIndices() const
Definition: TriangleMesh.h:229
bool HasTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:339
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:310
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:86
void SetVertexNormals(const core::Tensor &value)
Definition: TriangleMesh.h:271
const core::Tensor & GetVertexColors() const
Definition: TriangleMesh.h:201
core::Tensor GetCenter() const
Definition: TriangleMesh.h:628
TensorMap vertex_attr_
Definition: TriangleMesh.h:1012
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:155
TriangleMesh RemoveNonManifoldEdges()
Definition: TriangleMesh.cpp:1388
bool HasVertexPositions() const
Definition: TriangleMesh.h:319
TriangleMesh BooleanUnion(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:708
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:921
core::Tensor & GetTriangleColors()
Definition: TriangleMesh.h:178
TensorMap & GetTriangleAttr()
Getter for triangle_attr_ TensorMap.
Definition: TriangleMesh.h:158
core::Tensor & GetVertexAttr(const std::string &key)
Definition: TriangleMesh.h:138
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:155
TriangleMesh & ComputeTriangleAreas()
Function to compute triangle areas and save it as a triangle attribute "areas". Prints a warning,...
Definition: TriangleMesh.cpp:305
TriangleMesh SimplifyQuadricDecimation(double target_reduction, bool preserve_volume=true) const
Definition: TriangleMesh.cpp:655
core::Tensor & GetVertexNormals()
Definition: TriangleMesh.h:152
bool IsEmpty() const override
Returns !HasVertexPositions(), triangles are ignored.
Definition: TriangleMesh.h:622
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