Open3D (C++ API)  0.12.0
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 enable_post_processing = false,
47  bool print_progress = false);
48 
56 bool WriteTriangleMesh(const std::string &filename,
57  const geometry::TriangleMesh &mesh,
58  bool write_ascii = false,
59  bool compressed = false,
60  bool write_vertex_normals = true,
61  bool write_vertex_colors = true,
62  bool write_triangle_uvs = true,
63  bool print_progress = false);
64 
65 // Currently enable_post_processing not used in ReadTriangleMeshFromPLY.
66 bool ReadTriangleMeshFromPLY(const std::string &filename,
67  geometry::TriangleMesh &mesh,
68  bool enable_post_processing,
69  bool print_progress);
70 
71 bool WriteTriangleMeshToPLY(const std::string &filename,
72  const geometry::TriangleMesh &mesh,
73  bool write_ascii,
74  bool compressed,
75  bool write_vertex_normals,
76  bool write_vertex_colors,
77  bool write_triangle_uvs,
78  bool print_progress);
79 
80 bool WriteTriangleMeshToSTL(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 ReadTriangleMeshFromOBJ(const std::string &filename,
90  geometry::TriangleMesh &mesh,
91  bool print_progress);
92 
93 bool WriteTriangleMeshToOBJ(const std::string &filename,
94  const geometry::TriangleMesh &mesh,
95  bool write_ascii,
96  bool compressed,
97  bool write_vertex_normals,
98  bool write_vertex_colors,
99  bool write_triangle_uvs,
100  bool print_progress);
101 
102 bool ReadTriangleMeshUsingASSIMP(const std::string &filename,
103  geometry::TriangleMesh &mesh,
104  bool enable_post_processing,
105  bool print_progress);
106 
107 // Currently enable_post_processing not used in ReadTriangleMeshFromOFF.
108 bool ReadTriangleMeshFromOFF(const std::string &filename,
109  geometry::TriangleMesh &mesh,
110  bool enable_post_processing,
111  bool print_progress);
112 
113 bool WriteTriangleMeshToOFF(const std::string &filename,
114  const geometry::TriangleMesh &mesh,
115  bool write_ascii,
116  bool compressed,
117  bool write_vertex_normals,
118  bool write_vertex_colors,
119  bool write_triangle_uvs,
120  bool print_progress);
121 
122 bool ReadTriangleMeshFromGLTF(const std::string &filename,
123  geometry::TriangleMesh &mesh,
124  bool print_progress);
125 
126 bool WriteTriangleMeshToGLTF(const std::string &filename,
127  const geometry::TriangleMesh &mesh,
128  bool write_ascii,
129  bool compressed,
130  bool write_vertex_normals,
131  bool write_vertex_colors,
132  bool write_triangle_uvs,
133  bool print_progress);
134 
142 bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh,
143  std::vector<unsigned int> &indices);
144 
145 } // namespace io
146 } // namespace open3d
bool ReadTriangleMeshFromOBJ(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FileOBJ.cpp:46
bool ReadTriangleMeshUsingASSIMP(const std::string &filename, geometry::TriangleMesh &mesh, bool enable_post_processing, bool print_progress)
Definition: FileASSIMP.cpp:139
bool ReadTriangleMeshFromPLY(const std::string &filename, geometry::TriangleMesh &mesh, bool enable_post_processing, bool print_progress)
Definition: FilePLY.cpp:539
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:116
bool ReadTriangleMeshFromGLTF(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: FileGLTF.cpp:94
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:391
std::shared_ptr< geometry::TriangleMesh > CreateMeshFromFile(const std::string &filename, bool print_progress)
Definition: TriangleMeshIO.cpp:76
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:167
bool ReadTriangleMesh(const std::string &filename, geometry::TriangleMesh &mesh, bool enable_post_processing, bool print_progress)
Definition: TriangleMeshIO.cpp:83
Definition: PinholeCameraIntrinsic.cpp:35
bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh, std::vector< unsigned int > &indices)
Definition: TriangleMeshIO.cpp:176
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:42
bool ReadTriangleMeshFromOFF(const std::string &filename, geometry::TriangleMesh &mesh, bool enable_post_processing, bool print_progress)
Definition: FileOFF.cpp:41
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:612
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:225