MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / parse_vertices

Method parse_vertices

src/IO/POLYParser.cpp:49–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void POLYParser::parse_vertices(std::ifstream& fin) {
50 std::string header = IOUtils::next_line(fin);
51 size_t num_vertices, dim, num_attributes, bd_marker;
52 sscanf(header.c_str(), "%zi %zi %zi %zi",
53 &num_vertices, &dim, &num_attributes, &bd_marker);
54
55 if (dim != 3) {
56 throw IOError("Dim is not 3!");
57 }
58
59 m_vertices.resize(num_vertices * dim);
60 for (size_t i=0; i<num_vertices; i++) {
61 assert(fin.good());
62 size_t index;
63 Float x,y,z;
64 fin >> index >> x >> y >> z;
65 assert(index >= 0);
66 assert(index < num_vertices);
67 m_vertices[index*3 ] = x;
68 m_vertices[index*3+1] = y;
69 m_vertices[index*3+2] = z;
70 for (size_t j=0; j<num_attributes; j++) {
71 Float attr;
72 fin >> attr;
73 }
74 if (bd_marker == 1) {
75 Float bd;
76 fin >> bd;
77 }
78 }
79}
80
81void POLYParser::parse_faces(std::ifstream& fin) {
82 size_t num_faces, bd_marker;

Callers

nothing calls this directly

Calls 2

IOErrorClass · 0.85
next_lineFunction · 0.70

Tested by

no test coverage detected