FIX: crash when slicing(15%, generate perimeter)

github: 5037 and jira: 8182
Change-Id: I6719dc0cb4e5de808da14f9911cec19d4db9be3f
This commit is contained in:
zhimin.zeng 2024-10-22 19:41:35 +08:00 committed by Lane.Wei
parent b296537bbe
commit 10d576a301
1 changed files with 9 additions and 7 deletions

View File

@ -117,7 +117,7 @@ namespace detail {
// Return maximum two points, that are at distance "d" from both the line and point.
Intersections line_point_equal_distance_points(const Line &line, const Point &ipt, const double d)
{
{
assert(line.a != ipt && line.b != ipt);
// Calculating two points of distance "d" to a ray and a point.
// Point.
@ -667,10 +667,12 @@ void annotate_inside_outside(VD &vd, const Lines &lines)
// Set a VertexCategory, verify validity of the operation.
auto annotate_vertex = [](const VD::vertex_type *vertex, VertexCategory new_vertex_category) {
if (vertex == nullptr)
return;
#ifndef NDEBUG
VertexCategory vc = vertex_category(vertex);
assert(vc == VertexCategory::Unknown || vc == new_vertex_category);
assert(new_vertex_category == VertexCategory::Inside ||
assert(new_vertex_category == VertexCategory::Inside ||
new_vertex_category == VertexCategory::Outside ||
new_vertex_category == VertexCategory::OnContour);
#endif // NDEBUG
@ -1509,9 +1511,9 @@ Polygons offset(
}
Polygons offset(
const VD &vd,
const Lines &lines,
double offset_distance,
const VD &vd,
const Lines &lines,
double offset_distance,
double discretization_error)
{
annotate_inside_outside(const_cast<VD&>(vd), lines);
@ -1528,7 +1530,7 @@ Polygons offset(
// An infinite Voronoi Edge-Point (parabola) or Point-Point (line) bisector is split into
// a center part close to the Voronoi sites (not skeleton) and the ends (skeleton),
// though either part could be clipped by the Voronoi segment.
//
//
// Further filtering of the skeleton may be necessary.
std::vector<Vec2d> skeleton_edges_rough(
const VD &vd,
@ -1583,7 +1585,7 @@ std::vector<Vec2d> skeleton_edges_rough(
}
} else {
// An infinite Voronoi Edge-Point (parabola) or Point-Point (line) bisector, clipped to a finite Voronoi segment.
// The infinite bisector has a distance (skeleton radius) minimum, which is also a minimum
// The infinite bisector has a distance (skeleton radius) minimum, which is also a minimum
// of the skeleton function dr / dt.
assert(cell->contains_point() || cell2->contains_point());
if (cell->contains_point() != cell2->contains_point()) {