Open3D (C++ API)  0.16.1
TriangleMesh.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <list>
30 
31 #include "open3d/core/Tensor.h"
38 
39 namespace open3d {
40 namespace t {
41 namespace geometry {
42 
43 class LineSet;
44 
111 class TriangleMesh : public Geometry, public DrawableGeometry {
112 public:
116  TriangleMesh(const core::Device &device = core::Device("CPU:0"));
117 
126  TriangleMesh(const core::Tensor &vertex_positions,
127  const core::Tensor &triangle_indices);
128 
129  virtual ~TriangleMesh() override {}
130 
131 public:
133  std::string ToString() const;
134 
140  TriangleMesh To(const core::Device &device, bool copy = false) const;
141 
143  TriangleMesh Clone() const { return To(GetDevice(), /*copy=*/true); }
144 
146  const TensorMap &GetVertexAttr() const { return vertex_attr_; }
147 
150 
155  core::Tensor &GetVertexAttr(const std::string &key) {
156  return vertex_attr_.at(key);
157  }
158 
161  core::Tensor &GetVertexPositions() { return GetVertexAttr("positions"); }
162 
165  core::Tensor &GetVertexColors() { return GetVertexAttr("colors"); }
166 
169  core::Tensor &GetVertexNormals() { return GetVertexAttr("normals"); }
170 
172  const TensorMap &GetTriangleAttr() const { return triangle_attr_; }
173 
176 
181  core::Tensor &GetTriangleAttr(const std::string &key) {
182  return triangle_attr_.at(key);
183  }
184 
188 
192 
196 
200  const core::Tensor &GetVertexAttr(const std::string &key) const {
201  return vertex_attr_.at(key);
202  }
203 
208  void RemoveVertexAttr(const std::string &key) { vertex_attr_.Erase(key); }
209 
213  return GetVertexAttr("positions");
214  }
215 
218  const core::Tensor &GetVertexColors() const {
219  return GetVertexAttr("colors");
220  }
221 
225  return GetVertexAttr("normals");
226  }
227 
232  const core::Tensor &GetTriangleAttr(const std::string &key) const {
233  return triangle_attr_.at(key);
234  }
235 
240  void RemoveTriangleAttr(const std::string &key) {
241  triangle_attr_.Erase(key);
242  }
243 
247  return GetTriangleAttr("indices");
248  }
249 
253  return GetTriangleAttr("normals");
254  }
255 
259  return GetTriangleAttr("colors");
260  }
261 
267  void SetVertexAttr(const std::string &key, const core::Tensor &value) {
269  vertex_attr_[key] = value;
270  }
271 
274  void SetVertexPositions(const core::Tensor &value) {
276  SetVertexAttr("positions", value);
277  }
278 
281  void SetVertexColors(const core::Tensor &value) {
283  SetVertexAttr("colors", value);
284  }
285 
288  void SetVertexNormals(const core::Tensor &value) {
290  SetVertexAttr("normals", value);
291  }
292 
298  void SetTriangleAttr(const std::string &key, const core::Tensor &value) {
300  triangle_attr_[key] = value;
301  }
302 
304  void SetTriangleIndices(const core::Tensor &value) {
306  SetTriangleAttr("indices", value);
307  }
308 
311  void SetTriangleNormals(const core::Tensor &value) {
313  SetTriangleAttr("normals", value);
314  }
315 
318  void SetTriangleColors(const core::Tensor &value) {
320  SetTriangleAttr("colors", value);
321  }
322 
327  bool HasVertexAttr(const std::string &key) const {
328  return vertex_attr_.Contains(key) &&
329  GetVertexAttr(key).GetLength() > 0 &&
330  GetVertexAttr(key).GetLength() ==
332  }
333 
336  bool HasVertexPositions() const { return HasVertexAttr("positions"); }
337 
343  bool HasVertexColors() const { return HasVertexAttr("colors"); }
344 
350  bool HasVertexNormals() const { return HasVertexAttr("normals"); }
351 
356  bool HasTriangleAttr(const std::string &key) const {
357  return triangle_attr_.Contains(key) &&
358  GetTriangleAttr(key).GetLength() > 0 &&
359  GetTriangleAttr(key).GetLength() ==
361  }
362 
366  bool HasTriangleIndices() const { return HasTriangleAttr("indices"); }
367 
373  bool HasTriangleNormals() const { return HasTriangleAttr("normals"); }
374 
380  bool HasTriangleColors() const { return HasTriangleAttr("colors"); }
381 
392  static TriangleMesh CreateBox(
393  double width = 1.0,
394  double height = 1.0,
395  double depth = 1.0,
396  core::Dtype float_dtype = core::Float32,
397  core::Dtype int_dtype = core::Int64,
398  const core::Device &device = core::Device("CPU:0"));
399 
413  static TriangleMesh CreateSphere(
414  double radius = 1.0,
415  int resolution = 20,
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 
460  double radius = 1.0,
461  core::Dtype float_dtype = core::Float32,
462  core::Dtype int_dtype = core::Int64,
463  const core::Device &device = core::Device("CPU:0"));
464 
478  double radius = 1.0,
479  double height = 2.0,
480  int resolution = 20,
481  int split = 4,
482  core::Dtype float_dtype = core::Float32,
483  core::Dtype int_dtype = core::Int64,
484  const core::Device &device = core::Device("CPU:0"));
485 
498  static TriangleMesh CreateCone(
499  double radius = 1.0,
500  double height = 2.0,
501  int resolution = 20,
502  int split = 1,
503  core::Dtype float_dtype = core::Float32,
504  core::Dtype int_dtype = core::Int64,
505  const core::Device &device = core::Device("CPU:0"));
506 
520  static TriangleMesh CreateTorus(
521  double torus_radius = 1.0,
522  double tube_radius = 0.5,
523  int radial_resolution = 30,
524  int tubular_resolution = 20,
525  core::Dtype float_dtype = core::Float32,
526  core::Dtype int_dtype = core::Int64,
527  const core::Device &device = core::Device("CPU:0"));
528 
546  static TriangleMesh CreateArrow(
547  double cylinder_radius = 1.0,
548  double cone_radius = 1.5,
549  double cylinder_height = 5.0,
550  double cone_height = 4.0,
551  int resolution = 20,
552  int cylinder_split = 4,
553  int cone_split = 1,
554  core::Dtype float_dtype = core::Float32,
555  core::Dtype int_dtype = core::Int64,
556  const core::Device &device = core::Device("CPU:0"));
557 
567  double size = 1.0,
568  const Eigen::Vector3d &origin = Eigen::Vector3d(0.0, 0.0, 0.0),
569  core::Dtype float_dtype = core::Float32,
570  core::Dtype int_dtype = core::Int64,
571  const core::Device &device = core::Device("CPU:0"));
572 
588  static TriangleMesh CreateMobius(
589  int length_split = 70,
590  int width_split = 15,
591  int twists = 1,
592  double radius = 1,
593  double flatness = 1,
594  double width = 1,
595  double scale = 1,
596  core::Dtype float_dtype = core::Float32,
597  core::Dtype int_dtype = core::Int64,
598  const core::Device &device = core::Device("CPU:0"));
599 
609  static TriangleMesh CreateText(
610  const std::string &text,
611  double depth = 0.0,
612  core::Dtype float_dtype = core::Float32,
613  core::Dtype int_dtype = core::Int64,
614  const core::Device &device = core::Device("CPU:0"));
615 
616 public:
618  TriangleMesh &Clear() override {
619  vertex_attr_.clear();
620  triangle_attr_.clear();
621  return *this;
622  }
623 
625  bool IsEmpty() const override { return !HasVertexPositions(); }
626 
627  core::Tensor GetMinBound() const { return GetVertexPositions().Min({0}); }
628 
629  core::Tensor GetMaxBound() const { return GetVertexPositions().Max({0}); }
630 
631  core::Tensor GetCenter() const { return GetVertexPositions().Mean({0}); }
632 
652  TriangleMesh &Transform(const core::Tensor &transformation);
653 
658  TriangleMesh &Translate(const core::Tensor &translation,
659  bool relative = true);
660 
666  TriangleMesh &Scale(double scale, const core::Tensor &center);
667 
674  TriangleMesh &Rotate(const core::Tensor &R, const core::Tensor &center);
675 
678 
681  TriangleMesh &ComputeTriangleNormals(bool normalized = true);
682 
685  TriangleMesh &ComputeVertexNormals(bool normalized = true);
686 
696  TriangleMesh ClipPlane(const core::Tensor &point,
697  const core::Tensor &normal) const;
698 
707  LineSet SlicePlane(const core::Tensor &point,
708  const core::Tensor &normal,
709  const std::vector<double> contour_values = {0.0}) const;
710 
711  core::Device GetDevice() const override { return device_; }
712 
721  const open3d::geometry::TriangleMesh &mesh_legacy,
722  core::Dtype float_dtype = core::Float32,
723  core::Dtype int_dtype = core::Int64,
724  const core::Device &device = core::Device("CPU:0"));
725 
728 
743  TriangleMesh ComputeConvexHull(bool joggle_inputs = false) const;
744 
758  TriangleMesh SimplifyQuadricDecimation(double target_reduction,
759  bool preserve_volume = true) const;
760 
773  double tolerance = 1e-6) const;
774 
786  double tolerance = 1e-6) const;
787 
799  double tolerance = 1e-6) const;
800 
803 
812  TriangleMesh FillHoles(double hole_size = 1e6) const;
813 
832  void ComputeUVAtlas(size_t size = 512,
833  float gutter = 1.0f,
834  float max_stretch = 1.f / 6);
835 
861  std::unordered_map<std::string, core::Tensor> BakeVertexAttrTextures(
862  int size,
863  const std::unordered_set<std::string> &vertex_attr = {},
864  double margin = 2.,
865  double fill = 0.,
866  bool update_material = true);
867 
892  std::unordered_map<std::string, core::Tensor> BakeTriangleAttrTextures(
893  int size,
894  const std::unordered_set<std::string> &triangle_attr = {},
895  double margin = 2.,
896  double fill = 0.,
897  bool update_material = true);
898 
907  TriangleMesh ExtrudeRotation(double angle,
908  const core::Tensor &axis,
909  int resolution = 16,
910  double translation = 0.0,
911  bool capping = true) const;
912 
919  double scale = 1.0,
920  bool capping = true) const;
921 
922 protected:
926 };
927 
928 } // namespace geometry
929 } // namespace t
930 } // namespace open3d
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:62
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:77
bool copy
Definition: VtkUtils.cpp:89
Definition: Device.h:37
Definition: Dtype.h:39
Definition: Tensor.h:51
int64_t GetLength() const
Definition: Tensor.h:1130
Tensor Min(const SizeVector &dims, bool keepdim=false) const
Definition: Tensor.cpp:1217
Tensor Mean(const SizeVector &dims, bool keepdim=false) const
Definition: Tensor.cpp:1196
Tensor Max(const SizeVector &dims, bool keepdim=false) const
Definition: Tensor.cpp:1224
Triangle mesh contains vertices and triangles represented by the indices to the vertices.
Definition: TriangleMesh.h:54
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.
Definition: BoundingVolume.h:63
Mix-in class for geometry types that can be visualized.
Definition: DrawableGeometry.h:38
The base geometry class.
Definition: Geometry.h:42
A LineSet contains points and lines joining them and optionally attributes on the points and lines.
Definition: LineSet.h:103
Definition: TensorMap.h:50
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:111
bool Contains(const std::string &key) const
Definition: TensorMap.h:206
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:111
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:264
TriangleMesh ExtrudeRotation(double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const
Definition: TriangleMesh.cpp:867
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:208
TriangleMesh BooleanDifference(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:551
void SetTriangleIndices(const core::Tensor &value)
Set the value of the "indices" attribute in triangle_attr_.
Definition: TriangleMesh.h:304
TriangleMesh FillHoles(double hole_size=1e6) const
Definition: TriangleMesh.cpp:561
const TensorMap & GetVertexAttr() const
Getter for vertex_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:146
core::Tensor & GetTriangleNormals()
Definition: TriangleMesh.h:191
core::Tensor GetMinBound() const
Definition: TriangleMesh.h:627
core::Tensor & GetVertexPositions()
Definition: TriangleMesh.h:161
void SetVertexPositions(const core::Tensor &value)
Definition: TriangleMesh.h:274
void SetVertexAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:267
TriangleMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
Definition: TriangleMesh.cpp:230
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:229
const core::Tensor & GetTriangleNormals() const
Definition: TriangleMesh.h:252
TensorMap & GetVertexAttr()
Getter for vertex_attr_ TensorMap.
Definition: TriangleMesh.h:149
void SetVertexColors(const core::Tensor &value)
Definition: TriangleMesh.h:281
TensorMap triangle_attr_
Definition: TriangleMesh.h:925
void SetTriangleColors(const core::Tensor &value)
Definition: TriangleMesh.h:318
TriangleMesh ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
Definition: TriangleMesh.cpp:877
virtual ~TriangleMesh() override
Definition: TriangleMesh.h:129
bool HasTriangleIndices() const
Definition: TriangleMesh.h:366
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:40
bool HasVertexColors() const
Definition: TriangleMesh.h:343
void SetTriangleAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:298
core::Device device_
Definition: TriangleMesh.h:923
void ComputeUVAtlas(size_t size=512, float gutter=1.0f, float max_stretch=1.f/6)
Definition: TriangleMesh.cpp:575
TriangleMesh & Clear() override
Clear all data in the trianglemesh.
Definition: TriangleMesh.h:618
void RemoveTriangleAttr(const std::string &key)
Definition: TriangleMesh.h:240
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMesh.cpp:266
bool HasTriangleNormals() const
Definition: TriangleMesh.h:373
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
Definition: TriangleMesh.cpp:411
bool HasVertexNormals() const
Definition: TriangleMesh.h:350
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:305
void RemoveVertexAttr(const std::string &key)
Definition: TriangleMesh.h:208
TriangleMesh To(const core::Device &device, bool copy=false) const
Definition: TriangleMesh.cpp:397
open3d::geometry::TriangleMesh ToLegacy() const
Convert to a legacy Open3D TriangleMesh.
Definition: TriangleMesh.cpp:356
TriangleMesh & NormalizeNormals()
Normalize both triangle normals and vertex normals to length 1.
Definition: TriangleMesh.cpp:196
TriangleMesh Clone() const
Returns copy of the triangle mesh on the same device.
Definition: TriangleMesh.h:143
core::Device GetDevice() const override
Returns the device of the geometry.
Definition: TriangleMesh.h:711
core::Tensor GetMaxBound() const
Definition: TriangleMesh.h:629
TriangleMesh & Rotate(const core::Tensor &R, const core::Tensor &center)
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
Definition: TriangleMesh.cpp:181
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:416
const core::Tensor & GetTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:232
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:190
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:130
core::Tensor & GetTriangleAttr(const std::string &key)
Definition: TriangleMesh.h:181
const core::Tensor & GetTriangleColors() const
Definition: TriangleMesh.h:258
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:557
TriangleMesh BooleanIntersection(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:544
TriangleMesh(const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMesh.cpp:63
TriangleMesh & Scale(double scale, const core::Tensor &center)
Scales the VertexPositions of the TriangleMesh.
Definition: TriangleMesh.cpp:170
void SetTriangleNormals(const core::Tensor &value)
Definition: TriangleMesh.h:311
core::Tensor & GetVertexColors()
Definition: TriangleMesh.h:165
const core::Tensor & GetVertexPositions() const
Definition: TriangleMesh.h:212
core::Tensor & GetTriangleIndices()
Definition: TriangleMesh.h:187
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:813
bool HasTriangleColors() const
Definition: TriangleMesh.h:380
const core::Tensor & GetVertexNormals() const
Definition: TriangleMesh.h:224
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:447
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:243
const core::Tensor & GetVertexAttr(const std::string &key) const
Definition: TriangleMesh.h:200
const core::Tensor & GetTriangleIndices() const
Definition: TriangleMesh.h:246
bool HasTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:356
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:143
bool HasVertexAttr(const std::string &key) const
Definition: TriangleMesh.h:327
TriangleMesh & Transform(const core::Tensor &transformation)
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
Definition: TriangleMesh.cpp:141
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:104
void SetVertexNormals(const core::Tensor &value)
Definition: TriangleMesh.h:288
const core::Tensor & GetVertexColors() const
Definition: TriangleMesh.h:218
core::Tensor GetCenter() const
Definition: TriangleMesh.h:631
TensorMap vertex_attr_
Definition: TriangleMesh.h:924
std::string ToString() const
Text description.
Definition: TriangleMesh.cpp:85
const TensorMap & GetTriangleAttr() const
Getter for triangle_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:172
bool HasVertexPositions() const
Definition: TriangleMesh.h:336
TriangleMesh BooleanUnion(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:538
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:117
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:156
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:747
core::Tensor & GetTriangleColors()
Definition: TriangleMesh.h:195
TensorMap & GetTriangleAttr()
Getter for triangle_attr_ TensorMap.
Definition: TriangleMesh.h:175
core::Tensor & GetVertexAttr(const std::string &key)
Definition: TriangleMesh.h:155
TriangleMesh & Translate(const core::Tensor &translation, bool relative=true)
Translates the VertexPositions of the TriangleMesh.
Definition: TriangleMesh.cpp:156
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:173
TriangleMesh SimplifyQuadricDecimation(double target_reduction, bool preserve_volume=true) const
Definition: TriangleMesh.cpp:485
core::Tensor & GetVertexNormals()
Definition: TriangleMesh.h:169
bool IsEmpty() const override
Returns !HasVertexPositions(), triangles are ignored.
Definition: TriangleMesh.h:625
int width
Definition: FilePCD.cpp:71
int size
Definition: FilePCD.cpp:59
int height
Definition: FilePCD.cpp:72
const Dtype Int64
Definition: Dtype.cpp:66
const Dtype Float32
Definition: Dtype.cpp:61
constexpr nullopt_t nullopt
Definition: Optional.h:171
Definition: PinholeCameraIntrinsic.cpp:35