mdally / Voronoi

C++ implementation of Fortune's Algorithm for computing bounded Voronoi diagrams
MIT License
25 stars 14 forks source link

Crash when a rectangle is added as outer boundary #10

Open UnrealDoggie opened 3 years ago

UnrealDoggie commented 3 years ago

Hi, I am trying to use the voronoi generator to get the generalized voronoi diagrams based on obstacles by breaking down to lines & then to points to fit into your generator. It works but when I add an outermost rectangle, the program crashes in function at about line 126.

treeNode VoronoiDiagramGenerator::addBeachSection(Site site) // one transition disappears 126 rSection->data.edge->setStartPoint(lSite, rSite, vertex);

Somehow rSection->data.edge is nullptr

// two new transitions appear at the new vertex location newSection->data.edge = diagram->createEdge(lSite, site, nullptr, vertex); 131 rSection->data.edge = diagram->createEdge(site, rSite, nullptr, vertex);

rSection->data.edge is immediately assigned by a new createEdge, so it seems line 126 is not needed anyway. Once I commented out Line 126, the program works as expected.

I m not sure if I hit some edge case or this is a bug. Please advise. Tks.

Regards