blob: 7a3195d2591597c1c9368e8c22ce91835b0f971c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
let polarToCartesian centerX centerY radius angleInDegrees =
let angleInRadians = (angleInDegrees -. 90.0) *. Js.Math._PI /. 180.0 in
( centerX +. (radius *. Js.Math.cos angleInRadians),
centerY +. (radius *. Js.Math.sin angleInRadians) )
let describe x y radius startAngle endAngle =
let startX, startY = polarToCartesian x y radius endAngle in
let endX, endY = polarToCartesian x y radius startAngle in
let largeArcFlag = if endAngle -. startAngle <= 180.0 then "0" else "1" in
[|
"M";
Js.Float.toString startX;
Js.Float.toString startY;
"A";
Js.Float.toString radius;
Js.Float.toString radius;
"0";
largeArcFlag;
"0";
Js.Float.toString endX;
Js.Float.toString endY;
|]
|> Js.Array.joinWith " "
|