| 201 | } |
| 202 | |
| 203 | void TriangleMesh::init_boundary_node_adjacencies() { |
| 204 | const size_t num_boundary_edges = m_boundary_edges.rows(); |
| 205 | const size_t num_boundary_vertices = m_boundary.size(); |
| 206 | std::vector<std::set<size_t> > bd_vertex_adjacencies(num_boundary_vertices); |
| 207 | for (size_t i=0; i<num_boundary_edges; i++) { |
| 208 | const VectorI& edge = m_boundary_edges.row(i); |
| 209 | bd_vertex_adjacencies[edge[0]].insert(edge[1]); |
| 210 | bd_vertex_adjacencies[edge[1]].insert(edge[0]); |
| 211 | } |
| 212 | |
| 213 | std::vector<size_t> adj; |
| 214 | std::vector<size_t> adj_idx; |
| 215 | adj_idx.push_back(0); |
| 216 | for (size_t i=0; i<num_boundary_vertices; i++) { |
| 217 | const std::set<size_t>& neighbors = bd_vertex_adjacencies[i]; |
| 218 | adj.insert(adj.end(), neighbors.begin(), neighbors.end()); |
| 219 | adj_idx.push_back(adj.size()); |
| 220 | } |
| 221 | |
| 222 | m_boundary_node_adj.resize(adj.size()); |
| 223 | std::copy(adj.begin(), adj.end(), m_boundary_node_adj.data()); |
| 224 | |
| 225 | m_boundary_node_adj_idx.resize(adj_idx.size()); |
| 226 | std::copy(adj_idx.begin(), adj_idx.end(), m_boundary_node_adj_idx.data()); |
| 227 | } |
| 228 | |
| 229 | void TriangleMesh::init_boundary_face_adjacencies() { |
| 230 | const size_t num_boundary_edges = m_boundary_edges.rows(); |