Skip to content

1.5.0 - #31

Merged
micycle1 merged 2 commits into
masterfrom
1.5.0
Mar 3, 2026
Merged

1.5.0#31
micycle1 merged 2 commits into
masterfrom
1.5.0

Conversation

@micycle1

Copy link
Copy Markdown
Owner

No description provided.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to prepare the "1.5.0" update by adjusting core geometry behavior (collinearity, offsets, clip “no-op” type), refactoring a few internals, and expanding the regression test suite around reported issues.

Changes:

  • Added regression tests for rect union-like behavior, collinearity edge cases, offset edge cases, and a macOS collinear union case.
  • Updated offset arc-tolerance defaults/auto-scaling behavior and tweaked concave-join point insertion.
  • Renamed ClipType.NoneClipType.NoClip, introduced Rect64.opAdd, refactored parts of ClipperD, ClipperBase, and Clipper.RDP.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/test/java/clipper2/TestRect.javaAdds tests for new Rect64.opAdd behavior.
src/test/java/clipper2/TestPolygons.javaAdds a regression test for collinear union behavior (macOS case).
src/test/java/clipper2/TestOffsets.javaAdds multiple offset regression tests; introduces PathsD usage in tests.
src/test/java/clipper2/TestIsCollinear.javaAdds collinearity regression tests using large integers and union behavior.
src/test/java/clipper2/ClipperFileIO.javaUpdates default clip type to new NoClip enum value.
src/main/java/clipper2/offset/ClipperOffset.javaChanges arc tolerance defaults/auto-scaling and concave join behavior.
src/main/java/clipper2/engine/ClipperD.javaRefactors precision-range error message and open-path scaling flow.
src/main/java/clipper2/engine/ClipperBase.javaUpdates no-op clip handling and changes split bookkeeping logic.
src/main/java/clipper2/core/Rect64.javaIntroduces Rect64.opAdd to combine rectangles.
src/main/java/clipper2/core/InternalClipper.javaRemoves a public constant and modifies exact-arithmetic collinearity helpers.
src/main/java/clipper2/core/ClipType.javaRenames “no operation” clip type from None to NoClip.
src/main/java/clipper2/Minkowski.javaMakes utility class final with a private constructor.
src/main/java/clipper2/Clipper.javaUpdates InflatePaths defaults and refactors RDP implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (x < 0) {
return -1;
}
return x > 1 ? 1 : 0;

CopilotAIMar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triSign is intended to return -1/0/1 based on the sign of x, but the current implementation returns 0 for x == 1 (because it checks x > 1). This will make productsAreEqual treat some positive products as having a zero sign (e.g., 110 vs 25), causing InternalClipper.IsCollinear to return false for collinear points. Update the condition to treat all x > 0 as positive.

Suggested change
returnx > 1 ? 1 : 0;
returnx > 0 ? 1 : 0;

Copilot uses AI. Check for mistakes.
@@ -8,7 +8,6 @@ public final class InternalClipper {
public static final double MIN_COORD = -MAX_COORD;
private static final long Invalid64 = Long.MAX_VALUE;

CopilotAIMar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the previously public InternalClipper.DEFAULT_ARC_TOLERANCE constant. If any downstream code depends on it (even just for configuring offsets), this will be a source/binary breaking change. Consider keeping the constant (possibly deprecated) or providing an equivalent public constant in the new location so consumers have a stable reference.

Suggested change
/**
* @deprecatedThisconstantiskeptforbackwardcompatibility.
* PreferconfiguringarctoleranceviathenewerAPIs
* whereavailable.
*/
@Deprecated
publicstaticfinaldoubleDEFAULT_ARC_TOLERANCE = 0.25;

Copilot uses AI. Check for mistakes.
Comment on lines 31 to 35
public enum ClipType {

None,
NoClip,
/** Preserves regions covered by both subject and clip polygons */
Intersection,

CopilotAIMar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming the public enum value ClipType.None to NoClip is a source- and binary-incompatible API change for any consumers referencing the old constant. If the goal is to improve naming, consider keeping None as a deprecated alias (and updating internal checks to treat both None and NoClip as the no-op value), or document this explicitly as a breaking change in release notes.

Copilot uses AI. Check for mistakes.
Comment on lines 19 to 33
@@ -28,7 +29,7 @@ public ClipperD() {
*/
public ClipperD(int roundingDecimalPrecision) {
if (roundingDecimalPrecision < -8 || roundingDecimalPrecision > 8) {
throw new IllegalArgumentException("Error - RoundingDecimalPrecision exceeds the allowed range.");
throw new IllegalArgumentException(PRECISION_RANGE_ERROR);
}

CopilotAIMar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new exception message "Error: Precision is out of range." loses useful context compared to the previous message (the parameter name and the allowed range -8..8). Consider including the valid range and/or the actual supplied value to make debugging invalid constructor arguments easier.

Copilot uses AI. Check for mistakes.
@micycle1
micycle1 merged commit 116b213 into masterMar 3, 2026
5 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@micycle1