------------------------------------------------------------------------------ Clip this triangle using scalar value provided. Like contouring, except that it cuts the triangle to produce other triangles.
| 983 | // Clip this triangle using scalar value provided. Like contouring, except |
| 984 | // that it cuts the triangle to produce other triangles. |
| 985 | void vtkTriangle::Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator, |
| 986 | vtkCellArray* tris, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, |
| 987 | vtkCellData* outCd, int insideOut) |
| 988 | { |
| 989 | constexpr int CASE_MASK[3] = { 1, 2, 4 }; |
| 990 | const TRIANGLE_CASES* triangleCase; |
| 991 | const TRIANGLE_EDGE_LIST* edge; |
| 992 | int i, index; |
| 993 | const vtkIdType* vert; |
| 994 | int e1, e2, newCellId; |
| 995 | vtkIdType pts[3]; |
| 996 | int vertexId; |
| 997 | double t, x1[3], x2[3], x[3], deltaScalar; |
| 998 | |
| 999 | // Build the case table |
| 1000 | if (insideOut) |
| 1001 | { |
| 1002 | for (i = 0, index = 0; i < 3; i++) |
| 1003 | { |
| 1004 | if (cellScalars->GetComponent(i, 0) <= value) |
| 1005 | { |
| 1006 | index |= CASE_MASK[i]; |
| 1007 | } |
| 1008 | } |
| 1009 | } |
| 1010 | else |
| 1011 | { |
| 1012 | for (i = 0, index = 0; i < 3; i++) |
| 1013 | { |
| 1014 | if (cellScalars->GetComponent(i, 0) > value) |
| 1015 | { |
| 1016 | index |= CASE_MASK[i]; |
| 1017 | } |
| 1018 | } |
| 1019 | } |
| 1020 | |
| 1021 | // Select the case based on the index and get the list of edges for this case |
| 1022 | triangleCase = triangleCases + index; |
| 1023 | edge = triangleCase->edges; |
| 1024 | |
| 1025 | // generate each triangle |
| 1026 | for (; edge[0] > -1; edge += 3) |
| 1027 | { |
| 1028 | for (i = 0; i < 3; i++) // insert triangle |
| 1029 | { |
| 1030 | // vertex exists, and need not be interpolated |
| 1031 | if (edge[i] >= 100) |
| 1032 | { |
| 1033 | vertexId = edge[i] - 100; |
| 1034 | this->Points->GetPoint(vertexId, x); |
| 1035 | if (locator->InsertUniquePoint(x, pts[i])) |
| 1036 | { |
| 1037 | outPd->CopyData(inPd, this->PointIds->GetId(vertexId), pts[i]); |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | else // new vertex, interpolate |
| 1042 | { |
nothing calls this directly
no test coverage detected