Skip to content

Commit

Permalink
- ImageLinePruneMerge
Browse files Browse the repository at this point in the history
  * Fixed NPE introduced in the previous fix that was somehow missed
  • Loading branch information
lessthanoptimal committed May 20, 2023
1 parent 725d5fd commit e36cc36
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions change.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change Log

Date Format: year/month/day
---------------------------------------------
Date : 2023/??
Version : 0.44

- ImageLinePruneMerge
* Fixed NPE introduced in the previous fix that was somehow missed

---------------------------------------------
Date : 2023/May/15
Version : 0.43
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,27 @@ public void pruneSimilar( float toleranceAngle, float toleranceDist, int imgWidt
Data d = lines.get(i);
LineParametric2D_F32 l = d.line;
theta[i] = UtilAngle.atanSafe(l.getSlopeY(), l.getSlopeX());
segments.get(i).setTo(LineImageOps.convert(l, imgWidth, imgHeight));
LineSegment2D_F32 converted = LineImageOps.convert(l, imgWidth, imgHeight);

// mark the segment as bad
if (converted == null)
segments.get(i).a.x = Float.NaN;
else
segments.get(i).setTo(converted);
}

for (int i = 0; i < segments.size(); i++) {
LineSegment2D_F32 a = segments.get(i);
if (a == null) continue;

// see if it was marked bad previously
if (Float.isNaN(a.a.x))
continue;

for (int j = i + 1; j < segments.size(); j++) {
LineSegment2D_F32 b = segments.get(j);

if (b == null)
// see if it was marked bad previously
if (Float.isNaN(b.a.x))
continue;

// see if they are nearly parallel
Expand Down

0 comments on commit e36cc36

Please sign in to comment.