1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00

use shape_circle

This commit is contained in:
Justin Lin 2020-03-23 16:49:50 +08:00
parent adaf8f9e05
commit 8e0662490b
4 changed files with 38 additions and 9 deletions

View File

@ -13,11 +13,11 @@ Puts children along the given path. If there's only one child, it will put the c
## Examples
use <along_with.scad>;
use <circle_path.scad>;
use <shape_circle.scad>;
$fn = 24;
points = circle_path(radius = 50);
points = shape_circle(radius = 50);
along_with(points)
sphere(5);
@ -25,11 +25,11 @@ Puts children along the given path. If there's only one child, it will put the c
![along_with](images/lib-along_with-1.JPG)
use <along_with.scad>;
use <circle_path.scad>;
use <shape_circle.scad>;
$fn = 24;
points = circle_path(radius = 50);
points = shape_circle(radius = 50);
along_with(points) {
linear_extrude(10, center = true) text("A", valign = "center", halign = "center");

View File

@ -38,14 +38,14 @@ When using this module, you should use points to represent the 2D shape. If your
![golden_spiral_extrude](images/lib-golden_spiral_extrude-1.JPG)
use <circle_path.scad>;
use <shape_circle.scad>;
use <golden_spiral_extrude.scad>;
$fn = 12;
shape_pts = concat(
circle_path(radius = 3),
circle_path(radius = 2)
shape_circle(radius = 3),
shape_circle(radius = 2)
);
golden_spiral_extrude(

View File

@ -0,0 +1,29 @@
# shape_circle
Sometimes you need all points on the path of a circle. Here's the function. Its `$fa`, `$fs` and `$fn` parameters are consistent with the `circle` module.
## Parameters
- `radius` : The radius of the circle.
- `n` : The number of points you want. It's not greater than the fragments of the circle.
- `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details.
## Examples
use <shape_circle.scad>;
$fn = 24;
points = shape_circle(radius = 50);
polygon(points);
leng = len(points);
step_angle = 360 / leng;
for(i = [0:leng - 1]) {
translate(points[i])
rotate([90, 0, 90 + i * step_angle])
linear_extrude(1, center = true)
text("A", valign = "center", halign = "center");
}
![shape_circle](images/lib-shape_circle-1.JPG)

View File

@ -14,13 +14,13 @@ When using this function, you should use points to represent the 2D stroke.
## Examples
use <shape_path_extend.scad>;
use <circle_path.scad>;
use <shape_circle.scad>;
use <archimedean_spiral.scad>;
$fn = 96;
stroke1 = [[-5, 2.5], [-2.5, 0], [0, 2.5], [2.5, 0], [5, 2.5]];
path_pts1 = circle_path(50, 60);
path_pts1 = shape_circle(50, 60);
polygon(
shape_path_extend(stroke1, path_pts1)
);