Open3D (C++ API)  0.18.0+2ae042a
TriangleMeshIO.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 <string>
11 
13 
14 namespace open3d {
15 namespace io {
16 
19 std::shared_ptr<geometry::TriangleMesh> CreateMeshFromFile(
20  const std::string &filename, bool print_progress = false);
21 
41  bool enable_post_processing = false;
45  bool print_progress = false;
49  std::function<bool(double)> update_progress;
50 };
51 
55 bool ReadTriangleMesh(const std::string &filename,
57  ReadTriangleMeshOptions params = {});
58 
66 bool WriteTriangleMesh(const std::string &filename,
67  const geometry::TriangleMesh &mesh,
68  bool write_ascii = false,
69  bool compressed = false,
70  bool write_vertex_normals = true,
71  bool write_vertex_colors = true,
72  bool write_triangle_uvs = true,
73  bool print_progress = false);
74 
75 // Currently enable_post_processing not used in ReadTriangleMeshFromPLY.
76 bool ReadTriangleMeshFromPLY(const std::string &filename,
78  const ReadTriangleMeshOptions &params);
79 
80 bool WriteTriangleMeshToPLY(const std::string &filename,
81  const geometry::TriangleMesh &mesh,
82  bool write_ascii,
83  bool compressed,
84  bool write_vertex_normals,
85  bool write_vertex_colors,
86  bool write_triangle_uvs,
87  bool print_progress);
88 
89 bool WriteTriangleMeshToSTL(const std::string &filename,
90  const geometry::TriangleMesh &mesh,
91  bool write_ascii,
92  bool compressed,
93  bool write_vertex_normals,
94  bool write_vertex_colors,
95  bool write_triangle_uvs,
96  bool print_progress);
97 
98 // Currently enable_post_processing not used in ReadTriangleMeshFromOBJ.
99 bool ReadTriangleMeshFromOBJ(const std::string &filename,
101  const ReadTriangleMeshOptions &params);
102 
103 bool WriteTriangleMeshToOBJ(const std::string &filename,
104  const geometry::TriangleMesh &mesh,
105  bool write_ascii,
106  bool compressed,
107  bool write_vertex_normals,
108  bool write_vertex_colors,
109  bool write_triangle_uvs,
110  bool print_progress);
111 
112 bool ReadTriangleMeshUsingASSIMP(const std::string &filename,
114  const ReadTriangleMeshOptions &params);
115 
116 // Currently enable_post_processing not used in ReadTriangleMeshFromOFF.
117 bool ReadTriangleMeshFromOFF(const std::string &filename,
119  const ReadTriangleMeshOptions &params);
120 
121 bool WriteTriangleMeshToOFF(const std::string &filename,
122  const geometry::TriangleMesh &mesh,
123  bool write_ascii,
124  bool compressed,
125  bool write_vertex_normals,
126  bool write_vertex_colors,
127  bool write_triangle_uvs,
128  bool print_progress);
129 
130 // Currently enable_post_processing not used in ReadTriangleMeshFromGLTF.
131 bool ReadTriangleMeshFromGLTF(const std::string &filename,
133  const ReadTriangleMeshOptions &params);
134 
135 bool WriteTriangleMeshToGLTF(const std::string &filename,
136  const geometry::TriangleMesh &mesh,
137  bool write_ascii,
138  bool compressed,
139  bool write_vertex_normals,
140  bool write_vertex_colors,
141  bool write_triangle_uvs,
142  bool print_progress);
143 
152  std::vector<unsigned int> &indices);
153 
154 } // namespace io
155 } // namespace open3d
Triangle mesh contains vertices and triangles represented by the indices to the vertices.
Definition: TriangleMesh.h:35
bool ReadTriangleMeshFromPLY(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FilePLY.cpp:521
bool WriteTriangleMeshToSTL(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Definition: FileSTL.cpp:24
bool ReadTriangleMeshUsingASSIMP(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileASSIMP.cpp:165
bool WriteTriangleMeshToGLTF(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Definition: FileGLTF.cpp:372
bool ReadTriangleMeshFromGLTF(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileGLTF.cpp:75
bool WriteTriangleMesh(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Definition: TriangleMeshIO.cpp:111
bool WriteTriangleMeshToOBJ(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Definition: FileOBJ.cpp:210
bool ReadTriangleMeshFromOBJ(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &)
Definition: FileOBJ.cpp:28
bool WriteTriangleMeshToOFF(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Definition: FileOFF.cpp:149
std::shared_ptr< geometry::TriangleMesh > CreateMeshFromFile(const std::string &filename, bool print_progress)
Definition: TriangleMeshIO.cpp:59
bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh, std::vector< unsigned int > &indices)
Definition: TriangleMeshIO.cpp:171
bool ReadTriangleMeshFromOFF(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileOFF.cpp:24
bool WriteTriangleMeshToPLY(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Definition: FilePLY.cpp:594
bool ReadTriangleMesh(const std::string &filename, geometry::TriangleMesh &mesh, ReadTriangleMeshOptions params)
Definition: TriangleMeshIO.cpp:68
Definition: PinholeCameraIntrinsic.cpp:16
Definition: TriangleMeshIO.h:22
bool enable_post_processing
Definition: TriangleMeshIO.h:41
bool print_progress
Definition: TriangleMeshIO.h:45
std::function< bool(double)> update_progress
Definition: TriangleMeshIO.h:49