polybool
0.2.0, released 4 years ago by an unverified publisher
Boolean operations on polygons (union, intersection, difference, xor).
WASM-ready
What it does
Provides methods to compute union, intersection, difference and xor of 2‑D polygons. It clips polygons, removes unnecessary vertices and handles floating‑point edge cases.
AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need polygon clipping or Boolean geometry in pure Dart
- Cross‑platform code without native dependencies
Skip it when
- Require high‑performance or GPU‑accelerated geometry
- Need 3‑D or complex spatial indexing
Strengths
- Pure Dart, works on all Flutter platforms
- Sound null safety and simple API
- Handles coincident segments and floating‑point irregularities
Weaknesses
- Limited to 2‑D polygons, no advanced spatial features
- Performance may be lower than native libraries
- Small test suite
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
final poly1 = Polygon(regions: [[
Coordinate(37.27935791015625, 29.32472016151103),
Coordinate(37.122802734375, 29.257648503615542),
Coordinate(37.22442626953125, 29.135369220927156),
Coordinate(37.36175537109374, 29.221699149280646),
Coordinate(37.27935791015625, 29.32472016151103),
]]);
final poly2 = Polygon(regions: [[
Coordinate(37.104949951171875, 29.159357041355424),
Coordinate(37.1722412109375, 29.046565622728846),
Coordinate(37.31781005859375, 29.105376571809618),
Coordinate(37.20794677734375, 29.216904948184734),
Coordinate(37.104949951171875, 29.159357041355424),
]]);
final union = poly1.union(poly2);Alternatives
Packages that do the same job and could replace polybool.
- clipper2
Performs polygon clipping, intersection, union, difference, XOR, and offsetting operations.
52Compare - diffutil_dart
Calculate the difference between two lists as a list of edit operations.
70Compare
Works with
Packages commonly used together with polybool: ones it builds on, ones built on it, and its own family.