Skip to content

Update SwiftClipper to use Doubles and fix some issues#7

Open
Cyberax wants to merge 1 commit intolhuanyu:masterfrom
Cyberax:master
Open

Update SwiftClipper to use Doubles and fix some issues#7
Cyberax wants to merge 1 commit intolhuanyu:masterfrom
Cyberax:master

Conversation

@Cyberax
Copy link
Copy Markdown

@Cyberax Cyberax commented Nov 26, 2025

This change updates SwiftClipper to use Double precision for all the calculations. This can break on 32-bit builds because CGPoint uses single-precision floats on 32-bit targets.

There also were several bugfixes:

  1. Path orientation was always positive because the area method used abs(). I replaced it with a signedArea method.
  2. parseFirstLeft method can return nils, so I removed unwrapping from it.

I also fixed the tests to utilize the full un-rounded precision.

This change updates SwiftClipper to use Double precision for all the
calculations. This can break on 32-bit builds because CGPoint uses
single-precision floats on 32-bit targets.

There also were several bugfixes:
1. Path orientation was always `positive` because the `area` method used
   `abs()`. I replaced it with a `signedArea` method.
2. `parseFirstLeft` method can return `nil`s, so I removed unwrapping
   from it.
Sign up for free to 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.

1 participant