| 175 | } |
| 176 | |
| 177 | int vtkHigherOrderCurve::IntersectWithLine( |
| 178 | const double* p1, const double* p2, double tol, double& t, double* x, double* pcoords, int& subId) |
| 179 | { |
| 180 | vtkIdType nseg = vtkHigherOrderInterpolation::NumberOfIntervals<1>(this->GetOrder()); |
| 181 | double tFirst = VTK_DOUBLE_MAX; |
| 182 | bool intersection = false; |
| 183 | vtkVector3d tmpX; |
| 184 | vtkVector3d tmpP; |
| 185 | int tmpId; |
| 186 | for (int i = 0; i < nseg; ++i) |
| 187 | { |
| 188 | vtkLine* approx = this->GetApproximateLine(i); |
| 189 | if (approx->IntersectWithLine(p1, p2, tol, t, tmpX.GetData(), tmpP.GetData(), tmpId)) |
| 190 | { |
| 191 | // Record the point closest to p1 in the direction of p2 unless there is no other |
| 192 | // intersection, in which case we will report a point "before" p1 (further from p2 than p1). |
| 193 | if (!intersection || (t >= 0 && (t < tFirst || tFirst < 0))) |
| 194 | { |
| 195 | tFirst = t; |
| 196 | subId = i; |
| 197 | for (int ii = 0; ii < 3; ++ii) |
| 198 | { |
| 199 | x[ii] = tmpX[ii]; |
| 200 | pcoords[ii] = tmpP[ii]; // Translate this after we're sure it's the closest hit. |
| 201 | } |
| 202 | } |
| 203 | intersection = true; |
| 204 | } |
| 205 | } |
| 206 | if (intersection) |
| 207 | { |
| 208 | intersection &= this->TransformApproxToCellParams(subId, pcoords); |
| 209 | t = tFirst; |
| 210 | } |
| 211 | return intersection ? 1 : 0; |
| 212 | } |
| 213 | |
| 214 | int vtkHigherOrderCurve::TriangulateLocalIds(int vtkNotUsed(index), vtkIdList* ptIds) |
| 215 | { |
nothing calls this directly
no test coverage detected