Boolean operations on polygons (union, intersection, difference, xor)

Overview

poly_bool_dart

Boolean operations on polygons (union, intersection, difference, xor) (this library is a port for flutter of polybooljs

Features

  1. Clips polygons for all boolean operations
  2. Removes unnecessary vertices
  3. Handles segments that are coincident (overlap perfectly, share vertices, one inside the other, etc)
  4. Uses formulas that take floating point irregularities into account (via configurable epsilon)
  5. Provides an API for constructing efficient sequences of operations

How to use it

RegionPolygon poly1 = RegionPolygon(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)
  ],
]);

RegionPolygon poly2 = RegionPolygon(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),
  ]
]);

var seg1 = PolyBool().segments(poly1);
var seg2 = PolyBool().segments(poly2);
var comb = PolyBool().combine(seg1, seg2);
var result = {
  'union': PolyBool().polygon(PolyBool().selectUnion(comb)),
  'intersect': PolyBool().polygon(PolyBool().selectIntersect(comb)),
  'difference': PolyBool().polygon(PolyBool().selectDifference(comb)),
  'differenceRev': PolyBool().polygon(PolyBool().selectDifferenceRev(comb)),
  'xor': PolyBool().polygon(PolyBool().selectXor(comb))
};

Notes

  1. No test cases available, Because i don't have time right now

Resources

You might also like...

A Flutter Result type that feels like a Freezed union.

Freezed Result A ResultSuccess, Failure that feels like a Freezed union. It represents the output of an action that can succeed or fail. It holds ei

Nov 24, 2022

The XOR Encryption algorithm is a effective and easy to implement method of symmetric encryption.

Symmetric XOR cipher library About XOR cipher XOR Encryption is an encryption method used to encrypt data and is hard to crack by brute-force method,

Apr 20, 2022

A flutter package which makes it easier to display the difference between two images.

A flutter package which makes it easier to display the difference between two images.

👏 Before After A flutter package which makes it easier to display the differences between two images.. The source code is 100% Dart, and everything r

Dec 30, 2022

A flutter package which makes it easier to display the difference between two images.

A flutter package which makes it easier to display the difference between two images.

👏 Before After A flutter package which makes it easier to display the differences between two images.. The source code is 100% Dart, and everything r

Dec 30, 2022

Flutter library that handles BLE operations for multiple devices.

Flutter reactive BLE library Flutter library that handles BLE operations for multiple devices. Usage The reactive BLE lib supports the following: BLE

Jan 4, 2023

A simple way to cache values that result from rather expensive operations.

cached_value A simple way to cache values that result from rather expensive operations. It is useful to cache values that: Are computed from other val

Nov 11, 2022

using local db sqflite CRUD operations

todo A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is

Nov 11, 2021

A Flutter application that demonstrate simple CRUD operations with Firebase cloud database.

A Flutter application that demonstrate simple CRUD operations with Firebase cloud database.

Cricket Team A Flutter application that demonstrate simple CRUD operations with Firebase cloud database. Preview Home Empty Swipe Add Player Update Pl

Jun 19, 2021

Dart library for some Turkish language specific operations.

turkish This library provides these functions for Turkish language for Dart: Converting strings to lower, upper and title case. Regular and ignore cas

Dec 27, 2022

Implementing simple storage operations, CRUD (Create, Read, Update, Delete), using Firebase Firestore

Implementing simple storage operations, CRUD (Create, Read, Update, Delete), using Firebase Firestore

CRUD Firebase Implementing simple storage operations, CRUD (Create, Read, Update

Oct 29, 2022

A Mobile application developed with Flutter and Dart to do math operations with binary numbers.

A Mobile application developed with Flutter and Dart to do math operations with binary numbers.

Math operations with Binary Numbers Readme PT About this Project Mobile application developed with Flutter and Dart to do math operations as sum, subt

Nov 3, 2020

A shopper Flutter app that use BloC pattern and CRUD operations with different ways(memory/sqlite/http)

A shopper Flutter app that use BloC pattern and CRUD operations with different ways(memory/sqlite/http)

The project is maintained by a non-profit organisation, along with an amazing collections of Flutter samples. We're trying to make continuous commits

Nov 10, 2022

A flutter demo app to practice Map data structure and its common operations

Map Operations A flutter demo app to practice Map data structure and its common operations Developer Alexander Sosa (https://www.linkedin.com/in/alexa

Jan 3, 2022

Development of a simple mobile application to perform mathematical operations, using DART and FLUTTER

Desenvolvimento de uma aplicação mobile simples para realizar operações matemáticas, usando DART e FLUTTER.

Jan 20, 2022

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Nov 26, 2022

Multi-platform application to practice quizzes from the course Operations Research M.

Multi-platform application to practice quizzes from the course Operations Research M.

Dec 26, 2022

Flutter library that handles BLE operations for multiple devices

Flutter reactive BLE library Flutter library that handles BLE operations for multiple devices. Usage The reactive BLE lib supports the following: BLE

Apr 12, 2022

A Flutter Task App with Parse (Back4app) as the backend demonstrating CRUD operations.

A Flutter Task App with Parse (Back4app) as the backend demonstrating CRUD operations.

Siro's Task App Description A Flutter Task App with Parse (Back4app) as the backend demonstrating CRUD operations. Getx State Management Objective Thi

Aug 27, 2022
Owner
Mohammed Aljezawi
Mohammed Aljezawi
The XOR Encryption algorithm is a effective and easy to implement method of symmetric encryption.

Symmetric XOR cipher library About XOR cipher XOR Encryption is an encryption method used to encrypt data and is hard to crack by brute-force method,

Plague Fox 7 Apr 20, 2022
A Flutter application that demonstrate simple CRUD operations with Firebase cloud database.

Cricket Team A Flutter application that demonstrate simple CRUD operations with Firebase cloud database. Preview Home Empty Swipe Add Player Update Pl

Bhavik Makwana 45 Jun 19, 2021
Dart library for some Turkish language specific operations.

turkish This library provides these functions for Turkish language for Dart: Converting strings to lower, upper and title case. Regular and ignore cas

Ahmet A. Akın 39 Dec 27, 2022
Implementing simple storage operations, CRUD (Create, Read, Update, Delete), using Firebase Firestore

CRUD Firebase Implementing simple storage operations, CRUD (Create, Read, Update

Luciano Martins 6 Oct 29, 2022
A Mobile application developed with Flutter and Dart to do math operations with binary numbers.

Math operations with Binary Numbers Readme PT About this Project Mobile application developed with Flutter and Dart to do math operations as sum, subt

Manoel Ribeiro 3 Nov 3, 2020
A shopper Flutter app that use BloC pattern and CRUD operations with different ways(memory/sqlite/http)

The project is maintained by a non-profit organisation, along with an amazing collections of Flutter samples. We're trying to make continuous commits

Flutter Samples 80 Nov 10, 2022
A flutter demo app to practice Map data structure and its common operations

Map Operations A flutter demo app to practice Map data structure and its common operations Developer Alexander Sosa (https://www.linkedin.com/in/alexa

Alexander Sosa 0 Jan 3, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
Multi-platform application to practice quizzes from the course Operations Research M.

Multi-platform application to practice quizzes from the course Operations Research M.

Michele Righi 37 Dec 26, 2022
A Flutter Task App with Parse (Back4app) as the backend demonstrating CRUD operations.

Siro's Task App Description A Flutter Task App with Parse (Back4app) as the backend demonstrating CRUD operations. Getx State Management Objective Thi

Jack Siro 4 Aug 27, 2022