|
37 | 37 | Sector(rs, phis) = Sector(rs..., phis...) |
38 | 38 |
|
39 | 39 | # Sector -> Ngon |
40 | | -function to_ngon(sector::Sector; N=8) |
| 40 | +function Ngon(sector::Sector; N=8) |
41 | 41 | ϕs = range(sector.phi_a, sector.phi_b, length=N) |
42 | 42 | arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs] |
43 | 43 | arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)] |
44 | 44 | return Ngon(arc_o..., arc_i...) |
45 | 45 | end |
46 | 46 |
|
47 | | -function to_makie_poly(circle::Meshes.Circle) |
48 | | - return nothing # TODO |
| 47 | +function Point3f(p::Meshes.Point) |
| 48 | + x, y, z = ustrip(m, [p.coords.x, p.coords.y, p.coords.z]) |
| 49 | + return Point3f(x, y, z) |
| 50 | +end |
| 51 | +
|
| 52 | +function to_makie_poly(circle::Meshes.Circle; N=32) |
| 53 | + return [Point3f(circle(t)) for t in range(0, 1, length=N)] |
49 | 54 | end |
50 | 55 |
|
51 | 56 | function to_makie_poly(ngon::Meshes.Ngon) |
52 | | - return nothing # TODO |
| 57 | + return [Point3f(pt) for pt in ngon.vertices] |
53 | 58 | end |
54 | 59 | ``` |
55 | 60 |
|
@@ -94,8 +99,8 @@ sector_data = Iterators.zip(board_ngons, board_points, board_colors) |
94 | 99 | board_regions = map(args -> ScoredRegion(args...), sector_data) |
95 | 100 |
|
96 | 101 | # Center region |
97 | | -bullseye_inner = ScoredRegion(Circle(dartboard_plane, 6.35mm), 50, red) |
98 | | -bullseye_outer = ScoredRegion(to_ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) |
| 102 | +bullseye_inner = ScoredRegion(Meshes.Circle(dartboard_plane, 6.35mm), 50, red) |
| 103 | +bullseye_outer = ScoredRegion(Ngon(Sector((6.35mm, 16.0mm), (0.0, 2π)); N=32), 25, green) |
99 | 104 |
|
100 | 105 | # Get set of all regions |
101 | 106 | all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer) |
@@ -126,3 +131,9 @@ function integrand(p::Point) |
126 | 131 | pdf(dist, v_error) |
127 | 132 | end |
128 | 133 | ``` |
| 134 | + |
| 135 | +Example image of trajectory probability distribution on board |
| 136 | + |
| 137 | +## Strategy Evaluation |
| 138 | + |
| 139 | +Use these tools to evaluate different aiming/throwing parameters and their impact on expected scores. |
0 commit comments