https://github.com/jw3126/convexhulls2d.jl
Simple and lightweight convex hull in 2d
https://github.com/jw3126/convexhulls2d.jl
2d convex convex-hull julia
Last synced: about 2 months ago
JSON representation
Simple and lightweight convex hull in 2d
- Host: GitHub
- URL: https://github.com/jw3126/convexhulls2d.jl
- Owner: jw3126
- License: mit
- Created: 2023-02-24T19:27:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-27T20:44:10.000Z (over 3 years ago)
- Last Synced: 2025-03-11T12:47:10.857Z (over 1 year ago)
- Topics: 2d, convex, convex-hull, julia
- Language: Julia
- Homepage:
- Size: 114 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ConvexHulls2d
[](https://jw3126.github.io/ConvexHulls2d.jl/stable/)
[](https://jw3126.github.io/ConvexHulls2d.jl/dev/)
[](https://github.com/jw3126/ConvexHulls2d.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/jw3126/ConvexHulls2d.jl)
Zero dependency convex hulls in 2d.
# Usage
```julia
using ConvexHulls2d
pts = [randn(2) for _ in 1:50]
h = CH.ConvexHull(pts)
CH.area(h)
CH.circumference(h)
CH.vertices(h) # corner points that span the convex hull
CH.indices(h) # indices of the corner points as elements of pts
using GLMakie # requires >= julia 1.9
fap = scatter(first.(pts), last.(pts), label="points", color=:blue)
lines!(h, label="ConvexHull", color=:red)
scatter!(h, label="vertices", color=:red)
axislegend()
fap
```

# Alternatives
There are many packages in julia capapable of computing convex hulls. Some examples are:
* [LazySet](https://github.com/JuliaReach/LazySets.jl)
* [QHull](https://github.com/JuliaPolyhedra/QHull.jl)
* [LibGEOS](https://github.com/JuliaGeo/LibGEOS.jl)
* [Meshes](https://juliageometry.github.io/Meshes.jl/stable/algorithms/hulls.html)
All of these packages offer much more than this package, however they are more heavy depependencies.
Also this package is faster then most of them for small to medium numbers of points.