Skip to content

Commit

Permalink
Fixed issue #1025.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Mar 23, 2024
1 parent be0fa94 commit 5e01e5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/org/nschmidt/ldparteditor/data/VM04Rectifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public int[] rectify(final RectifierSettings rs, boolean syncWithTextEditor, fin

final double targetAngle = rs.getMaximumAngle().doubleValue();
final boolean colourise = rs.isColourise();
final int scope = rs.getScope();

final BigDecimal two = new BigDecimal(2);

Expand All @@ -67,7 +68,7 @@ public int[] rectify(final RectifierSettings rs, boolean syncWithTextEditor, fin

final Set<GData> surfsToParse = new HashSet<>();

if (rs.getScope() == 0) {
if (scope == 0) {
surfsToParse.addAll(triangles.keySet());
surfsToParse.addAll(quads.keySet());
} else {
Expand Down Expand Up @@ -251,7 +252,7 @@ public void run(final IProgressMonitor monitor) throws InvocationTargetException
BigDecimal m2 = Vector3d.distSquare(new Vector3d(second), new Vector3d(fourth)).add(BigDecimal.ONE);
BigDecimal ratio = m1.compareTo(m2) > 0 ? m1.divide(m2, Threshold.MC) : m2.divide(m1, Threshold.MC);
// When both surfaces were selected, then prefer the selection over possible better unselected alternatives.
if (rs.getScope() == 1 && (bestRatioSelection == null || ratio.compareTo(bestRatioSelection) < 0) && surfsToParse.contains(tri1) && surfsToParse.contains(tri2)) {
if (scope == 1 && (bestRatioSelection == null || ratio.compareTo(bestRatioSelection) < 0) && surfsToParse.contains(tri1) && surfsToParse.contains(tri2)) {
bestRatioSelection = ratio;
bestIndex = i;
} else if (bestRatioSelection == null && (bestIndex == -1 || ratio.compareTo(bestRatio) < 0)) {
Expand Down Expand Up @@ -745,7 +746,7 @@ public void run(final IProgressMonitor monitor) throws InvocationTargetException
BigDecimal m2 = Vector3d.distSquare(new Vector3d(second), new Vector3d(fourth)).add(BigDecimal.ONE);
BigDecimal ratio = m1.compareTo(m2) > 0 ? m1.divide(m2, Threshold.MC) : m2.divide(m1, Threshold.MC);
// When both surfaces were selected, then prefer the selection over possible better unselected alternatives.
if (rs.getScope() == 1 && (bestRatioSelection == null || ratio.compareTo(bestRatioSelection) < 0) && surfsToParse.contains(tri1) && surfsToParse.contains(tri2)) {
if (scope == 1 && (bestRatioSelection == null || ratio.compareTo(bestRatioSelection) < 0) && surfsToParse.contains(tri1) && surfsToParse.contains(tri2)) {
bestRatioSelection = ratio;
bestIndex = i;
} else if (bestRatioSelection == null && (bestIndex == -1 || ratio.compareTo(bestRatio) < 0)) {
Expand Down

0 comments on commit 5e01e5a

Please # to comment.