Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/selimchraibi/bentleyottmanalgorithm
Sweep line algorithm for listing all crossings in a set of line segments. [2016]
https://github.com/selimchraibi/bentleyottmanalgorithm
Last synced: 13 days ago
JSON representation
Sweep line algorithm for listing all crossings in a set of line segments. [2016]
- Host: GitHub
- URL: https://github.com/selimchraibi/bentleyottmanalgorithm
- Owner: SelimChraibi
- Created: 2017-12-03T14:33:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-07T06:35:16.000Z (over 6 years ago)
- Last Synced: 2023-10-05T06:49:45.748Z (about 1 year ago)
- Language: Python
- Size: 87.9 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bentley Ottman Algorithm
*First year Python project at Ensimag - Grenoble INP - 2016*
![100_lines](https://i.imgur.com/eXdf4dr.png)
Implementation of the [Bentley-Ottman algorithm](https://en.wikipedia.org/wiki/Bentley–Ottmann_algorithm).
> The Bentley–Ottmann algorithm is a sweep line algorithm for listing all crossings in a set of line segments.## Usage
```sh
./bo.py -h
usage: bo.py [-h] [-s] [-t] [-l] filepaths [filepaths ...]List all crossings in a set of line segments using the Bentley–Ottmann algorithm.
positional arguments:
filepaths filepaths of the .bo files to analyseoptional arguments:
-h, --help show this help message and exit
-s save the results as svg in ./outputs
-t tycat the results
-l add results to a log.csv file
```## Use example
```sh
./bo.py -s -l ./tests/simple.boRunning Bentley Ottmann on simple ...
[=========================] 100%
Unique intersections : 1
Crossings within segments : 2
Runtime for Bentley Ottmann : 0m 0.0008020401000976562sRunning naive algorithm on simple ...
[=========================] 100%
Runtime for naive algorithm : 0m 9.799003601074219e-05s
```
### Performance
Comparison with a naive algorithm (see `naive.py`) on 200 random lines:
![200_lines_with_crossings](https://i.imgur.com/kxirU2w.png)