@@ -62,14 +62,21 @@ class VoronoiView: UIView {
62
62
size: Size ( width: Double ( bounds. width) - 100 , height: Double ( bounds. height) - 100 )
63
63
)
64
64
// ----------------------------------------------------
65
- curTest = ( curTest) % testCases. count
66
- let sites = testCases [ curTest]
67
- curTest += 1
65
+ // curTest = (curTest) % testCases.count
66
+ // let sites = testCases[curTest]
67
+ // curTest += 1
68
+ // diagram = Diagram()
69
+ //
70
+ // fs.compute(sites: sites, diagram: &diagram, clippingRect: clippingRect)
71
+ // setNeedsDisplay()
72
+ // ----------------------------------------------------
73
+ let sites = randomSites ( 500 , xRange: 50 ..< Double ( bounds. width) - 100 , yRange: 50 ..< Double ( bounds. height) - 100 )
68
74
diagram = Diagram ( )
69
75
70
76
fs. compute ( sites: sites, diagram: & diagram, clippingRect: clippingRect)
71
77
setNeedsDisplay ( )
72
78
// ----------------------------------------------------
79
+
73
80
74
81
75
82
// var site = gesture.location(in: self).point
@@ -127,17 +134,17 @@ class VoronoiView: UIView {
127
134
context. drawLine (
128
135
from: o. cgPoint,
129
136
to: d. cgPoint,
130
- color: UIColor . black. withAlphaComponent ( 1 ) , lineWidth: 2.0
137
+ color: UIColor . black. withAlphaComponent ( 0. 1) , lineWidth: 2.0
131
138
)
132
139
context. drawVertex ( cell. site)
133
140
134
141
he = he? . next
135
142
finish = he === cell. outerComponent
136
143
}
137
144
// context.drawPolygonFromCCWPoints(points, color: (cell.site.satellite as! UIColor).withAlphaComponent(0.2))
138
- context. drawPolygonFromCCWPoints ( points, color: UIColor . random ( ) . withAlphaComponent ( 0.2 ) )
145
+ // context.drawPolygonFromCCWPoints(points, color: UIColor.random().withAlphaComponent(0.2))
139
146
140
- let path = UIBezierPath . roundedCornersPath ( points. map { $0. cgPoint } , 10 )
147
+ let path = UIBezierPath . roundedCornersPath ( points. map { $0. cgPoint } , 40 )
141
148
context. addPath ( path. cgPath)
142
149
context. drawPath ( using: . stroke)
143
150
}
0 commit comments