| 591 | } |
| 592 | |
| 593 | bool vtkCellPicker::IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], |
| 594 | const double p2[3], double t1, double t2, double tol, vtkAbstractCellLocator*& locator, |
| 595 | vtkIdType& minCellId, int& minSubId, double& tMin, double& pDistMin, double minXYZ[3], |
| 596 | double minPCoords[3]) |
| 597 | { |
| 598 | bool cellWasPicked = false; |
| 599 | // Polydata has no 3D cells |
| 600 | vtkTypeBool isPolyData = dataSet->IsA("vtkPolyData"); |
| 601 | |
| 602 | // Make a new p1 and p2 using the clipped t1 and t2 |
| 603 | double q1[3], q2[3]; |
| 604 | q1[0] = p1[0]; |
| 605 | q1[1] = p1[1]; |
| 606 | q1[2] = p1[2]; |
| 607 | q2[0] = p2[0]; |
| 608 | q2[1] = p2[1]; |
| 609 | q2[2] = p2[2]; |
| 610 | if (t1 != 0.0 || t2 != 1.0) |
| 611 | { |
| 612 | for (int j = 0; j < 3; j++) |
| 613 | { |
| 614 | q1[j] = p1[j] * (1.0 - t1) + p2[j] * t1; |
| 615 | q2[j] = p1[j] * (1.0 - t2) + p2[j] * t2; |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | // Use the locator if one exists for this data |
| 620 | vtkCollectionSimpleIterator iter; |
| 621 | locator = nullptr; |
| 622 | this->Locators->InitTraversal(iter); |
| 623 | while ( |
| 624 | (locator = static_cast<vtkAbstractCellLocator*>(this->Locators->GetNextItemAsObject(iter)))) |
| 625 | { |
| 626 | if (locator->GetDataSet() == dataSet) |
| 627 | { |
| 628 | break; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | if (locator) |
| 633 | { |
| 634 | double t = tMin; |
| 635 | double xyz[3]; |
| 636 | double pcoords[3]; |
| 637 | int subId; |
| 638 | vtkIdType cellId; |
| 639 | if (locator->IntersectWithLine(q1, q2, tol, t, xyz, pcoords, subId, cellId, this->Cell)) |
| 640 | { |
| 641 | // Stretch t out to the original range |
| 642 | if (t1 != 0.0 || t2 != 1.0) |
| 643 | { |
| 644 | t = t1 * (1.0 - t) + t2 * t; |
| 645 | } |
| 646 | |
| 647 | // If cell is a strip, then replace cell with a sub-cell |
| 648 | vtkCellPicker::SubCellFromCell(this->Cell, subId); |
| 649 | |
| 650 | if (t <= (tMin + this->Tolerance) && t >= t1 && t <= t2) |
no test coverage detected