| 114 | } |
| 115 | |
| 116 | SymmetryOperators::SymmetryConnectivity SymmetryOperators::compute_vertex_connectivity( |
| 117 | const MatrixFr& vertices, SymmetryOperators::Operators& ops) { |
| 118 | const Float tol = 1e-12; |
| 119 | const size_t num_vertices = vertices.rows(); |
| 120 | const Float cell_size = 1e-6; |
| 121 | HashGrid::Ptr grid = compute_vertex_lookup_grid(vertices, cell_size); |
| 122 | |
| 123 | SymmetryConnectivity connectivity(num_vertices); |
| 124 | for (auto& op : ops) { |
| 125 | for (size_t i=0; i<num_vertices; i++) { |
| 126 | const VectorF& curr_p = vertices.row(i); |
| 127 | VectorF mapped_p = op(curr_p); |
| 128 | VectorI candidates = grid->get_items_near_point(mapped_p); |
| 129 | const size_t num_candidates = candidates.size(); |
| 130 | for (size_t j=0; j<num_candidates; j++) { |
| 131 | const VectorF& other_p = vertices.row(candidates[j]); |
| 132 | Float squared_dist = (mapped_p - other_p).squaredNorm(); |
| 133 | if (squared_dist < tol) { |
| 134 | connectivity[i].insert(candidates[j]); |
| 135 | connectivity[candidates[j]].insert(i); |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | return connectivity; |
| 141 | } |
| 142 | |
| 143 | //SymmetryOperators::SymmetryConnectivity SymmetryOperators::compute_vertex_connectivity( |
| 144 | // const MatrixFr& vertices, SymmetryOperators::Operators& ops) { |
nothing calls this directly
no test coverage detected