@@ -262,12 +262,12 @@ defmodule Scenic.Primitives do
262
262
263
263
An arc is the outer edge of a part of a circle or ellipse. It
264
264
is the sort of thing you would use a compass to draw on a piece
265
- of paper. It has a radius, a start angle and an ending angle. The
266
- angles are specified in radians.
265
+ of paper. It has a radius, and angle that defines how much of
266
+ the arc to sweep through. The angle is specified in radians.
267
267
268
268
Data:
269
269
270
- {radius, start, finish }
270
+ {radius, angle }
271
271
272
272
If you want something that looks like a piece of pie (maybe for a
273
273
pie chart??), then you want a Sector, not an Arc.
@@ -279,7 +279,16 @@ defmodule Scenic.Primitives do
279
279
starting straight out to the right, then going down 0.4 radians.
280
280
281
281
graph
282
- |> arc( {100, 0, 0.4} )
282
+ |> arc( {100, 0.6} )
283
+
284
+ ### Note
285
+
286
+ The format for Arc has changed since v0.10. It used to be
287
+ {radius, start_angle, end_angle}. You can achieve the same effect in the
288
+ new, simpler format by using the same radius and the new angle is the
289
+ difference between the old end_angle and start_angle. Then you can apply
290
+ a rotation transform to get it in the right position.
291
+
283
292
284
293
### Styles
285
294
@@ -296,12 +305,12 @@ defmodule Scenic.Primitives do
296
305
Example:
297
306
298
307
graph
299
- |> arc( {100, 0, 0 .4}, stroke: {4, :blue} )
308
+ |> arc( {100, 0.4}, stroke: {4, :blue} )
300
309
301
310
"""
302
311
@ spec arc (
303
312
source :: Graph . t ( ) | Primitive . t ( ) ,
304
- arc :: { radius :: number , start :: number , finish :: number } ,
313
+ arc :: { radius :: number , angle :: number } ,
305
314
options :: list
306
315
) :: Graph . t ( ) | Primitive . t ( )
307
316
@@ -325,10 +334,19 @@ defmodule Scenic.Primitives do
325
334
326
335
arc = arc_spec( {100, 0, 0.4}, stroke: {4, :blue} )
327
336
graph = arc.(graph)
337
+
338
+
339
+ ### Note
340
+
341
+ The format for Arc has changed since v0.10. It used to be
342
+ {radius, start_angle, end_angle}. You can achieve the same effect in the
343
+ new, simpler format by using the same radius and the new angle is the
344
+ difference between the old end_angle and start_angle. Then you can apply
345
+ a rotation transform to get it in the right position.
328
346
"""
329
347
330
348
@ spec arc_spec (
331
- arc :: { radius :: number , start :: number , finish :: number } ,
349
+ arc :: { radius :: number , angle :: number } ,
332
350
options :: list
333
351
) :: Graph . deferred ( )
334
352
@@ -1086,20 +1104,28 @@ defmodule Scenic.Primitives do
1086
1104
Add a sector to a graph
1087
1105
1088
1106
A sector looks like a piece of pie. It is wedge shaped with a pointy
1089
- bit on one side and a rounded bit on the other. It has a radius, a
1090
- start angle and a finish angle . The angles are specified in radians.
1107
+ bit on one side and a rounded bit on the other. It has a radius, and angle that
1108
+ defines how much of the arc to sweep through . The angle is specified in radians.
1091
1109
1092
1110
Data:
1093
1111
1094
- {radius, start, finish }
1112
+ {radius, angle }
1095
1113
1096
1114
To create a sector of an ellipse, create a normal sector, and apply
1097
1115
a `:scale` transform with unequal x and y sizing.
1098
1116
1099
1117
The following example will draw a sector with a radius of 100,
1100
1118
starting straight out to the right, then going down 0.4 radians.
1101
1119
1102
- |> sector( {100, 0, 0.4} )
1120
+ |> sector( {100, 0.4} )
1121
+
1122
+ ### Note
1123
+
1124
+ The format for Sector has changed since v0.10. It used to be
1125
+ {radius, start_angle, end_angle}. You can achieve the same effect in the
1126
+ new, simpler format by using the same radius and the new angle is the
1127
+ difference between the old end_angle and start_angle. Then you can apply
1128
+ a rotation transform to get it in the right position.
1103
1129
1104
1130
### Styles
1105
1131
@@ -1155,8 +1181,16 @@ defmodule Scenic.Primitives do
1155
1181
1156
1182
Example:
1157
1183
1158
- sector = sector_spec( {100, 0, 0 .4}, fill: :red )
1184
+ sector = sector_spec( {100, 0.4}, fill: :red )
1159
1185
graph = sector.(graph)
1186
+
1187
+ ### Note
1188
+
1189
+ The format for Sector has changed since v0.10. It used to be
1190
+ {radius, start_angle, end_angle}. You can achieve the same effect in the
1191
+ new, simpler format by using the same radius and the new angle is the
1192
+ difference between the old end_angle and start_angle. Then you can apply
1193
+ a rotation transform to get it in the right position.
1160
1194
"""
1161
1195
1162
1196
@ spec sector_spec (
0 commit comments