------------------------------------------------------------------------------ Intersect this plane with finite line defined by p1 & p2 with tolerance tol.
| 1886 | // Intersect this plane with finite line defined by p1 & p2 with tolerance tol. |
| 1887 | // |
| 1888 | int vtkPolygon::IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, |
| 1889 | double x[3], double pcoords[3], int& subId) |
| 1890 | { |
| 1891 | double pt1[3], n[3]; |
| 1892 | double tol2 = tol * tol; |
| 1893 | double closestPoint[3]; |
| 1894 | double dist2; |
| 1895 | int npts = this->GetNumberOfPoints(); |
| 1896 | |
| 1897 | subId = 0; |
| 1898 | pcoords[0] = pcoords[1] = pcoords[2] = 0.0; |
| 1899 | |
| 1900 | // Define a plane to intersect with |
| 1901 | // |
| 1902 | this->Points->GetPoint(1, pt1); |
| 1903 | this->ComputeNormal(this->Points, n); |
| 1904 | |
| 1905 | // Intersect plane of the polygon with line |
| 1906 | // |
| 1907 | if (!vtkPlane::IntersectWithLine(p1, p2, n, pt1, t, x)) |
| 1908 | { |
| 1909 | return 0; |
| 1910 | } |
| 1911 | |
| 1912 | // Evaluate position |
| 1913 | // |
| 1914 | std::vector<double> weights(npts); |
| 1915 | if (this->EvaluatePosition(x, closestPoint, subId, pcoords, dist2, weights.data()) >= 0) |
| 1916 | { |
| 1917 | if (dist2 <= tol2) |
| 1918 | { |
| 1919 | return 1; |
| 1920 | } |
| 1921 | } |
| 1922 | return 0; |
| 1923 | } |
| 1924 | |
| 1925 | //------------------------------------------------------------------------------ |
| 1926 | int vtkPolygon::TriangulateLocalIds(int vtkNotUsed(index), vtkIdList* ptIds) |
no test coverage detected