| 79 | } |
| 80 | |
| 81 | void POLYParser::parse_faces(std::ifstream& fin) { |
| 82 | size_t num_faces, bd_marker; |
| 83 | fin >> num_faces >> bd_marker; |
| 84 | |
| 85 | for (size_t i=0; i<num_faces; i++) { |
| 86 | assert(fin.good()); |
| 87 | std::string line = IOUtils::next_line(fin); |
| 88 | size_t num_poly=0, num_holes=0, bd=0; |
| 89 | size_t n = sscanf(line.c_str(), "%zi %zi %zi", |
| 90 | &num_poly, &num_holes, &bd); |
| 91 | assert(n >= 1); |
| 92 | for (size_t j=0; j<num_poly; j++) { |
| 93 | size_t num_corners; |
| 94 | fin >> num_corners; |
| 95 | if (i == 0 && j == 0) { |
| 96 | m_vertex_per_face = num_corners; |
| 97 | } else if (num_corners != m_vertex_per_face) { |
| 98 | throw NotImplementedError("Mixed faces is not supported!"); |
| 99 | } |
| 100 | |
| 101 | for (size_t k=0; k<num_corners; k++) { |
| 102 | size_t corner; |
| 103 | fin >> corner; |
| 104 | m_faces.push_back(corner); |
| 105 | } |
| 106 | } |
| 107 | assert(fin.good()); |
| 108 | for (size_t j=0; j<num_holes; j++) { |
| 109 | size_t hole_index; |
| 110 | float x,y,z; |
| 111 | fin >> hole_index >> x >> y >> z; |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 |
nothing calls this directly
no test coverage detected