------------------------------------------------------------------------------
| 750 | |
| 751 | //------------------------------------------------------------------------------ |
| 752 | double vtkCellPicker::IntersectHyperTreeGridWithLine(const double p1[3], const double p2[3], |
| 753 | double t1, double t2, vtkAbstractHyperTreeGridMapper* mapper) |
| 754 | { |
| 755 | // Retrieve input grid |
| 756 | vtkUniformHyperTreeGrid* grid = vtkUniformHyperTreeGrid::SafeDownCast(mapper->GetDataSetInput()); |
| 757 | if (grid == nullptr) |
| 758 | { |
| 759 | // This picker works only with uniform hypertree grid inputs |
| 760 | return VTK_DOUBLE_MAX; |
| 761 | } |
| 762 | |
| 763 | // Retrieve grid dimensionality |
| 764 | unsigned int dimension = grid->GetDimension(); |
| 765 | if (dimension != 2) |
| 766 | { |
| 767 | // This picker works only with 2-dimensional uniform hypertree grids |
| 768 | return VTK_DOUBLE_MAX; |
| 769 | } |
| 770 | |
| 771 | // Retrieve grid topology and geometry |
| 772 | double origin[3]; |
| 773 | grid->GetOrigin(origin); |
| 774 | double scale[3]; |
| 775 | grid->GetGridScale(scale); |
| 776 | int extent[6]; |
| 777 | grid->GetExtent(extent); |
| 778 | |
| 779 | // Determine normal vector of the grid |
| 780 | double normal[] = { 0., 0., 0., 1. }; |
| 781 | unsigned int orientation = grid->GetOrientation(); |
| 782 | if (p1[orientation] - p2[orientation] > 0) |
| 783 | { |
| 784 | normal[orientation] = 1.; |
| 785 | normal[3] = 1.; |
| 786 | } |
| 787 | else |
| 788 | { |
| 789 | normal[orientation] = -1.; |
| 790 | normal[3] = -1.; |
| 791 | } |
| 792 | normal[3] += vtkMath::Dot(origin, normal); |
| 793 | double norm = vtkMath::Norm(normal); |
| 794 | normal[orientation] /= norm; |
| 795 | normal[3] /= norm; |
| 796 | |
| 797 | // Determine grid principal axes |
| 798 | unsigned axis1, axis2; |
| 799 | if (orientation == 2) |
| 800 | { |
| 801 | axis1 = 0; |
| 802 | axis2 = 1; |
| 803 | } |
| 804 | else if (orientation == 1) |
| 805 | { |
| 806 | axis1 = 0; |
| 807 | axis2 = 2; |
| 808 | } |
| 809 | else |
no test coverage detected