| 70 | } |
| 71 | |
| 72 | bool MeshValidation::is_periodic( |
| 73 | const MatrixFr& vertices, const MatrixIr& faces) { |
| 74 | const Float EPS = 1e-6; |
| 75 | HashGrid::Ptr grid = compute_vertex_grid(vertices, EPS); |
| 76 | |
| 77 | Vector3F bbox_min = vertices.colwise().minCoeff(); |
| 78 | Vector3F bbox_max = vertices.colwise().maxCoeff(); |
| 79 | Vector3F bbox_size = bbox_max - bbox_min; |
| 80 | |
| 81 | Vector3F offsets[] = { |
| 82 | Vector3F( bbox_size[0], 0.0, 0.0), |
| 83 | Vector3F(-bbox_size[0], 0.0, 0.0), |
| 84 | Vector3F(0.0, bbox_size[1], 0.0), |
| 85 | Vector3F(0.0,-bbox_size[1], 0.0), |
| 86 | Vector3F(0.0, 0.0, bbox_size[2]), |
| 87 | Vector3F(0.0, 0.0,-bbox_size[2]) |
| 88 | }; |
| 89 | |
| 90 | bool result = true; |
| 91 | const size_t num_vertices = vertices.rows(); |
| 92 | for (size_t i=0; i<num_vertices; i++) { |
| 93 | const VectorF& v = vertices.row(i); |
| 94 | if (fabs(v[0] - bbox_min[0]) < EPS) { |
| 95 | result = result && match(grid, v + offsets[0]); |
| 96 | } |
| 97 | if (fabs(v[0] - bbox_max[0]) < EPS) { |
| 98 | result = result && match(grid, v + offsets[1]); |
| 99 | } |
| 100 | if (fabs(v[1] - bbox_min[1]) < EPS) { |
| 101 | result = result && match(grid, v + offsets[2]); |
| 102 | } |
| 103 | if (fabs(v[1] - bbox_max[1]) < EPS) { |
| 104 | result = result && match(grid, v + offsets[3]); |
| 105 | } |
| 106 | if (fabs(v[2] - bbox_min[2]) < EPS) { |
| 107 | result = result && match(grid, v + offsets[4]); |
| 108 | } |
| 109 | if (fabs(v[2] - bbox_max[2]) < EPS) { |
| 110 | result = result && match(grid, v + offsets[5]); |
| 111 | } |
| 112 | } |
| 113 | return result; |
| 114 | } |
| 115 | |
| 116 | bool MeshValidation::face_source_is_valid( |
| 117 | const MatrixFr& vertices, |
nothing calls this directly
no test coverage detected