8000 GitHub - tkucner/polygon_count: Algorithm for finding polygons in arangement of line segments
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tkucner/polygon_count

Repository files navigation

polygon_count

Description

This repository contains an implementation of an algorithm for polygon counting in line arraignment proposed by M. Fink et al. [1]. The proposed method relies on Bentley–Ottmann algorithm [2] for finding intersections in an arrangement of line segments.

Example usage

import polygon_count as pc
# Arrangement of lines
A = [((0, 1), (13, 16)),
     ((13, 2), (0, 2)),
     ((13, 5), (0, 8)),
     ((11, -5), (11, 16)),
     ((0, 12), (13, -5)),
     ((8, 12), (12, -6)),
     ((13, 7), (0,7))]
count, ps, isects, G, Q=pc.polygon_count(A)
# visualisation
flags = {
    "input": True,
    "graph": False,
    "result": False,
    "verbose": True
}
pc.show(A, ps, isects, G, Q, flags,count)

Input segments

Input lines and intersections

Found polygons:

  • 3-gons

Found 3-gons

  • 4-gons

Found 4-gons

  • 5-gons

Found 5-gons

References

[1] Fink, M., Kumar, N., & Suri, S. (2016, August). Counting Fink, M., Kumar, N., & Suri, S. (2016, August). Counting Convex k-gons in an Arrangement of Line Segments. In CCCG (pp. 155-160)Convex k-gons in an Arrangement of Line Segments. In CCCG (pp. 155-160)

[2] Bentley, J. L., & Ottmann, T. A. (1979). Algorithms for reporting and counting geometric intersections. IEEE Transactions on computers, (9), 643-647.

About

Algorithm for finding polygons in arangement of line segments

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0