Skip to content

Commit a4b128a

Browse files
authored
Add details
1 parent da49d18 commit a4b128a

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

docs/src/examples/darts.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,50 @@
11
# Darts (Draft)
22

33
Steps
4-
- Comstruct a set of geomtries representimg a dartboard with individual sector scores
4+
- Comstruct a set of geometries representimg a dartboard with individual sector scores
55
- Develop a model of the dart trajectory with probability density distribution
66
- Use integration over each geometry to determine the probabilities of particular outcomes
77
- Calculate expected value for the throw, repeat for other distributions to compare strategies
88

9-
## Modeling the Datboard
9+
```@example darts
10+
using Meshes
11+
using MeshIntegrals
12+
using Unitful
13+
```
14+
15+
## Modeling the Dartboard
16+
17+
Model the geometries
18+
```@example darts
19+
center = Point(0u"m", 0u"m", 1.5u"m")
20+
point(r, ϕ) = center + Meshes.Vec(0u"m", r*sin(ϕ)*u"m", r*cos(ϕ)*u"m")
21+
22+
struct Sector{L, A}
23+
r_inner::L
24+
r_outer::L
25+
phi_a::A
26+
phi_b::A
27+
points::Int64
28+
end
29+
30+
function to_ngon(sector::Sector; N=8)
31+
ϕs = range(sector.phi_a, sector.phi_b, length=N)
32+
arc_o = [point(sector.r_outer, ϕ) for ϕ in ϕs]
33+
arc_i = [point(sector.r_inner, ϕ) for ϕ in reverse(ϕs)]
34+
return Ngon(arc_o..., arc_i...)
35+
end
36+
```
37+
38+
Point system
39+
```@example darts
40+
sector_width = 2pi/20
41+
ring1 = [20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5]
42+
ring2 = 3 .* ring1
43+
ring3 = ring1
44+
ring4 = 2 .* ring1
45+
46+
bullseye_inner = (points=50,)
47+
bullseye_outer = (points=25,)
48+
```
1049

1150
## Modeling the Dart Trajectory

0 commit comments

Comments
 (0)