Skip to content

Commit

Permalink
add tolerance to getSelfIntersectionPoints
Browse files Browse the repository at this point in the history
  • Loading branch information
qcad committed Jun 17, 2021
1 parent f574361 commit 930cfe5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/core/math/RPolyline.cpp
Expand Up @@ -783,7 +783,7 @@ bool RPolyline::toLogicallyOpen() {
return true;
}

QList<RVector> RPolyline::getSelfIntersectionPoints() const {
QList<RVector> RPolyline::getSelfIntersectionPoints(double tolerance) const {
QList<RVector> ret;

bool cl = isGeometricallyClosed();
Expand All @@ -798,13 +798,13 @@ QList<RVector> RPolyline::getSelfIntersectionPoints() const {
QList<RVector> ips = segment->getIntersectionPoints(*otherSegment);
for (int n=0; n<ips.length(); n++) {
RVector ip = ips[n];
if (k==i+1 && ip.equalsFuzzy(segment->getEndPoint())) {
if (k==i+1 && ip.equalsFuzzy(segment->getEndPoint(), tolerance)) {
// ignore intersection at vertex between two consecutive segments:
continue;
}

if (cl) {
if (i==0 && k==segments.length()-1 && ip.equalsFuzzy(segment->getStartPoint())) {
if (i==0 && k==segments.length()-1 && ip.equalsFuzzy(segment->getStartPoint(), tolerance)) {
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/math/RPolyline.h
Expand Up @@ -134,7 +134,7 @@ class QCADCORE_EXPORT RPolyline: public RShape, public RExplodable {
bool toLogicallyClosed(double tolerance=RS::PointTolerance);
bool toLogicallyOpen();

QList<RVector> getSelfIntersectionPoints() const;
QList<RVector> getSelfIntersectionPoints(double tolerance=RS::PointTolerance) const;

RS::Orientation getOrientation(bool implicitelyClosed = false) const;
bool setOrientation(RS::Orientation orientation);
Expand Down
4 changes: 2 additions & 2 deletions src/entity/RPolylineEntity.h
Expand Up @@ -293,8 +293,8 @@ class QCADENTITY_EXPORT RPolylineEntity: public REntity {
return data.toLogicallyOpen();
}

QList<RVector> getSelfIntersectionPoints() const {
return data.getSelfIntersectionPoints();
QList<RVector> getSelfIntersectionPoints(double tolerance=RS::PointTolerance) const {
return data.getSelfIntersectionPoints(tolerance);
}

RS::Orientation getOrientation(bool implicitelyClosed = false) const {
Expand Down

0 comments on commit 930cfe5

Please sign in to comment.