------------------------------------------------------------------------------
| 130 | |
| 131 | //------------------------------------------------------------------------------ |
| 132 | void vtkLinearSelector::SeekIntersectingCells(vtkDataSet* input, vtkIdTypeArray* outIndices) |
| 133 | { |
| 134 | vtkIdType nSegments = this->Points ? this->Points->GetNumberOfPoints() - 1 : 1; |
| 135 | |
| 136 | // Reject meaningless parameterizations |
| 137 | if (nSegments < 1) |
| 138 | { |
| 139 | vtkWarningMacro(<< "Cannot intersect: not enough points to define a broken line."); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | // Prepare lists of start and end points |
| 144 | vtkIdType nCoords = 3 * nSegments; |
| 145 | double* startPoints = new double[nCoords]; |
| 146 | double* endPoints = new double[nCoords]; |
| 147 | |
| 148 | if (this->Points) |
| 149 | { |
| 150 | // Prepare and store segment vertices |
| 151 | if (this->IncludeVertices) |
| 152 | { |
| 153 | // Vertices are included, use full segment extent |
| 154 | for (vtkIdType i = 0; i < nSegments; ++i) |
| 155 | { |
| 156 | vtkIdType offset = 3 * i; |
| 157 | this->Points->GetPoint(i, startPoints + offset); |
| 158 | this->Points->GetPoint(i + 1, endPoints + offset); |
| 159 | std::cerr << i - 1 << ": " << startPoints[offset] << " " << startPoints[offset + 1] << " " |
| 160 | << startPoints[offset + 2] << "\n"; |
| 161 | } |
| 162 | } // if ( this->IncludeVertices ) |
| 163 | else |
| 164 | { |
| 165 | // Vertices are excluded, reduce segment by given ratio |
| 166 | for (vtkIdType i = 0; i < nSegments; ++i) |
| 167 | { |
| 168 | vtkIdType offset = 3 * i; |
| 169 | this->Points->GetPoint(i, startPoints + offset); |
| 170 | this->Points->GetPoint(i + 1, endPoints + offset); |
| 171 | for (int j = 0; j < 3; ++j, ++offset) |
| 172 | { |
| 173 | double delta = |
| 174 | this->VertexEliminationTolerance * (endPoints[offset] - startPoints[offset]); |
| 175 | startPoints[offset] += delta; |
| 176 | endPoints[offset] -= delta; |
| 177 | } // for ( j ) |
| 178 | } // for ( i ) |
| 179 | } // else |
| 180 | } // if ( this->Points ) |
| 181 | else // if ( this->Points ) |
| 182 | { |
| 183 | // Prepare and store segment vertices |
| 184 | if (this->IncludeVertices) |
| 185 | { |
| 186 | // Vertices are included, use full segment extent |
| 187 | for (int i = 0; i < 3; ++i) |
| 188 | { |
| 189 | startPoints[i] = this->StartPoint[i]; |
no test coverage detected