Skip to content

Commit 68ca4e4

Browse files
committed
Fill in prior todos
1 parent 3f76ec7 commit 68ca4e4

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

docs/src/examples/darts.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,24 @@ end
3737
Sector(rs, phis) = Sector(rs..., phis...)
3838
3939
# Sector -> Ngon
40-
function to_ngon(sector::Sector; N=8)
40+
function Ngon(sector::Sector; N=8)
4141
ϕs = range(sector.phi_a, sector.phi_b, length=N)
4242
arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs]
4343
arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)]
4444
return Ngon(arc_o..., arc_i...)
4545
end
4646
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)]
4954
end
5055
5156
function to_makie_poly(ngon::Meshes.Ngon)
52-
return nothing # TODO
57+
return [Point3f(pt) for pt in ngon.vertices]
5358
end
5459
```
5560

@@ -94,8 +99,8 @@ sector_data = Iterators.zip(board_ngons, board_points, board_colors)
9499
board_regions = map(args -> ScoredRegion(args...), sector_data)
95100
96101
# 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)
99104
100105
# Get set of all regions
101106
all_regions = vcat(vec(board_regions), bullseye_inner, bullseye_outer)
@@ -126,3 +131,9 @@ function integrand(p::Point)
126131
pdf(dist, v_error)
127132
end
128133
```
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

Comments
 (0)