Add new cells to the mapping data array attached to the intersection lines
| 1257 | |
| 1258 | // Add new cells to the mapping data array attached to the intersection lines |
| 1259 | void vtkIntersectionPolyDataFilter::Impl::AddToNewCellMap( |
| 1260 | int inputIndex, int interPtCount, int interPts[3], vtkPolyData* interLines, int numCurrCells) |
| 1261 | { |
| 1262 | vtkIdList** cellIds; |
| 1263 | cellIds = new vtkIdList*[interPtCount]; |
| 1264 | for (int i = 0; i < interPtCount; i++) |
| 1265 | { |
| 1266 | cellIds[i] = vtkIdList::New(); |
| 1267 | vtkSmartPointer<vtkIdList> temp = vtkSmartPointer<vtkIdList>::New(); |
| 1268 | interLines->GetPointCells(interPts[i], cellIds[i]); |
| 1269 | if (i > 0) |
| 1270 | { |
| 1271 | temp->DeepCopy(cellIds[i - 1]); |
| 1272 | temp->IntersectWith(cellIds[i]); |
| 1273 | } |
| 1274 | if (temp->GetNumberOfIds() > 0) |
| 1275 | { |
| 1276 | // For each id |
| 1277 | for (int j = 0; j < temp->GetNumberOfIds(); j++) |
| 1278 | { |
| 1279 | // If it hasn't already been set |
| 1280 | if (this->NewCellIds[inputIndex]->GetComponent(temp->GetId(j), 0) == -1) |
| 1281 | { |
| 1282 | // Add to new cell mapping data array on intersection lines |
| 1283 | this->NewCellIds[inputIndex]->InsertComponent(temp->GetId(j), 0, numCurrCells); |
| 1284 | } |
| 1285 | else |
| 1286 | { |
| 1287 | // Add to new cell mapping data array on intersection lines |
| 1288 | this->NewCellIds[inputIndex]->InsertComponent(temp->GetId(j), 1, numCurrCells); |
| 1289 | } |
| 1290 | } |
| 1291 | } |
| 1292 | } |
| 1293 | // If number of intersection points is more than two, intersection line |
| 1294 | if (interPtCount > 2) |
| 1295 | { |
| 1296 | cellIds[0]->IntersectWith(cellIds[interPtCount - 1]); |
| 1297 | if (cellIds[0]->GetNumberOfIds() > 0) |
| 1298 | { |
| 1299 | for (int j = 0; j < cellIds[0]->GetNumberOfIds(); j++) |
| 1300 | { |
| 1301 | if (this->NewCellIds[inputIndex]->GetComponent(cellIds[0]->GetId(j), 0) == -1) |
| 1302 | { |
| 1303 | // Add to new cell mapping data array on intersection lines |
| 1304 | this->NewCellIds[inputIndex]->InsertComponent(cellIds[0]->GetId(j), 0, numCurrCells); |
| 1305 | } |
| 1306 | else |
| 1307 | { |
| 1308 | // Add to new cell mapping data array on intersection lines |
| 1309 | this->NewCellIds[inputIndex]->InsertComponent(cellIds[0]->GetId(j), 1, numCurrCells); |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | } |
| 1314 | for (int i = 0; i < interPtCount; i++) |
| 1315 | { |
| 1316 | cellIds[i]->Delete(); |
no test coverage detected