WIP: Add demonstrative examples to documentation#201
WIP: Add demonstrative examples to documentation#201mikeingold wants to merge 34 commits intomainfrom
Conversation
Benchmark Results (Julia v1.10)Time benchmarks
Memory benchmarks
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #201 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 19
Lines 191 191
=========================================
Hits 191 191 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| using Unitful | ||
| using Unitful.DefaultSymbols: mm, m | ||
|
|
||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| struct Sector{L <: Unitful.Length, A} | ||
| r_inner::L | ||
| r_outer::L | ||
| ϕ_a::A |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| ϕ_a::A | |
| ϕ_a::A |
| function _Ngon(sector::Sector; N=32) | ||
| ϕs = range(sector.ϕ_a, sector.ϕ_b, length=N) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function _Ngon(sector::Sector; N=32) | |
| ϕs = range(sector.ϕ_a, sector.ϕ_b, length=N) | |
| function _Ngon(sector::Sector; N = 32) | |
| ϕs = range(sector.ϕ_a, sector.ϕ_b, length = N) |
| return Meshes.Ngon(arc_o..., arc_i...) | ||
| end | ||
|
|
||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| Δϕ = 2π/20 | ||
| ϕas = range(0, 2π - Δϕ, length=20) .- (Δϕ / 2) | ||
| ϕbs = range(0, 2π - Δϕ, length=20) .+ (Δϕ / 2) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| Δϕ = 2π/20 | |
| ϕas = range(0, 2π - Δϕ, length=20) .- (Δϕ / 2) | |
| ϕbs = range(0, 2π - Δϕ, length=20) .+ (Δϕ / 2) | |
| Δϕ = 2π / 20 | |
| ϕas = range(0, 2π - Δϕ, length = 20) .- (Δϕ / 2) | |
| ϕbs = range(0, 2π - Δϕ, length = 20) .+ (Δϕ / 2) |
| # To Makie-compatible polygons | ||
| _poly(circle::Meshes.Circle; N=32) = [(_Point3f(circle(t)) for t in range(0, 1, length=N))...] | ||
| _poly(ngon::Meshes.Ngon) = [(_Point3f(pt) for pt in ngon.vertices)...] | ||
| _poly2d(circle::Meshes.Circle; N=32) = [(_Point2f(circle(t)) for t in range(0, 1, length=N))...] |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| _poly2d(circle::Meshes.Circle; N=32) = [(_Point2f(circle(t)) for t in range(0, 1, length=N))...] | |
| function _poly2d(circle::Meshes.Circle; N = 32) | |
| [(_Point2f(circle(t)) for t in range(0, 1, length = N))...] | |
| end |
| _poly2d(circle::Meshes.Circle; N=32) = [(_Point2f(circle(t)) for t in range(0, 1, length=N))...] | ||
| _poly2d(ngon::Meshes.Ngon) = [(_Point2f(pt) for pt in ngon.vertices)...] | ||
|
|
||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
|
|
||
| # Illustrate the dartboard | ||
| fig = Figure() | ||
| ax = Axis(fig[1, 1], xlabel="y [m]", ylabel="z [m]") |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| ax = Axis(fig[1, 1], xlabel="y [m]", ylabel="z [m]") | |
| ax = Axis(fig[1, 1], xlabel = "y [m]", ylabel = "z [m]") |
| poly!(ax, _poly2d(region.geometry), color=region.color) | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| poly!(ax, _poly2d(region.geometry), color=region.color) | |
| poly!(ax, _poly2d(region.geometry), color = region.color) | |
| # Write score label on geometry | ||
| centerPt = centroid(region.geometry) | ||
| center = ustrip.(u"m", [centerPt.coords.y, centerPt.coords.z]) | ||
| text!(ax, string(region.points), position=Point2f(center...), align=(:center,:center), color=:blue, fontsize=10) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| text!(ax, string(region.points), position=Point2f(center...), align=(:center,:center), color=:blue, fontsize=10) | |
| text!(ax, string(region.points), position = Point2f(center...), | |
| align = (:center, :center), color = :blue, fontsize = 10) |
Preview: https://juliageometry.github.io/MeshIntegrals.jl/previews/PR201/