# 扇形與弧形

Heart chain with text（後來還有盤起來的版本 Text heart chain），是還蠻受歡迎的小創作，想必是有許多人印來送給（小）情人吧！

# 扇形

``````radius = 10;
angles = [45, 135];
points = [
];
polygon(concat([[0, 0]], points));
``````

``````radius = 20;
angles = [45, 135];
fn = 12;

module sector(radius, angles, fn = 24) {
step = -360 / fn;

points = concat([[0, 0]],
[for(a = [angles[0] : step : angles[1] - 360])
],
);

difference() {
#polygon(points);
}
}

``````

``````a = 180 / fn;r = radius / cos(a);
``````

``````radius = 20;
angles = [45, 135];
fn = 24;

module sector(radius, angles, fn = 24) {
r = radius / cos(180 / fn);
step = -360 / fn;

points = concat([[0, 0]],
[for(a = [angles[0] : step : angles[1] - 360])
[r * cos(a), r * sin(a)]
],
[[r * cos(angles[1]), r * sin(angles[1])]]
);

difference() {
polygon(points);
}
}

``````

# 弧形

``````radius = 20;
angles = [45, 290];
width = 2;
fn = 24;

module sector(radius, angles, fn = 24) {
r = radius / cos(180 / fn);
step = -360 / fn;

points = concat([[0, 0]],
[for(a = [angles[0] : step : angles[1] - 360])
[r * cos(a), r * sin(a)]
],
[[r * cos(angles[1]), r * sin(angles[1])]]
);

difference() {
polygon(points);
}
}

module arc(radius, angles, width = 1, fn = 24) {
difference() {