Open3D (C++ API)
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
53 bool WriteTriangleMesh(const std::string &filename,
54  const geometry::TriangleMesh &mesh,
55  bool write_ascii = false,
56  bool compressed = false,
57  bool write_vertex_normals = true,
58  bool write_vertex_colors = true,
59  bool print_progress = false);
60 
61 bool ReadTriangleMeshFromPLY(const std::string &filename,
62  geometry::TriangleMesh &mesh,
63  bool print_progress = false);
64 
65 bool WriteTriangleMeshToPLY(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 print_progress = false);
72 
73 bool ReadTriangleMeshFromSTL(const std::string &filename,
74  geometry::TriangleMesh &mesh,
75  bool print_progress = false);
76 
77 bool WriteTriangleMeshToSTL(const std::string &filename,
78  const geometry::TriangleMesh &mesh,
79  bool write_ascii = false,
80  bool compressed = false,
81  bool write_vertex_normals = true,
82  bool write_vertex_colors = true,
83  bool print_progress = false);
84 
85 bool ReadTriangleMeshFromOBJ(const std::string &filename,
86  geometry::TriangleMesh &mesh,
87  bool print_progress = false);
88 
89 bool WriteTriangleMeshToOBJ(const std::string &filename,
90  const geometry::TriangleMesh &mesh,
91  bool write_ascii = false,
92  bool compressed = false,
93  bool write_vertex_normals = true,
94  bool write_vertex_colors = true,
95  bool print_progress = false);
96 
97 bool ReadTriangleMeshFromOFF(const std::string &filename,
98  geometry::TriangleMesh &mesh,
99  bool print_progress = false);
100 
101 bool WriteTriangleMeshToOFF(const std::string &filename,
102  const geometry::TriangleMesh &mesh,
103  bool write_ascii = false,
104  bool compressed = false,
105  bool write_vertex_normals = true,
106  bool write_vertex_colors = true,
107  bool print_progress = false);
108 
109 bool ReadTriangleMeshFromGLTF(const std::string &filename,
110  geometry::TriangleMesh &mesh,
111  bool print_progress = false);
112 
113 bool WriteTriangleMeshToGLTF(const std::string &filename,
114  const geometry::TriangleMesh &mesh,
115  bool write_ascii = false,
116  bool compressed = false,
117  bool write_vertex_normals = true,
118  bool write_vertex_colors = true,
119  bool print_progress = false);
120 
128 bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh,
129  std::vector<unsigned int> &indices);
130 
131 } // namespace io
132 } // namespace open3d
bool WriteTriangleMeshToPLY(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii=false, bool compressed=false, bool write_vertex_normals=true, bool write_vertex_colors=true, bool print_progress=false)
Definition: FilePLY.cpp:564
bool ReadTriangleMesh(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress)
Definition: TriangleMeshIO.cpp:81
bool ReadTriangleMeshFromGLTF(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress=false)
Definition: FileGLTF.cpp:92
bool ReadTriangleMeshFromPLY(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress=false)
Definition: FilePLY.cpp:492
bool ReadTriangleMeshFromOBJ(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress=false)
Definition: FileOBJ.cpp:40
std::shared_ptr< geometry::TriangleMesh > CreateMeshFromFile(const std::string &filename, bool print_progress)
Definition: TriangleMeshIO.cpp:74
bool ReadTriangleMeshFromSTL(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress=false)
Definition: FileSTL.cpp:36
bool ReadTriangleMeshFromOFF(const std::string &filename, geometry::TriangleMesh &mesh, bool print_progress=false)
Definition: FileOFF.cpp:36
bool WriteTriangleMesh(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool print_progress)
Definition: TriangleMeshIO.cpp:113
bool WriteTriangleMeshToOFF(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii=false, bool compressed=false, bool write_vertex_normals=true, bool write_vertex_colors=true, bool print_progress=false)
Definition: FileOFF.cpp:163
Definition: PinholeCameraIntrinsic.cpp:34
bool WriteTriangleMeshToGLTF(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii=false, bool compressed=false, bool write_vertex_normals=true, bool write_vertex_colors=true, bool print_progress=false)
Definition: FileGLTF.cpp:389
bool WriteTriangleMeshToSTL(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii=false, bool compressed=false, bool write_vertex_normals=true, bool write_vertex_colors=true, bool print_progress=false)
Definition: FileSTL.cpp:103
bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh, std::vector< unsigned int > &indices)
Definition: TriangleMeshIO.cpp:172
bool WriteTriangleMeshToOBJ(const std::string &filename, const geometry::TriangleMesh &mesh, bool write_ascii=false, bool compressed=false, bool write_vertex_normals=true, bool write_vertex_colors=true, bool print_progress=false)
Definition: FileOBJ.cpp:129