Open3D (C++ API)
TriangleMeshIO.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 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 <string>
30 
32 
33 namespace open3d {
34 namespace io {
35 
38 std::shared_ptr<geometry::TriangleMesh> CreateMeshFromFile(
39  const std::string &filename, bool print_progress = false);
40 
44 bool ReadTriangleMesh(const std::string &filename,
45  geometry::TriangleMesh &mesh,
46  bool print_progress = false);
47 
55 bool WriteTriangleMesh(const std::string &filename,
56  const geometry::TriangleMesh &mesh,
57  bool write_ascii = false,
58  bool compressed = false,
59  bool write_vertex_normals = true,
60  bool write_vertex_colors = true,
61  bool write_triangle_uvs = true,
62  bool print_progress = false);
63 
64 bool ReadTriangleMeshFromPLY(const std::string &filename,
65  geometry::TriangleMesh &mesh,
66  bool print_progress);
67 
68 bool WriteTriangleMeshToPLY(const std::string &filename,
69  const geometry::TriangleMesh &mesh,
70  bool write_ascii,
71  bool compressed,
72  bool write_vertex_normals,
73  bool write_vertex_colors,
74  bool write_triangle_uvs,
75  bool print_progress);
76 
77 bool ReadTriangleMeshFromSTL(const std::string &filename,
78  geometry::TriangleMesh &mesh,
79  bool print_progress);
80 
81 bool WriteTriangleMeshToSTL(const std::string &filename,
82  const geometry::TriangleMesh &mesh,
83  bool write_ascii,
84  bool compressed,
85  bool write_vertex_normals,
86  bool write_vertex_colors,
87  bool write_triangle_uvs,
88  bool print_progress);
89 
90 bool ReadTriangleMeshFromOBJ(const std::string &filename,
91  geometry::TriangleMesh &mesh,
92  bool print_progress);
93 
94 bool WriteTriangleMeshToOBJ(const std::string &filename,
95  const geometry::TriangleMesh &mesh,
96  bool write_ascii,
97  bool compressed,
98  bool write_vertex_normals,
99  bool write_vertex_colors,
100  bool write_triangle_uvs,
101  bool print_progress);
102 
103 bool ReadTriangleMeshFromOFF(const std::string &filename,
104  geometry::TriangleMesh &mesh,
105  bool print_progress);
106 
107 bool WriteTriangleMeshToOFF(const std::string &filename,
108  const geometry::TriangleMesh &mesh,
109  bool write_ascii,
110  bool compressed,
111  bool write_vertex_normals,
112  bool write_vertex_colors,
113  bool write_triangle_uvs,
114  bool print_progress);
115 
116 bool ReadTriangleMeshFromGLTF(const std::string &filename,
117  geometry::TriangleMesh &mesh,
118  bool print_progress);
119 
120 bool WriteTriangleMeshToGLTF(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 
136 bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh,
137  std::vector<unsigned int> &indices);
138 
139 } // namespace io
140 } // namespace open3d
bool ReadTriangleMeshFromOBJ(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FileOBJ.cpp:47
bool ReadTriangleMesh(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: TriangleMeshIO.cpp:82
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:113
bool ReadTriangleMeshFromPLY(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FilePLY.cpp:536
bool ReadTriangleMeshFromGLTF(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FileGLTF.cpp:97
bool ReadTriangleMeshFromOFF(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FileOFF.cpp:41
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:394
std::shared_ptr< geometry::TriangleMesh > CreateMeshFromFile(const std::string &filename, bool print_progress)
Definition: TriangleMeshIO.cpp:75
bool ReadTriangleMeshFromSTL(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FileSTL.cpp:42
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:166
Definition: Open3DViewer.h:29
bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh, std::vector< unsigned int > &indices)
Definition: TriangleMeshIO.cpp:173
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:109
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:608
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:226