mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 20:11:50 +02:00
add
This commit is contained in:
@@ -88,6 +88,7 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
|||||||
- [shape_trapezium](https://openhome.cc/eGossip/OpenSCAD/lib-shape_trapezium.html)
|
- [shape_trapezium](https://openhome.cc/eGossip/OpenSCAD/lib-shape_trapezium.html)
|
||||||
- [shape_cyclicpolygon](https://openhome.cc/eGossip/OpenSCAD/lib-shape_cyclicpolygon.html)
|
- [shape_cyclicpolygon](https://openhome.cc/eGossip/OpenSCAD/lib-shape_cyclicpolygon.html)
|
||||||
- [shape_pentagram](https://openhome.cc/eGossip/OpenSCAD/lib-shape_pentagram.html)
|
- [shape_pentagram](https://openhome.cc/eGossip/OpenSCAD/lib-shape_pentagram.html)
|
||||||
|
- [shape_starburst](https://openhome.cc/eGossip/OpenSCAD/lib-shape_starburst.html)
|
||||||
- [shape_superformula](https://openhome.cc/eGossip/OpenSCAD/lib-shape_superformula.html)
|
- [shape_superformula](https://openhome.cc/eGossip/OpenSCAD/lib-shape_superformula.html)
|
||||||
- [shape_glued2circles](https://openhome.cc/eGossip/OpenSCAD/lib-shape_glued2circles.html)
|
- [shape_glued2circles](https://openhome.cc/eGossip/OpenSCAD/lib-shape_glued2circles.html)
|
||||||
- [shape_path_extend](https://openhome.cc/eGossip/OpenSCAD/lib-shape_path_extend.html)
|
- [shape_path_extend](https://openhome.cc/eGossip/OpenSCAD/lib-shape_path_extend.html)
|
||||||
|
BIN
docs/images/lib-shape_starburst-1.JPG
Normal file
BIN
docs/images/lib-shape_starburst-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
docs/images/lib-shape_starburst-2.JPG
Normal file
BIN
docs/images/lib-shape_starburst-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
39
docs/lib-shape_starburst.md
Normal file
39
docs/lib-shape_starburst.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# shape_starburst
|
||||||
|
|
||||||
|
Returns shape points of a star. They can be used with xxx_extrude modules of dotSCAD. The shape points can be also used with the built-in polygon module.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- `r1` : The outer radius of the starburst.
|
||||||
|
- `r2` : The inner radius of the starburst.
|
||||||
|
- `n` : The number of vertices.
|
||||||
|
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
include <shape_starburst.scad>;
|
||||||
|
|
||||||
|
polygon(shape_starburst(30, 12, 6));
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
include <shape_starburst.scad>;
|
||||||
|
include <circle_path.scad>;
|
||||||
|
include <rotate_p.scad>;
|
||||||
|
include <golden_spiral.scad>;
|
||||||
|
include <cross_sections.scad>;
|
||||||
|
include <polysections.scad>;
|
||||||
|
include <golden_spiral_extrude.scad>;
|
||||||
|
|
||||||
|
shape_pts = shape_starburst(5, 2, 8);
|
||||||
|
|
||||||
|
golden_spiral_extrude(
|
||||||
|
shape_pts,
|
||||||
|
from = 5,
|
||||||
|
to = 10,
|
||||||
|
point_distance = 1,
|
||||||
|
scale = 10
|
||||||
|
);
|
||||||
|
|
||||||
|

|
||||||
|
|
31
src/shape_starburst.scad
Normal file
31
src/shape_starburst.scad
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* shape_star.scad
|
||||||
|
*
|
||||||
|
* Returns shape points of a starburst.
|
||||||
|
* They can be used with xxx_extrude modules of dotSCAD.
|
||||||
|
* The shape points can be also used with the built-in polygon module.
|
||||||
|
*
|
||||||
|
* @copyright Justin Lin, 2017
|
||||||
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
|
*
|
||||||
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib-shape_starburst.html
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
function __outer_points(r1, r2, n) =
|
||||||
|
let(
|
||||||
|
a = 360 / n
|
||||||
|
)
|
||||||
|
[for(i = [0:n-1]) [r1 * cos(a * i), r1 * sin(a * i)]];
|
||||||
|
function __inner_points(r1, r2, n) =
|
||||||
|
let (
|
||||||
|
a = 360 / n,
|
||||||
|
half_a = a / 2
|
||||||
|
)
|
||||||
|
[for(i = [0:n-1]) [r2 * cos(a * i + half_a), r2 * sin(a * i + half_a)]];
|
||||||
|
|
||||||
|
function __one_by_one(outer_points, inner_points, i = 0) =
|
||||||
|
len(outer_points) == i ? [] :
|
||||||
|
concat([outer_points[i], inner_points[i]], __one_by_one(outer_points, inner_points, i + 1));
|
||||||
|
|
||||||
|
function shape_starburst(r1, r2, n) = __one_by_one(__outer_points(r1, r2, n), __inner_points(r1, r2, n));
|
Reference in New Issue
Block a user