Open3D (C++ API)  0.15.1
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-2021 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
33namespace open3d {
34namespace io {
35
38std::shared_ptr<geometry::TriangleMesh> CreateMeshFromFile(
39 const std::string &filename, bool print_progress = false);
40
47 bool print_progress = false;
51 std::function<bool(double)> update_progress;
52};
53
57bool ReadTriangleMesh(const std::string &filename,
59 ReadTriangleMeshOptions params = {});
60
68bool WriteTriangleMesh(const std::string &filename,
69 const geometry::TriangleMesh &mesh,
70 bool write_ascii = false,
71 bool compressed = false,
72 bool write_vertex_normals = true,
73 bool write_vertex_colors = true,
74 bool write_triangle_uvs = true,
75 bool print_progress = false);
76
77// Currently enable_post_processing not used in ReadTriangleMeshFromPLY.
78bool ReadTriangleMeshFromPLY(const std::string &filename,
80 const ReadTriangleMeshOptions &params);
81
82bool WriteTriangleMeshToPLY(const std::string &filename,
83 const geometry::TriangleMesh &mesh,
84 bool write_ascii,
85 bool compressed,
86 bool write_vertex_normals,
87 bool write_vertex_colors,
88 bool write_triangle_uvs,
89 bool print_progress);
90
91bool WriteTriangleMeshToSTL(const std::string &filename,
92 const geometry::TriangleMesh &mesh,
93 bool write_ascii,
94 bool compressed,
95 bool write_vertex_normals,
96 bool write_vertex_colors,
97 bool write_triangle_uvs,
98 bool print_progress);
99
100// Currently enable_post_processing not used in ReadTriangleMeshFromOBJ.
101bool ReadTriangleMeshFromOBJ(const std::string &filename,
103 const ReadTriangleMeshOptions &params);
104
105bool WriteTriangleMeshToOBJ(const std::string &filename,
106 const geometry::TriangleMesh &mesh,
107 bool write_ascii,
108 bool compressed,
109 bool write_vertex_normals,
110 bool write_vertex_colors,
111 bool write_triangle_uvs,
112 bool print_progress);
113
114bool ReadTriangleMeshUsingASSIMP(const std::string &filename,
116 const ReadTriangleMeshOptions &params);
117
118// Currently enable_post_processing not used in ReadTriangleMeshFromOFF.
119bool ReadTriangleMeshFromOFF(const std::string &filename,
121 const ReadTriangleMeshOptions &params);
122
123bool WriteTriangleMeshToOFF(const std::string &filename,
124 const geometry::TriangleMesh &mesh,
125 bool write_ascii,
126 bool compressed,
127 bool write_vertex_normals,
128 bool write_vertex_colors,
129 bool write_triangle_uvs,
130 bool print_progress);
131
132// Currently enable_post_processing not used in ReadTriangleMeshFromGLTF.
133bool ReadTriangleMeshFromGLTF(const std::string &filename,
135 const ReadTriangleMeshOptions &params);
136
137bool WriteTriangleMeshToGLTF(const std::string &filename,
138 const geometry::TriangleMesh &mesh,
139 bool write_ascii,
140 bool compressed,
141 bool write_vertex_normals,
142 bool write_vertex_colors,
143 bool write_triangle_uvs,
144 bool print_progress);
145
154 std::vector<unsigned int> &indices);
155
156} // namespace io
157} // namespace open3d
Triangle mesh contains vertices and triangles represented by the indices to the vertices.
Definition: TriangleMesh.h:54
bool ReadTriangleMeshFromPLY(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FilePLY.cpp:540
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:43
bool ReadTriangleMeshUsingASSIMP(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileASSIMP.cpp:143
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
bool ReadTriangleMeshFromGLTF(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileGLTF.cpp:94
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:130
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
bool ReadTriangleMeshFromOBJ(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &)
Definition: FileOBJ.cpp:47
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:168
std::shared_ptr< geometry::TriangleMesh > CreateMeshFromFile(const std::string &filename, bool print_progress)
Definition: TriangleMeshIO.cpp:78
bool AddTrianglesByEarClipping(geometry::TriangleMesh &mesh, std::vector< unsigned int > &indices)
Definition: TriangleMeshIO.cpp:190
bool ReadTriangleMeshFromOFF(const std::string &filename, geometry::TriangleMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileOFF.cpp:43
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:613
bool ReadTriangleMesh(const std::string &filename, geometry::TriangleMesh &mesh, ReadTriangleMeshOptions params)
Definition: TriangleMeshIO.cpp:87
Definition: PinholeCameraIntrinsic.cpp:35
Definition: TriangleMeshIO.h:41
bool enable_post_processing
Enables post-processing on the mesh.
Definition: TriangleMeshIO.h:43
bool print_progress
Definition: TriangleMeshIO.h:47
std::function< bool(double)> update_progress
Definition: TriangleMeshIO.h:51