11 m_vertices.emplace_back(vtx.template cast<ValueType>(), color);
18 idxs.reserve(vtxs.size());
19 for (
const auto&
vtx : vtxs) {
21 idxs.push_back(m_vertices.size() - 1);
23 m_faces.push_back(std::move(idxs));
28 const std::vector<FaceType>&,
37 size_t idx_a = m_vertices.size() - 1;
39 size_t idx_b = m_vertices.size() - 1;
40 m_edges.emplace_back(std::make_pair(std::make_pair(idx_a, idx_b), color));
46 std::string objectpath = path;
47 if (not IVisualization3D::hasExtension(path)) {
48 objectpath += std::string(
".ply");
58 os <<
"format ascii 1.0\n";
59 os <<
"element vertex " << m_vertices.size() <<
"\n";
60 os <<
"property float x\n";
61 os <<
"property float y\n";
62 os <<
"property float z\n";
63 os <<
"property uchar red\n";
64 os <<
"property uchar green\n";
65 os <<
"property uchar blue\n";
66 os <<
"element face " << m_faces.size() <<
"\n";
67 os <<
"property list uchar int vertex_index\n";
68 os <<
"element edge " << m_edges.size() <<
"\n";
69 os <<
"property int vertex1\n";
70 os <<
"property int vertex2\n";
71 os <<
"property uchar red\n";
72 os <<
"property uchar green\n";
73 os <<
"property uchar blue\n";
76 for (
const std::pair<VertexType, ColorRGB>&
vtx : m_vertices) {
77 os <<
vtx.first.x() <<
" " <<
vtx.first.y() <<
" " <<
vtx.first.z() <<
" ";
78 os <<
vtx.second[0] <<
" " <<
vtx.second[1] <<
" " <<
vtx.second[2] <<
"\n";
81 for (
const FaceType& fc : m_faces) {
83 for (
size_t i = 0; i < fc.size(); i++) {
89 for (
const std::pair<std::pair<size_t, size_t>,
ColorRGB>& edge : m_edges) {
90 std::pair<size_t, size_t> idxs = edge.first;
91 os << idxs.first <<
" " << idxs.second <<
" ";
92 os << edge.second[0] <<
" " << edge.second[1] <<
" " << edge.second[2]