mirror of https://github.com/CGAL/cgal
Fix #nv #nf of meshes with garbage
This commit is contained in:
parent
8b7ed1d3b0
commit
1520c8bc61
|
|
@ -138,7 +138,7 @@ public:
|
||||||
|
|
||||||
// @todo bench that against CGAL::Inverse_index and std::unordered_map
|
// @todo bench that against CGAL::Inverse_index and std::unordered_map
|
||||||
boost::container::flat_map<vertex_descriptor, vertices_size_type> index_map;
|
boost::container::flat_map<vertex_descriptor, vertices_size_type> index_map;
|
||||||
m_writer.write_header(m_os, num_vertices(g), num_halfedges(g), num_faces(g),
|
m_writer.write_header(m_os, vertices(g).size(), halfedges(g).size(), faces(g).size(),
|
||||||
has_face_colors || has_vertex_colors,
|
has_face_colors || has_vertex_colors,
|
||||||
has_vertex_normals ,
|
has_vertex_normals ,
|
||||||
has_vertex_textures );
|
has_vertex_textures );
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ bool write_PLY(std::ostream& os,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "element vertex " << num_vertices(g) << std::endl;
|
os << "element vertex " << vertices(g).size() << std::endl;
|
||||||
IO::internal::output_property_header(os, make_ply_point_writer (CGAL::Identity_property_map<Point_3>()));
|
IO::internal::output_property_header(os, make_ply_point_writer (CGAL::Identity_property_map<Point_3>()));
|
||||||
//if vcm is not default add v:color property
|
//if vcm is not default add v:color property
|
||||||
if(has_vcolor)
|
if(has_vcolor)
|
||||||
|
|
@ -391,7 +391,7 @@ bool write_PLY(std::ostream& os,
|
||||||
<< "property uchar alpha" << std::endl;
|
<< "property uchar alpha" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "element face " << num_faces(g) << std::endl;
|
os << "element face " << faces(g).size() << std::endl;
|
||||||
IO::internal::output_property_header(
|
IO::internal::output_property_header(
|
||||||
os, std::make_pair(CGAL::Identity_property_map<std::vector<std::size_t> >(),
|
os, std::make_pair(CGAL::Identity_property_map<std::vector<std::size_t> >(),
|
||||||
PLY_property<std::vector<int> >("vertex_indices")));
|
PLY_property<std::vector<int> >("vertex_indices")));
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ void write_polys(std::ostream& os,
|
||||||
|
|
||||||
std::vector<std::size_t> connectivity_table;
|
std::vector<std::size_t> connectivity_table;
|
||||||
std::vector<std::size_t> offsets;
|
std::vector<std::size_t> offsets;
|
||||||
std::vector<unsigned char> cell_type(num_faces(g), 5); // triangle == 5
|
std::vector<unsigned char> cell_type(faces(g).size(), 5); // triangle == 5
|
||||||
|
|
||||||
std::size_t off = 0;
|
std::size_t off = 0;
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@ void write_polys_tag(std::ostream& os,
|
||||||
if(binary)
|
if(binary)
|
||||||
{
|
{
|
||||||
os << " offset=\"" << offset << "\"/>\n";
|
os << " offset=\"" << offset << "\"/>\n";
|
||||||
offset += (3 * num_faces(g)+ 1) * sizeof(std::size_t);
|
offset += (3 * faces(g).size() + 1) * sizeof(std::size_t);
|
||||||
// 3 indices (size_t) per triangle + length of the encoded data (size_t)
|
// 3 indices (size_t) per triangle + length of the encoded data (size_t)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -264,7 +264,7 @@ void write_polys_tag(std::ostream& os,
|
||||||
|
|
||||||
if(binary) { // if binary output, just write the xml tag
|
if(binary) { // if binary output, just write the xml tag
|
||||||
os << " offset=\"" << offset << "\"/>\n";
|
os << " offset=\"" << offset << "\"/>\n";
|
||||||
offset += (num_faces(g) + 1) * sizeof(std::size_t);
|
offset += (faces(g).size() + 1) * sizeof(std::size_t);
|
||||||
// 1 offset (size_t) per triangle + length of the encoded data (size_t)
|
// 1 offset (size_t) per triangle + length of the encoded data (size_t)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -287,13 +287,13 @@ void write_polys_tag(std::ostream& os,
|
||||||
if(binary)
|
if(binary)
|
||||||
{
|
{
|
||||||
os << " offset=\"" << offset << "\"/>\n";
|
os << " offset=\"" << offset << "\"/>\n";
|
||||||
offset += num_faces(g) + sizeof(std::size_t);
|
offset += faces(g).size() + sizeof(std::size_t);
|
||||||
// 1 unsigned char per cell + length of the encoded data (size_t)
|
// 1 unsigned char per cell + length of the encoded data (size_t)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
os << ">\n";
|
os << ">\n";
|
||||||
for(std::size_t i = 0; i< num_faces(g); ++i)
|
for(std::size_t i=0; i<faces(g).size(); ++i)
|
||||||
os << "5 ";
|
os << "5 ";
|
||||||
os << " </DataArray>\n";
|
os << " </DataArray>\n";
|
||||||
}
|
}
|
||||||
|
|
@ -332,7 +332,7 @@ void write_points_tag(std::ostream& os,
|
||||||
if(binary)
|
if(binary)
|
||||||
{
|
{
|
||||||
os << "\" offset=\"" << offset << "\"/>\n";
|
os << "\" offset=\"" << offset << "\"/>\n";
|
||||||
offset += 3 * num_vertices(g) * sizeof(FT) + sizeof(std::size_t);
|
offset += 3 * vertices(g).size() * sizeof(FT) + sizeof(std::size_t);
|
||||||
// 3 coords per points + length of the encoded data (size_t)
|
// 3 coords per points + length of the encoded data (size_t)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -456,8 +456,8 @@ bool write_VTP(std::ostream& os,
|
||||||
|
|
||||||
os << ">\n"
|
os << ">\n"
|
||||||
<< " <PolyData>" << "\n";
|
<< " <PolyData>" << "\n";
|
||||||
os << " <Piece NumberOfPoints=\"" << num_vertices(g)
|
os << " <Piece NumberOfPoints=\"" << vertices(g).size()
|
||||||
<< "\" NumberOfPolys=\"" << num_faces(g) << "\">\n";
|
<< "\" NumberOfPolys=\"" << faces(g).size() << "\">\n";
|
||||||
|
|
||||||
std::size_t offset = 0;
|
std::size_t offset = 0;
|
||||||
const bool binary = choose_parameter(get_parameter(np, internal_np::use_binary_mode), true);
|
const bool binary = choose_parameter(get_parameter(np, internal_np::use_binary_mode), true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue