FIX: crash when slicing(15%, generate perimeter)
github: 5037 and jira: 8182 Change-Id: I6719dc0cb4e5de808da14f9911cec19d4db9be3f
This commit is contained in:
parent
b296537bbe
commit
10d576a301
|
@ -117,7 +117,7 @@ namespace detail {
|
||||||
|
|
||||||
// Return maximum two points, that are at distance "d" from both the line and point.
|
// 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)
|
Intersections line_point_equal_distance_points(const Line &line, const Point &ipt, const double d)
|
||||||
{
|
{
|
||||||
assert(line.a != ipt && line.b != ipt);
|
assert(line.a != ipt && line.b != ipt);
|
||||||
// Calculating two points of distance "d" to a ray and a point.
|
// Calculating two points of distance "d" to a ray and a point.
|
||||||
// Point.
|
// Point.
|
||||||
|
@ -667,10 +667,12 @@ void annotate_inside_outside(VD &vd, const Lines &lines)
|
||||||
|
|
||||||
// Set a VertexCategory, verify validity of the operation.
|
// Set a VertexCategory, verify validity of the operation.
|
||||||
auto annotate_vertex = [](const VD::vertex_type *vertex, VertexCategory new_vertex_category) {
|
auto annotate_vertex = [](const VD::vertex_type *vertex, VertexCategory new_vertex_category) {
|
||||||
|
if (vertex == nullptr)
|
||||||
|
return;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
VertexCategory vc = vertex_category(vertex);
|
VertexCategory vc = vertex_category(vertex);
|
||||||
assert(vc == VertexCategory::Unknown || vc == new_vertex_category);
|
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::Outside ||
|
||||||
new_vertex_category == VertexCategory::OnContour);
|
new_vertex_category == VertexCategory::OnContour);
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
|
@ -1509,9 +1511,9 @@ Polygons offset(
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygons offset(
|
Polygons offset(
|
||||||
const VD &vd,
|
const VD &vd,
|
||||||
const Lines &lines,
|
const Lines &lines,
|
||||||
double offset_distance,
|
double offset_distance,
|
||||||
double discretization_error)
|
double discretization_error)
|
||||||
{
|
{
|
||||||
annotate_inside_outside(const_cast<VD&>(vd), lines);
|
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
|
// 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),
|
// a center part close to the Voronoi sites (not skeleton) and the ends (skeleton),
|
||||||
// though either part could be clipped by the Voronoi segment.
|
// though either part could be clipped by the Voronoi segment.
|
||||||
//
|
//
|
||||||
// Further filtering of the skeleton may be necessary.
|
// Further filtering of the skeleton may be necessary.
|
||||||
std::vector<Vec2d> skeleton_edges_rough(
|
std::vector<Vec2d> skeleton_edges_rough(
|
||||||
const VD &vd,
|
const VD &vd,
|
||||||
|
@ -1583,7 +1585,7 @@ std::vector<Vec2d> skeleton_edges_rough(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// An infinite Voronoi Edge-Point (parabola) or Point-Point (line) bisector, clipped to a finite Voronoi segment.
|
// 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.
|
// of the skeleton function dr / dt.
|
||||||
assert(cell->contains_point() || cell2->contains_point());
|
assert(cell->contains_point() || cell2->contains_point());
|
||||||
if (cell->contains_point() != cell2->contains_point()) {
|
if (cell->contains_point() != cell2->contains_point()) {
|
||||||
|
|
Loading…
Reference in New Issue