Commit c6fdceaf authored by Kenneth Moreland's avatar Kenneth Moreland

Fix an error in the clip tables

There was an error in the clip tables for clipping lines. It was
referring to edge 1 for one of the case, but of course a line has only 1
edge at index 0. Fix the error in the clipping table and also add a
check for if we get an index to an invalid line.
parent fe1c7c32
Pipeline #44078 passed with stage
......@@ -328,6 +328,9 @@ public:
{
internal::ClipTables::EdgeVec edge =
this->ClipTables.GetEdge(shape.Id, entry);
// Sanity check to make sure the edge is valid.
VTKM_ASSERT(edge[0] != 255);
VTKM_ASSERT(edge[1] != 255);
EdgeInterpolation ei;
ei.Vertex1 = indices[edge[0]];
......
......@@ -39,7 +39,7 @@ static vtkm::UInt8 ClipTablesData[] = {
1, 1, 1, 100, // 1
// vtkm::CELL_SHAPE_LINE
0, // 0
1, 3, 2, 100, 1, // 1
1, 3, 2, 100, 0, // 1
1, 3, 2, 0, 101, // 2
1, 3, 2, 100, 101, // 3
// vtkm::CELL_SHAPE_TRIANGLE
......@@ -1616,38 +1616,40 @@ enum {
CELL_EDGES_SIZE = vtkm::NUMBER_OF_CELL_SHAPES * MAX_CELL_EDGES * 2
};
#define X 255
static vtkm::UInt8 CellEdges[CELL_EDGES_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_EMPTY_CELL
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_VERTEX
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_POLY_VERTEX
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_LINE
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_POLY_LINE
0, 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_TRIANGLE
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_TRIANGLE_STRIP
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_POLYGON
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_PIXEL
0, 1, 1, 2, 3, 2, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_QUAD
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_EMPTY_CELL
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_VERTEX
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_POLY_VERTEX
0, 1, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_LINE
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_POLY_LINE
0, 1, 1, 2, 2, 0, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_TRIANGLE
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_TRIANGLE_STRIP
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_POLYGON
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_PIXEL
0, 1, 1, 2, 3, 2, 0, 3, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_QUAD
0, 1, 1, 2, 2, 0, 0, 3, 1, 3, 2, 3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_TETRA
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_VOXEL
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_TETRA
X, X, X, X, X, X, X, X, X, X, X, X,
X, X, X, X, X, X, X, X, X, X, X, X, // vtkm::CELL_SHAPE_VOXEL
0, 1, 1, 2, 3, 2, 0, 3, 4, 5, 5, 6,
7, 6, 4, 7, 0, 4, 1, 5, 3, 7, 2, 6, // vtkm::CELL_SHAPE_HEXAHEDRON
0, 1, 1, 2, 2, 0, 3, 4, 4, 5, 5, 3,
0, 3, 1, 4, 2, 5, 0, 0, 0, 0, 0, 0, // vtkm::CELL_SHAPE_WEDGE
0, 3, 1, 4, 2, 5, X, X, X, X, X, X, // vtkm::CELL_SHAPE_WEDGE
0, 1, 1, 2, 2, 3, 3, 0, 0, 4, 1, 4,
2, 4, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0 // vtkm::CELL_SHAPE_PYRAMID
2, 4, 3, 4, X, X, X, X, X, X, X, X // vtkm::CELL_SHAPE_PYRAMID
};
#undef X
// index into ClipTablesIndices for each shape
VTKM_EXEC_CONSTANT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment