-
Notifications
You must be signed in to change notification settings - Fork 0
/
Model.elm
49 lines (34 loc) · 940 Bytes
/
Model.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module Model exposing (..)
import Color exposing (Color)
import Constants exposing (size)
import Math.Vector2 exposing (Vec2, vec2)
import Random.Pcg exposing (..)
type alias Point =
{ pos : Vec2, color : Color }
type alias DelunayTriangle =
{ triangle : Triangle, circle : Circle }
type alias Triangle =
{ a : Point, b : Point, c : Point }
type alias Circle =
{ center : Vec2, radius : Float }
type alias Model =
{ distance : Distance
, points : List Point
, triangles : List DelunayTriangle
, seed : Seed
}
type Distance
= Euclidean
| Manhattan
init : Model
init =
{ distance = Euclidean
, points =
[ Point (vec2 (size / 2) (-1 * size)) (Color.rgb 0 0 0)
, Point (vec2 (-1 * (size / 2)) size) (Color.rgb 0 0 0)
, Point (vec2 ((3 * size) / 2) size) (Color.rgb 0 0 0)
]
, triangles =
[]
, seed = initialSeed 3178909195
}