Open3D (C++ API)  0.18.0+90810a3
TriangleMeshIO.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 <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 
40  bool enable_post_processing = false;
44  bool print_progress = false;
48  std::function<bool(double)> update_progress;
49 };
50 
54 bool ReadTriangleMesh(const std::string &filename,
56  ReadTriangleMeshOptions params = {});
57 
65 bool WriteTriangleMesh(const std::string &filename,
66  const geometry::TriangleMesh &mesh,
67  bool write_ascii = false,
68  bool compressed = false,
69  bool write_vertex_normals = true,
70  bool write_vertex_colors = true,
71  bool write_triangle_uvs = true,
72  bool print_progress = false);
73 
74 // Currently enable_post_processing not used in ReadTriangleMeshFromPLY.
75 bool ReadTriangleMeshFromPLY(const std::string &filename,
77  const ReadTriangleMeshOptions &params);
78 
79 bool WriteTriangleMeshToPLY(const std::string &filename,
80  const geometry::TriangleMesh &mesh,
81  bool write_ascii,
82  bool compressed,
83  bool write_vertex_normals,
84  bool write_vertex_colors,
85  bool write_triangle_uvs,
86  bool print_progress);
87 
88 bool WriteTriangleMeshToSTL(const std::string &filename,
89  const geometry::TriangleMesh &mesh,
90  bool write_ascii,
91  bool compressed,
92  bool write_vertex_normals,
93  bool write_vertex_colors,
94  bool write_triangle_uvs,
95  bool print_progress);
96 
97 // Currently enable_post_processing not used in ReadTriangleMeshFromOBJ.
98 bool ReadTriangleMeshFromOBJ(const std::string &filename,
100  const ReadTriangleMeshOptions &params);
101 
102 bool WriteTriangleMeshToOBJ(const std::string &filename,
103  const geometry::TriangleMesh &mesh,
104  bool write_ascii,
105  bool compressed,
106  bool write_vertex_normals,
107  bool write_vertex_colors,
108  bool write_triangle_uvs,
109  bool print_progress);
110 
111 bool ReadTriangleMeshUsingASSIMP(const std::string &filename,
113  const ReadTriangleMeshOptions &params);
114 
115 // Currently enable_post_processing not used in ReadTriangleMeshFromOFF.
116 bool ReadTriangleMeshFromOFF(const std::string &filename,
118  const ReadTriangleMeshOptions &params);
119 
120 bool WriteTriangleMeshToOFF(const std::string &filename,
121  const geometry::TriangleMesh &mesh,
122  bool write_ascii,
123  bool compressed,
124  bool write_vertex_normals,
125  bool write_vertex_colors,
126  bool write_triangle_uvs,
127  bool print_progress);
128 
129 // Currently enable_post_processing not used in ReadTriangleMeshFromGLTF.
130 bool ReadTriangleMeshFromGLTF(const std::string &filename,
132  const ReadTriangleMeshOptions &params);
133 
134 bool WriteTriangleMeshToGLTF(const std::string &filename,
135  const geometry::TriangleMesh &mesh,
136  bool write_ascii,
137  bool compressed,
138  bool write_vertex_normals,
139  bool write_vertex_colors,
140  bool write_triangle_uvs,
141  bool print_progress);
142 
151  std::vector<unsigned int> &indices);
152 
153 } // namespace io
154 } // 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:159
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:40
bool print_progress
Definition: TriangleMeshIO.h:44
std::function< bool(double)> update_progress
Definition: TriangleMeshIO.h:48