From 65dbde4c97d8bc6062b7dffbc249725e9087d02d Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Sun, 31 Aug 2025 09:05:41 -0400 Subject: [PATCH 01/31] Add Examples --- docs/make.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/make.jl b/docs/make.jl index 0cb480e7..e018a62f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -16,6 +16,9 @@ makedocs( "Support Status" => "support.md", "Tips" => "tips.md" ], + "Examples" => [ + "Changelog" => "examples/darts.md" + ], "Developer Notes" => [ "Changelog" => "developer/CHANGELOG.md", "How it Works" => "developer/how_it_works.md", From da49d180c341816e14b3dff4fbee8cc80da9df93 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Sun, 31 Aug 2025 09:17:37 -0400 Subject: [PATCH 02/31] Create darts.md --- docs/src/examples/darts.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docs/src/examples/darts.md diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md new file mode 100644 index 00000000..80ba6328 --- /dev/null +++ b/docs/src/examples/darts.md @@ -0,0 +1,11 @@ +# Darts (Draft) + +Steps +- Comstruct a set of geomtries representimg a dartboard with individual sector scores +- Develop a model of the dart trajectory with probability density distribution +- Use integration over each geometry to determine the probabilities of particular outcomes +- Calculate expected value for the throw, repeat for other distributions to compare strategies + +## Modeling the Datboard + +## Modeling the Dart Trajectory From a4b128a8a5fc7994a4b857a105ec752ec4e0ef8e Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Mon, 1 Sep 2025 22:23:00 -0400 Subject: [PATCH 03/31] Add details --- docs/src/examples/darts.md | 43 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 80ba6328..e2b61381 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -1,11 +1,50 @@ # Darts (Draft) Steps -- Comstruct a set of geomtries representimg a dartboard with individual sector scores +- Comstruct a set of geometries representimg a dartboard with individual sector scores - Develop a model of the dart trajectory with probability density distribution - Use integration over each geometry to determine the probabilities of particular outcomes - Calculate expected value for the throw, repeat for other distributions to compare strategies -## Modeling the Datboard +```@example darts +using Meshes +using MeshIntegrals +using Unitful +``` + +## Modeling the Dartboard + +Model the geometries +```@example darts +center = Point(0u"m", 0u"m", 1.5u"m") +point(r, ϕ) = center + Meshes.Vec(0u"m", r*sin(ϕ)*u"m", r*cos(ϕ)*u"m") + +struct Sector{L, A} + r_inner::L + r_outer::L + phi_a::A + phi_b::A + points::Int64 +end + +function to_ngon(sector::Sector; N=8) + ϕs = range(sector.phi_a, sector.phi_b, length=N) + arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] + arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] + return Ngon(arc_o..., arc_i...) +end +``` + +Point system +```@example darts +sector_width = 2pi/20 +ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5] +ring2 = 3 .* ring1 +ring3 = ring1 +ring4 = 2 .* ring1 + +bullseye_inner = (points=50,) +bullseye_outer = (points=25,) +``` ## Modeling the Dart Trajectory From 15ed2b85fc76bdeb47a8c97f3497ac220d9ce251 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Tue, 2 Sep 2025 22:17:34 -0400 Subject: [PATCH 04/31] Update page name --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index e018a62f..fd2311ba 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -17,7 +17,7 @@ makedocs( "Tips" => "tips.md" ], "Examples" => [ - "Changelog" => "examples/darts.md" + "Darts Strategy Analysis" => "examples/darts.md" ], "Developer Notes" => [ "Changelog" => "developer/CHANGELOG.md", From 39834d9a3a50f66796a3731c764b7a024a87c395 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 5 Sep 2025 21:26:39 -0400 Subject: [PATCH 05/31] Add more details --- docs/src/examples/darts.md | 64 +++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index e2b61381..f0786713 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -1,12 +1,15 @@ # Darts (Draft) Steps -- Comstruct a set of geometries representimg a dartboard with individual sector scores +- Construct a set of geometries representing a dartboard with individual sector scores - Develop a model of the dart trajectory with probability density distribution - Use integration over each geometry to determine the probabilities of particular outcomes - Calculate expected value for the throw, repeat for other distributions to compare strategies +Note: can use `@setup darts` block to hide some implementation code + ```@example darts +# using Distributions using Meshes using MeshIntegrals using Unitful @@ -14,11 +17,43 @@ using Unitful ## Modeling the Dartboard -Model the geometries +Define a dartboard coordinate system +```@example darts +dartboard_center = Point(0u"m", 0u"m", 1.5u"m") +dartboard_plane = Plane(dartboard_center, Meshes.Vec(1, 0, 0)) + +function point(r::Unitful.Length, ϕ) + t = ustrip(r, u"m") + dartboard_plane(t * sin(ϕ), t * cos(ϕ)) +end +``` + +Model the bullseye region +```@example darts +bullseye_inner = (geometry = Circle(dartboard_plane, 6.35u"mm"), points = 50) +bullseye_outer = (geometry = Circle(dartboard_plane, 16u"mm"), points = 25) +# TODO subtract center circle region from outer circle region -- or replace with another annular geometry +``` + +Model the sectors ```@example darts -center = Point(0u"m", 0u"m", 1.5u"m") -point(r, ϕ) = center + Meshes.Vec(0u"m", r*sin(ϕ)*u"m", r*cos(ϕ)*u"m") +# Scores on the Board +ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5] +ring2 = 3 .* ring1 +ring3 = ring1 +ring4 = 2 .* ring1 +board_points = hcat(ring1, ring2, ring3, ring4) +# Locations +sector_width = 2π/20 +phis_a = range(0, 2π, 20) .- sector_width/2 +phis_b = range(0, 2π, 20) .+ sector_width/2 +rs_inner = [16, 99, 107, 162]u"mm" +rs_outer = [99, 107, 162, 170]u"mm" +``` + +Define a struct to manage sector data +```@example darts struct Sector{L, A} r_inner::L r_outer::L @@ -35,16 +70,17 @@ function to_ngon(sector::Sector; N=8) end ``` -Point system -```@example darts -sector_width = 2pi/20 -ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5] -ring2 = 3 .* ring1 -ring3 = ring1 -ring4 = 2 .* ring1 +## Modeling the Dart Trajectory -bullseye_inner = (points=50,) -bullseye_outer = (points=25,) +Define a probability distribution for where the dart will land +``` +dist = MvNormal(μs, σs) ``` -## Modeling the Dart Trajectory +Integrand function is the distribution's PDF value at any particular point +``` +function integrand(p::Point) + v_error = dist_center - p + pdf(dist, v_error) +end +``` From d0792062a845a0fd9c53327b74e850615728ccda Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 5 Sep 2025 22:01:44 -0400 Subject: [PATCH 06/31] Update darts.md --- docs/src/examples/darts.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index f0786713..7a194415 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -13,25 +13,26 @@ Note: can use `@setup darts` block to hide some implementation code using Meshes using MeshIntegrals using Unitful +using Unitful.DefaultSymbols: mm, m ``` ## Modeling the Dartboard Define a dartboard coordinate system ```@example darts -dartboard_center = Point(0u"m", 0u"m", 1.5u"m") +dartboard_center = Point(0m, 0m, 1.5m) dartboard_plane = Plane(dartboard_center, Meshes.Vec(1, 0, 0)) function point(r::Unitful.Length, ϕ) - t = ustrip(r, u"m") + t = ustrip(r, m) dartboard_plane(t * sin(ϕ), t * cos(ϕ)) end ``` Model the bullseye region ```@example darts -bullseye_inner = (geometry = Circle(dartboard_plane, 6.35u"mm"), points = 50) -bullseye_outer = (geometry = Circle(dartboard_plane, 16u"mm"), points = 25) +bullseye_inner = (geometry = Circle(dartboard_plane, 6.35mm), points = 50) +bullseye_outer = (geometry = Circle(dartboard_plane, 16mm), points = 25) # TODO subtract center circle region from outer circle region -- or replace with another annular geometry ``` @@ -48,8 +49,9 @@ board_points = hcat(ring1, ring2, ring3, ring4) sector_width = 2π/20 phis_a = range(0, 2π, 20) .- sector_width/2 phis_b = range(0, 2π, 20) .+ sector_width/2 -rs_inner = [16, 99, 107, 162]u"mm" -rs_outer = [99, 107, 162, 170]u"mm" +phis = Iterators.zip(phis_a, phis_b) +rs = [ (16mm, 99mm), (99mm, 107mm), (107mm, 162mm), (162mm, 170mm) ] +grid = Iterators.product(phis, rs) ``` Define a struct to manage sector data From 55f403f34cb2ba1bf3066229304c8c5e27a7a176 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Sat, 6 Sep 2025 11:04:21 -0400 Subject: [PATCH 07/31] Update darts.md --- docs/src/examples/darts.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 7a194415..985ba080 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -52,6 +52,9 @@ phis_b = range(0, 2π, 20) .+ sector_width/2 phis = Iterators.zip(phis_a, phis_b) rs = [ (16mm, 99mm), (99mm, 107mm), (107mm, 162mm), (162mm, 170mm) ] grid = Iterators.product(phis, rs) + +# Collect sector data (points, coordinates) +sector_data = Iterators.zip(grid, board_points) ``` Define a struct to manage sector data @@ -64,12 +67,17 @@ struct Sector{L, A} points::Int64 end +Sector(points, (phis, rs)) = Sector(rs[1], rs[2], phis[1], phis[2], points) + function to_ngon(sector::Sector; N=8) ϕs = range(sector.phi_a, sector.phi_b, length=N) arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] return Ngon(arc_o..., arc_i...) end + +# Convert sector data to geometries +sector_geometries = map(to_ngon, sector_data) ``` ## Modeling the Dart Trajectory From 2a15296af12f72abb30527e6942337ab874c30ba Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Sat, 6 Sep 2025 16:39:29 -0400 Subject: [PATCH 08/31] Bugfix --- docs/src/examples/darts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 985ba080..2286d2bf 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -77,7 +77,7 @@ function to_ngon(sector::Sector; N=8) end # Convert sector data to geometries -sector_geometries = map(to_ngon, sector_data) +sector_geometries = sector_data .|> Sector .|> to_ngon ``` ## Modeling the Dart Trajectory From d2429c55a54c41169e46de1ca17e1b2ee0099b0d Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Thu, 11 Sep 2025 12:45:40 -0400 Subject: [PATCH 09/31] Add colors and new struct [skip ci] --- docs/src/examples/darts.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 2286d2bf..838087af 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -9,7 +9,8 @@ Steps Note: can use `@setup darts` block to hide some implementation code ```@example darts -# using Distributions +using Colors +using Distributions using Meshes using MeshIntegrals using Unitful @@ -32,12 +33,12 @@ end Model the bullseye region ```@example darts bullseye_inner = (geometry = Circle(dartboard_plane, 6.35mm), points = 50) -bullseye_outer = (geometry = Circle(dartboard_plane, 16mm), points = 25) +bullseye_outer = (geometry = Circle(dartboard_plane, 16mm), points = 25, color=) # TODO subtract center circle region from outer circle region -- or replace with another annular geometry ``` Model the sectors -```@example darts +```@setup darts # Scores on the Board ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5] ring2 = 3 .* ring1 @@ -45,6 +46,17 @@ ring3 = ring1 ring4 = 2 .* ring1 board_points = hcat(ring1, ring2, ring3, ring4) +# Colors on the board +red = colorant"red" +black = colorant"black" +white = colorant"white" +green = colorant"green" +ring1 = repeat([black, white], 10) +ring2 = repeat([red, green], 10) +ring3 = ring1 +ring4 = ring2 +board_colors = hcat(ring1, ring2, ring3, ring4) + # Locations sector_width = 2π/20 phis_a = range(0, 2π, 20) .- sector_width/2 @@ -59,6 +71,12 @@ sector_data = Iterators.zip(grid, board_points) Define a struct to manage sector data ```@example darts +struct ScoredRegion{G, C} + geometry::G + points::Int64 + color::C +end + struct Sector{L, A} r_inner::L r_outer::L @@ -77,6 +95,7 @@ function to_ngon(sector::Sector; N=8) end # Convert sector data to geometries +sectors = sector_geometries = sector_data .|> Sector .|> to_ngon ``` From 2bcf0d4d72b5223cd39d6f8d370bd8452618ab45 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Thu, 11 Sep 2025 20:31:33 -0400 Subject: [PATCH 10/31] Add Colors and Distributions to docs Project toml [skip ci] --- docs/Project.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 8a11b5a1..4acc651a 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,5 +1,7 @@ [deps] BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" +Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" MeshIntegrals = "dadec2fd-bbe0-4da4-9dbe-476c782c8e47" Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa" @@ -7,6 +9,8 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] BenchmarkTools = "1" +Colors = "0.13" +Distributions = "0.25" Documenter = "1" Meshes = "0.53, 0.54" Unitful = "1.19" From 701d93096a89dd8b71f7e4346221bb7fbd0b5bf0 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Thu, 11 Sep 2025 21:10:47 -0400 Subject: [PATCH 11/31] Update code --- docs/src/examples/darts.md | 90 +++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 838087af..e2d2d382 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -6,8 +6,6 @@ Steps - Use integration over each geometry to determine the probabilities of particular outcomes - Calculate expected value for the throw, repeat for other distributions to compare strategies -Note: can use `@setup darts` block to hide some implementation code - ```@example darts using Colors using Distributions @@ -15,6 +13,35 @@ using Meshes using MeshIntegrals using Unitful using Unitful.DefaultSymbols: mm, m + +red = colorant"red" +black = colorant"black" +white = colorant"white" +green = colorant"green" + +# For containing any scored landing region on the dart board +struct ScoredRegion{G, C} + geometry::G + points::Int64 + color::C +end + +# For defining an annular region +struct Sector{L, A} + r_inner::L + r_outer::L + phi_a::A + phi_b::A +end +Sector(rs, phis) = Sector(rs..., phis...) + +# Sector -> Ngon +function to_ngon(sector::Sector; N=8) + ϕs = range(sector.phi_a, sector.phi_b, length=N) + arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] + arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] + return Ngon(arc_o..., arc_i...) +end ``` ## Modeling the Dartboard @@ -25,20 +52,13 @@ dartboard_center = Point(0m, 0m, 1.5m) dartboard_plane = Plane(dartboard_center, Meshes.Vec(1, 0, 0)) function point(r::Unitful.Length, ϕ) - t = ustrip(r, m) + t = ustrip(m, r) dartboard_plane(t * sin(ϕ), t * cos(ϕ)) end ``` -Model the bullseye region +Model the dart board's sectors ```@example darts -bullseye_inner = (geometry = Circle(dartboard_plane, 6.35mm), points = 50) -bullseye_outer = (geometry = Circle(dartboard_plane, 16mm), points = 25, color=) -# TODO subtract center circle region from outer circle region -- or replace with another annular geometry -``` - -Model the sectors -```@setup darts # Scores on the Board ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5] ring2 = 3 .* ring1 @@ -47,67 +67,47 @@ ring4 = 2 .* ring1 board_points = hcat(ring1, ring2, ring3, ring4) # Colors on the board -red = colorant"red" -black = colorant"black" -white = colorant"white" -green = colorant"green" ring1 = repeat([black, white], 10) ring2 = repeat([red, green], 10) ring3 = ring1 ring4 = ring2 board_colors = hcat(ring1, ring2, ring3, ring4) -# Locations +# Sector geometries sector_width = 2π/20 phis_a = range(0, 2π, 20) .- sector_width/2 phis_b = range(0, 2π, 20) .+ sector_width/2 phis = Iterators.zip(phis_a, phis_b) rs = [ (16mm, 99mm), (99mm, 107mm), (107mm, 162mm), (162mm, 170mm) ] -grid = Iterators.product(phis, rs) +board_coords = Iterators.product(phis, rs) +board_sectors = map(((phis, rs),) -> Sector(rs, phis), board_coords) +board_ngons = to_ngon.(board_sectors) -# Collect sector data (points, coordinates) -sector_data = Iterators.zip(grid, board_points) +# Consolidate the board's sector data +sector_data = Iterators.zip(board_ngons, board_points, board_colors) ``` -Define a struct to manage sector data +Collect dart board data into `ScoredRegion`s ```@example darts -struct ScoredRegion{G, C} - geometry::G - points::Int64 - color::C -end - -struct Sector{L, A} - r_inner::L - r_outer::L - phi_a::A - phi_b::A - points::Int64 -end - -Sector(points, (phis, rs)) = Sector(rs[1], rs[2], phis[1], phis[2], points) - -function to_ngon(sector::Sector; N=8) - ϕs = range(sector.phi_a, sector.phi_b, length=N) - arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] - arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] - return Ngon(arc_o..., arc_i...) -end +# Sectors +board_regions = map(args -> ScoredRegion(args...), sector_data) -# Convert sector data to geometries -sectors = -sector_geometries = sector_data .|> Sector .|> to_ngon +# Center region +bullseye_inner = ScoredRegion(Circle(dartboard_plane, 6.35mm), 50, red) +bullseye_outer = ScoredRegion(to_ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) ``` ## Modeling the Dart Trajectory Define a probability distribution for where the dart will land ``` +# TODO dist = MvNormal(μs, σs) ``` Integrand function is the distribution's PDF value at any particular point ``` +# TODO function integrand(p::Point) v_error = dist_center - p pdf(dist, v_error) From 205261d99b52faaf4b9197a92997dca13fd85635 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 07:12:27 -0400 Subject: [PATCH 12/31] Add CairoMakie --- docs/Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 4acc651a..9c5932d8 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,5 +1,6 @@ [deps] BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" @@ -9,6 +10,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] BenchmarkTools = "1" +CairoMakie = "0.5" Colors = "0.13" Distributions = "0.25" Documenter = "1" From 4cc2406cb0c048f333375a5848dda9b48c2bd2ed Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 07:15:27 -0400 Subject: [PATCH 13/31] Update version --- docs/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index 9c5932d8..e6c9f5b9 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -10,7 +10,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] BenchmarkTools = "1" -CairoMakie = "0.5" +CairoMakie = "0.15" Colors = "0.13" Distributions = "0.25" Documenter = "1" From 24801498ea1c9de19cee5259a09733a403d1beb1 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 07:20:26 -0400 Subject: [PATCH 14/31] Add some illustration code --- docs/src/examples/darts.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index e2d2d382..7c9cd4d1 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -7,6 +7,7 @@ Steps - Calculate expected value for the throw, repeat for other distributions to compare strategies ```@example darts +using CairoMakie using Colors using Distributions using Meshes @@ -42,6 +43,14 @@ function to_ngon(sector::Sector; N=8) arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] return Ngon(arc_o..., arc_i...) end + +function to_makie_poly(circle::Meshes.Circle) + return nothing # TODO +end + +function to_makie_poly(ngon::Meshes.Ngon) + return nothing # TODO +end ``` ## Modeling the Dartboard @@ -95,6 +104,21 @@ board_regions = map(args -> ScoredRegion(args...), sector_data) # Center region bullseye_inner = ScoredRegion(Circle(dartboard_plane, 6.35mm), 50, red) bullseye_outer = ScoredRegion(to_ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) + +# Get set of all regions +all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer) +``` + +Illustration +```@example darts +fig = Figure() +ax = LScene(fig[1, 1], scenekw=(show_axis=true,)) + +for region in all_regions + poly!(ax, to_makie_poly(region.geometry), color=region.color) +end + +fig ``` ## Modeling the Dart Trajectory From 8ffa33c21d8d7c9511ed51b260f457685912064d Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 07:41:02 -0400 Subject: [PATCH 15/31] Update Project.toml --- docs/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index e6c9f5b9..1598b3ea 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -10,7 +10,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] BenchmarkTools = "1" -CairoMakie = "0.15" +CairoMakie = "0.15 - 0.24" Colors = "0.13" Distributions = "0.25" Documenter = "1" From 94fe86af019579843fefa7473e0a64bfd501f44d Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 08:04:05 -0400 Subject: [PATCH 16/31] Update Julia version to current LTS --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c1f6550f..9704582f 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 with: - version: '1.9' + version: '1.10' - uses: julia-actions/cache@v2 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' From c466dbd2660b34e6e265742d92663b5e5fb1cd58 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 08:04:30 -0400 Subject: [PATCH 17/31] Update version bounds --- docs/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index 1598b3ea..e6c9f5b9 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -10,7 +10,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] BenchmarkTools = "1" -CairoMakie = "0.15 - 0.24" +CairoMakie = "0.15" Colors = "0.13" Distributions = "0.25" Documenter = "1" From 07fc306e5be148e5a981408bb0b1716603cfeb26 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 08:17:06 -0400 Subject: [PATCH 18/31] Update ref --- docs/src/examples/darts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 7c9cd4d1..41683231 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -57,7 +57,7 @@ end Define a dartboard coordinate system ```@example darts -dartboard_center = Point(0m, 0m, 1.5m) +dartboard_center = Meshes.Point(0m, 0m, 1.5m) dartboard_plane = Plane(dartboard_center, Meshes.Vec(1, 0, 0)) function point(r::Unitful.Length, ϕ) From 3f76ec7429b4c716375f8513b690c989d672959c Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 17:55:25 -0400 Subject: [PATCH 19/31] Combine code blocks (for now) --- docs/src/examples/darts.md | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 41683231..6e64847d 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -55,7 +55,7 @@ end ## Modeling the Dartboard -Define a dartboard coordinate system +Model the dartboard ```@example darts dartboard_center = Meshes.Point(0m, 0m, 1.5m) dartboard_plane = Plane(dartboard_center, Meshes.Vec(1, 0, 0)) @@ -64,10 +64,7 @@ function point(r::Unitful.Length, ϕ) t = ustrip(m, r) dartboard_plane(t * sin(ϕ), t * cos(ϕ)) end -``` -Model the dart board's sectors -```@example darts # Scores on the Board ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5] ring2 = 3 .* ring1 @@ -92,13 +89,8 @@ board_coords = Iterators.product(phis, rs) board_sectors = map(((phis, rs),) -> Sector(rs, phis), board_coords) board_ngons = to_ngon.(board_sectors) -# Consolidate the board's sector data +# Consolidate the Sectors sector_data = Iterators.zip(board_ngons, board_points, board_colors) -``` - -Collect dart board data into `ScoredRegion`s -```@example darts -# Sectors board_regions = map(args -> ScoredRegion(args...), sector_data) # Center region @@ -107,10 +99,7 @@ bullseye_outer = ScoredRegion(to_ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32 # Get set of all regions all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer) -``` -Illustration -```@example darts fig = Figure() ax = LScene(fig[1, 1], scenekw=(show_axis=true,)) From 68ca4e41ba5e996b3ae36ce6deaea98b1c028249 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 19:11:20 -0400 Subject: [PATCH 20/31] Fill in prior todos --- docs/src/examples/darts.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 6e64847d..1339c6eb 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -37,19 +37,24 @@ end Sector(rs, phis) = Sector(rs..., phis...) # Sector -> Ngon -function to_ngon(sector::Sector; N=8) +function Ngon(sector::Sector; N=8) ϕs = range(sector.phi_a, sector.phi_b, length=N) arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] return Ngon(arc_o..., arc_i...) end -function to_makie_poly(circle::Meshes.Circle) - return nothing # TODO +function Point3f(p::Meshes.Point) + x, y, z = ustrip(m, [p.coords.x, p.coords.y, p.coords.z]) + return Point3f(x, y, z) +end + +function to_makie_poly(circle::Meshes.Circle; N=32) + return [Point3f(circle(t)) for t in range(0, 1, length=N)] end function to_makie_poly(ngon::Meshes.Ngon) - return nothing # TODO + return [Point3f(pt) for pt in ngon.vertices] end ``` @@ -94,8 +99,8 @@ sector_data = Iterators.zip(board_ngons, board_points, board_colors) board_regions = map(args -> ScoredRegion(args...), sector_data) # Center region -bullseye_inner = ScoredRegion(Circle(dartboard_plane, 6.35mm), 50, red) -bullseye_outer = ScoredRegion(to_ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) +bullseye_inner = ScoredRegion(Meshes.Circle(dartboard_plane, 6.35mm), 50, red) +bullseye_outer = ScoredRegion(Ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) # Get set of all regions all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer) @@ -126,3 +131,9 @@ function integrand(p::Point) pdf(dist, v_error) end ``` + +Example image of trajectory probability distribution on board + +## Strategy Evaluation + +Use these tools to evaluate different aiming/throwing parameters and their impact on expected scores. From a9241039d5d05abb66f871888df4cb81b3a44008 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 20:15:13 -0400 Subject: [PATCH 21/31] Bugfix --- docs/src/examples/darts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 1339c6eb..d34fbad6 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -92,7 +92,7 @@ phis = Iterators.zip(phis_a, phis_b) rs = [ (16mm, 99mm), (99mm, 107mm), (107mm, 162mm), (162mm, 170mm) ] board_coords = Iterators.product(phis, rs) board_sectors = map(((phis, rs),) -> Sector(rs, phis), board_coords) -board_ngons = to_ngon.(board_sectors) +board_ngons = Ngon.(board_sectors) # Consolidate the Sectors sector_data = Iterators.zip(board_ngons, board_points, board_colors) From ac5e67de4e476fd755b4ef4ddc0ea9ea82243177 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 20:59:55 -0400 Subject: [PATCH 22/31] Bugfix --- docs/src/examples/darts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index d34fbad6..669dedac 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -41,7 +41,7 @@ function Ngon(sector::Sector; N=8) ϕs = range(sector.phi_a, sector.phi_b, length=N) arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] - return Ngon(arc_o..., arc_i...) + return Meshes.Ngon(arc_o..., arc_i...) end function Point3f(p::Meshes.Point) From d71a0781035ae73a03bf0796eaad213956326f63 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 21:18:12 -0400 Subject: [PATCH 23/31] Bugfix --- docs/src/examples/darts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 669dedac..1b7760f8 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -45,7 +45,7 @@ function Ngon(sector::Sector; N=8) end function Point3f(p::Meshes.Point) - x, y, z = ustrip(m, [p.coords.x, p.coords.y, p.coords.z]) + x, y, z = ustrip.(m, [p.coords.x, p.coords.y, p.coords.z]) return Point3f(x, y, z) end From 3dad74a0880d470ec13c833ba859a74885bc7ab3 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 21:31:05 -0400 Subject: [PATCH 24/31] Bugfix --- docs/src/examples/darts.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 1b7760f8..fdd5def1 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -44,17 +44,17 @@ function Ngon(sector::Sector; N=8) return Meshes.Ngon(arc_o..., arc_i...) end -function Point3f(p::Meshes.Point) +function to_Point3f(p::Meshes.Point) x, y, z = ustrip.(m, [p.coords.x, p.coords.y, p.coords.z]) return Point3f(x, y, z) end function to_makie_poly(circle::Meshes.Circle; N=32) - return [Point3f(circle(t)) for t in range(0, 1, length=N)] + return [to_Point3f(circle(t)) for t in range(0, 1, length=N)] end function to_makie_poly(ngon::Meshes.Ngon) - return [Point3f(pt) for pt in ngon.vertices] + return [to_Point3f(pt) for pt in ngon.vertices] end ``` From 08a00f07ebcc3b8d5bd7b84ad3f5469771a101cc Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 21:51:48 -0400 Subject: [PATCH 25/31] Bugfix - generate non-svector --- docs/src/examples/darts.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index fdd5def1..6d53a224 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -49,13 +49,8 @@ function to_Point3f(p::Meshes.Point) return Point3f(x, y, z) end -function to_makie_poly(circle::Meshes.Circle; N=32) - return [to_Point3f(circle(t)) for t in range(0, 1, length=N)] -end - -function to_makie_poly(ngon::Meshes.Ngon) - return [to_Point3f(pt) for pt in ngon.vertices] -end +to_makie_poly(circle::Meshes.Circle; N=32) = Point3f[to_Point3f(circle(t)) for t in range(0, 1, length=N)] +to_makie_poly(ngon::Meshes.Ngon) = Point3f[to_Point3f(pt) for pt in ngon.vertices] ``` ## Modeling the Dartboard From a72924db2e1d8f88bd4ff348b95bda8e2a810276 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 22:44:55 -0400 Subject: [PATCH 26/31] Bugfix the bugfix --- docs/src/examples/darts.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 6d53a224..d97eb204 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -44,13 +44,13 @@ function Ngon(sector::Sector; N=8) return Meshes.Ngon(arc_o..., arc_i...) end -function to_Point3f(p::Meshes.Point) +function _Point3f(p::Meshes.Point) x, y, z = ustrip.(m, [p.coords.x, p.coords.y, p.coords.z]) return Point3f(x, y, z) end -to_makie_poly(circle::Meshes.Circle; N=32) = Point3f[to_Point3f(circle(t)) for t in range(0, 1, length=N)] -to_makie_poly(ngon::Meshes.Ngon) = Point3f[to_Point3f(pt) for pt in ngon.vertices] +_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)...] ``` ## Modeling the Dartboard @@ -104,7 +104,7 @@ fig = Figure() ax = LScene(fig[1, 1], scenekw=(show_axis=true,)) for region in all_regions - poly!(ax, to_makie_poly(region.geometry), color=region.color) + poly!(ax, _poly(region.geometry), color=region.color) end fig From dec7ea9a858c17969a6643502d8dfd00fda1b09f Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 23:34:04 -0400 Subject: [PATCH 27/31] Set axes limits for LScene --- docs/src/examples/darts.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index d97eb204..8f4a50d8 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -107,6 +107,8 @@ for region in all_regions poly!(ax, _poly(region.geometry), color=region.color) end +limits!(ax, -0.1 .. 0.1, -1.5 .. 1.5, 0 .. 3) + fig ``` From c9a97c028a14cde9180fef20ae24210fb9dad6ac Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Fri, 12 Sep 2025 23:39:45 -0400 Subject: [PATCH 28/31] Switch from LScene to Axis3 --- docs/src/examples/darts.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index 8f4a50d8..e286ea3d 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -100,15 +100,17 @@ bullseye_outer = ScoredRegion(Ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), # Get set of all regions all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer) +# Initialize a 3D figure fig = Figure() -ax = LScene(fig[1, 1], scenekw=(show_axis=true,)) +#ax = LScene(fig[1, 1], scenekw=(show_axis=true,)) +ax = Axis3(fig[1, 1]; xlabel="X", ylabel="Y", zlabel="Z") +limits!(ax, -0.1..0.1, -1.5..1.5, 0..3; fixed=true) +# Populate the dart board scored regions for region in all_regions poly!(ax, _poly(region.geometry), color=region.color) end -limits!(ax, -0.1 .. 0.1, -1.5 .. 1.5, 0 .. 3) - fig ``` From ffcdcfd65e8b495d25a7b779f1901d17eb58bf8b Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Tue, 23 Sep 2025 20:16:48 -0400 Subject: [PATCH 29/31] Switch to 2D viz of dartboard --- docs/src/examples/darts.md | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index e286ea3d..f87d0cf0 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -10,6 +10,7 @@ Steps using CairoMakie using Colors using Distributions +using GeometryBasics using Meshes using MeshIntegrals using Unitful @@ -37,7 +38,7 @@ end Sector(rs, phis) = Sector(rs..., phis...) # Sector -> Ngon -function Ngon(sector::Sector; N=8) +function _Ngon(sector::Sector; N=8) ϕs = range(sector.phi_a, sector.phi_b, length=N) arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] @@ -51,6 +52,9 @@ end _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))...] +_poly2d(ngon::Meshes.Ngon) = [(_Point2f(pt) for pt in ngon.vertices)...] ``` ## Modeling the Dartboard @@ -81,13 +85,14 @@ board_colors = hcat(ring1, ring2, ring3, ring4) # Sector geometries sector_width = 2π/20 -phis_a = range(0, 2π, 20) .- sector_width/2 -phis_b = range(0, 2π, 20) .+ sector_width/2 +sector_centers = [n * sector_width for n in 0:19] +phis_a = sector_centers .- sector_width/2 +phis_b = sector_centers .+ sector_width/2 phis = Iterators.zip(phis_a, phis_b) rs = [ (16mm, 99mm), (99mm, 107mm), (107mm, 162mm), (162mm, 170mm) ] board_coords = Iterators.product(phis, rs) board_sectors = map(((phis, rs),) -> Sector(rs, phis), board_coords) -board_ngons = Ngon.(board_sectors) +board_ngons = _Ngon.(board_sectors) # Consolidate the Sectors sector_data = Iterators.zip(board_ngons, board_points, board_colors) @@ -95,22 +100,24 @@ board_regions = map(args -> ScoredRegion(args...), sector_data) # Center region bullseye_inner = ScoredRegion(Meshes.Circle(dartboard_plane, 6.35mm), 50, red) -bullseye_outer = ScoredRegion(Ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) +bullseye_outer = ScoredRegion(_Ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) # Get set of all regions all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer) -# Initialize a 3D figure fig = Figure() -#ax = LScene(fig[1, 1], scenekw=(show_axis=true,)) -ax = Axis3(fig[1, 1]; xlabel="X", ylabel="Y", zlabel="Z") -limits!(ax, -0.1..0.1, -1.5..1.5, 0..3; fixed=true) - -# Populate the dart board scored regions -for region in all_regions - poly!(ax, _poly(region.geometry), color=region.color) +ax = Axis(fig[1, 1], xlabel="y [m]", ylabel="z [m]") +ax.aspect = DataAspect() + +for region in board_regions + pts = _poly2d(region.geometry) + poly!(ax, pts, color=region.color) + + 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) end - + fig ``` From f41836cf7430a17892901347b240db016f1a35a8 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Tue, 23 Sep 2025 20:30:51 -0400 Subject: [PATCH 30/31] Add GeometryBasics --- docs/Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index e6c9f5b9..744745e3 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -4,6 +4,7 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" MeshIntegrals = "dadec2fd-bbe0-4da4-9dbe-476c782c8e47" Meshes = "eacbb407-ea5a-433e-ab97-5258b1ca43fa" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" @@ -14,6 +15,7 @@ CairoMakie = "0.15" Colors = "0.13" Distributions = "0.25" Documenter = "1" +GeometryBasics = "0.5" Meshes = "0.53, 0.54" Unitful = "1.19" julia = "1.9" From 5a5eec994e51d93ac68dab6a34657c3df1b20739 Mon Sep 17 00:00:00 2001 From: Michael Ingold Date: Tue, 23 Sep 2025 21:42:47 -0400 Subject: [PATCH 31/31] Add _Point2f method --- docs/src/examples/darts.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/src/examples/darts.md b/docs/src/examples/darts.md index f87d0cf0..a221855d 100644 --- a/docs/src/examples/darts.md +++ b/docs/src/examples/darts.md @@ -45,6 +45,11 @@ function _Ngon(sector::Sector; N=8) return Meshes.Ngon(arc_o..., arc_i...) end +function _Point2f(p::Meshes.Point) + x, y, z = ustrip.(m, [p.coords.x, p.coords.y, p.coords.z]) + return Point2f(y, z) +end + function _Point3f(p::Meshes.Point) x, y, z = ustrip.(m, [p.coords.x, p.coords.y, p.coords.z]) return Point3f(x, y, z)