12 m_vertices.emplace_back(vtx.template cast<ValueType>(), color);
19 idxs.reserve(vtxs.size());
20 for (
const auto& vtx : vtxs) {
22 idxs.push_back(m_vertices.size() - 1);
24 m_faces.push_back(std::move(idxs));
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 IVisualization::hasExtension(path)) {
48 objectpath += std::string(
".ply");
56 void PlyVisualization<T>::write(std::ostream& os)
const {
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, IVisualization::ColorType>& vtx :
78 os << vtx.first.x() <<
" " << vtx.first.y() <<
" " << vtx.first.z() <<
" ";
79 os << vtx.second[0] <<
" " << vtx.second[1] <<
" " << vtx.second[2] <<
"\n";
82 for (
const FaceType& fc : m_faces) {
84 for (
size_t i = 0; i < fc.size(); i++) {
90 for (
const std::pair<std::pair<size_t, size_t>, IVisualization::ColorType>&
92 std::pair<size_t, size_t> idxs = edge.first;
93 os << idxs.first <<
" " << idxs.second <<
" ";
94 os << edge.second[0] <<
" " << edge.second[1] <<
" " << edge.second[2]