Skip to content

Commit

Permalink
fix segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy84 committed Jan 6, 2025
1 parent 26f7d8e commit 1e9c1e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion vtkPolyDataContactFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,9 @@ void PreventEqualCaptPoints::Run () {
WriteVTK("captB.vtk", pdB);
#endif

pdA->BuildLinks();
pdB->BuildLinks();

Find(pdA, pdB, "A");

#ifdef _DEBUG
Expand Down Expand Up @@ -1098,10 +1101,12 @@ void PreventEqualCaptPoints::Find (vtkPolyData *pd, vtkPolyData *other, [[maybe_

double tr[2];

#ifdef _DEBUG
auto pdVerts = vtkSmartPointer<vtkPolyData>::New();
pdVerts->Allocate(1);

auto ptsVerts = vtkSmartPointer<vtkPoints>::New();
#endif

std::map<vtkIdType, std::vector<SnapPoint>> pointSnaps;
std::map<Point3d, std::vector<SnapEdge>> edgeSnaps;
Expand Down Expand Up @@ -1136,10 +1141,12 @@ void PreventEqualCaptPoints::Find (vtkPolyData *pd, vtkPolyData *other, [[maybe_
Point3d sB(tr[0], tr[1], 0);

if (PointInPoly(polyB, sB)) {
#ifdef _DEBUG
auto vert = vtkSmartPointer<vtkIdList>::New();
vert->InsertNextId(ptsVerts->InsertNextPoint(pt));

pdVerts->InsertNextCell(VTK_VERTEX, vert);
#endif

// snap auf ecke oder kante?

Expand Down Expand Up @@ -1364,9 +1371,9 @@ void PreventEqualCaptPoints::Find (vtkPolyData *pd, vtkPolyData *other, [[maybe_

other->RemoveDeletedCells();

#ifdef _DEBUG
pdVerts->SetPoints(ptsVerts);

#ifdef _DEBUG
auto fileName = "verts" + name + ".vtk";

WriteVTK(fileName.c_str(), pdVerts);
Expand Down

0 comments on commit 1e9c1e8

Please sign in to comment.