sweepline_intersections
0.0.4, released 3 years ago by scalabs.de
Detects intersections between polygons and polylines using a sweepline algorithm.
What it does
Detects intersections between polygons and/or polylines using a sweepline algorithm. It accepts GeoJSON Feature or Geometry types and returns a list of intersection points. It supports both standalone usage and a class-based approach for checking multiple geometries against a single base geometry.
AI-written summary of version 0.0.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to detect polygon or polyline self-intersections in Dart or Flutter.
- You are working with GeoJSON geometries and need to find intersection points efficiently.
Skip it when
- You are dealing with massive geometries containing tens of thousands of vertices where other algorithms like bentley-ottmann might be better suited.
- You do not need spatial intersection calculations.
Strengths
- Fast sweepline algorithm optimized for polygons and polylines with few overlapping segments on the x plane.
- Provides both simple functional and class-based reusable queue APIs.
Weaknesses
- Relatively early version package (0.0.4).
- Performance can be outperformed by bentley-ottmann algorithms when handling extremely large geometries with thousands of vertices.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
import 'package:sweepline_intersections/sweepline_intersections.dart';
var box = Feature(geometry: Polygon(coordinates: [[Position.of([0, 0]), Position.of([1, 0]), Position.of([1, 1]), Position.of([0, 1]), Position.of([0, 0])]]));
var intersections = sweeplineIntersections(box);Alternatives
Packages that do the same job and could replace sweepline_intersections.
- google_polyline_algorithm
Dart implementation of Google's Polyline Encoding lossy compression algorithm.
50Compare
Works with
Packages commonly used together with sweepline_intersections: ones it builds on, ones built on it, and its own family.