Finished merging of bridging regions.
This commit is contained in:
parent
3a81e6bee4
commit
d2635ab799
3 changed files with 17 additions and 2 deletions
|
@ -271,7 +271,8 @@ template bool BoundingBoxBase<Pointf>::contains(const Pointf &point) const;
|
|||
template <class PointClass> bool
|
||||
BoundingBoxBase<PointClass>::overlap(const BoundingBoxBase<PointClass> &other) const
|
||||
{
|
||||
return this->contains(other.min) || other.contains(this->min);
|
||||
return ! (this->max.x < other.min.x || this->min.x > other.max.x ||
|
||||
this->max.y < other.min.y || this->min.y > other.max.y);
|
||||
}
|
||||
template bool BoundingBoxBase<Point>::overlap(const BoundingBoxBase<Point> &point) const;
|
||||
template bool BoundingBoxBase<Pointf>::overlap(const BoundingBoxBase<Pointf> &point) const;
|
||||
|
|
|
@ -165,8 +165,22 @@ ExPolygon::has_boundary_point(const Point &point) const
|
|||
bool
|
||||
ExPolygon::overlaps(const ExPolygon &other) const
|
||||
{
|
||||
#if 0
|
||||
BoundingBox bbox = get_extents(other);
|
||||
bbox.merge(get_extents(*this));
|
||||
static int iRun = 0;
|
||||
char path[2048];
|
||||
sprintf(path, "out\\ExPolygon_overlaps-%d.svg", iRun ++);
|
||||
SVG svg(path, bbox);
|
||||
svg.draw(*this);
|
||||
svg.draw_outline(*this);
|
||||
svg.draw_outline(other, "blue");
|
||||
#endif
|
||||
Polylines pl_out;
|
||||
intersection((Polylines)other, *this, &pl_out);
|
||||
#if 0
|
||||
svg.draw(pl_out, "red");
|
||||
#endif
|
||||
if (! pl_out.empty())
|
||||
return true;
|
||||
return ! other.contour.points.empty() && this->contains_b(other.contour.points.front());
|
||||
|
|
|
@ -38,7 +38,7 @@ class ExPolygon
|
|||
// Does this expolygon overlap another expolygon?
|
||||
// Either the ExPolygons intersect, or one is fully inside the other,
|
||||
// and it is not inside a hole of the other expolygon.
|
||||
bool overlap(const ExPolygon &other) const;
|
||||
bool overlaps(const ExPolygon &other) const;
|
||||
|
||||
void simplify_p(double tolerance, Polygons* polygons) const;
|
||||
Polygons simplify_p(double tolerance) const;
|
||||
|
|
Loading…
Reference in a new issue