fix conflicts
BIN
docs/images/lib2-px_circle-1.JPG
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
docs/images/lib2-px_circle-2.JPG
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/images/lib2-px_cylinder-1.JPG
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
docs/images/lib2-px_cylinder-2.JPG
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
docs/images/lib2-px_line-1.JPG
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/lib2-px_line-2.JPG
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/lib2-px_polygon-1.JPG
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
docs/images/lib2-px_polyline-1.JPG
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
docs/images/lib2-px_polyline-2.JPG
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
docs/images/lib2-px_sphere-1.JPG
Normal file
After Width: | Height: | Size: 30 KiB |
@@ -4,8 +4,6 @@ Extrudes a 2D shape along the path of an archimedean spiral.
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
Dependencies: `rotate_p`, `archimedean_spiral`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a path, the `bezier_smooth` function uses bazier curves to smooth all corners. You can use it to create smooth lines or rounded shapes.
|
||||
|
||||
Dependencies: the `bezier_curve` function.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `path_pts` : A list of points represent the path.
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a set of control points, the `bezier_surface` function returns points of the Bézier surface. Combined with the `function_grapher` module defined in my library, you can create a Bézier surface.
|
||||
|
||||
It depends on the `bezier_curve` function so remember to include bezier_curve.scad.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `t_step` : The distance between two points of the Bézier path.
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a 2D shape, points and angles along the path, this function will return all cross-sections. Combined with the `polysections` module, you can create a specific path extrusion.
|
||||
|
||||
It depends on the `rotate_p` function. Remember to include "rotate_p.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts`: A list of points represent a shape. See the example below.
|
||||
|
@@ -4,8 +4,6 @@ Uses spherical coordinate system to create a crystal ball.
|
||||
|
||||

|
||||
|
||||
Dependencies: `rotate_p`, `cross_sections`, `polysections`, `ring_extrude`, `shape_pie`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radial distance r.
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a set of points `[x, y, f(x, y)]` where `f(x, y)` is a mathematics function, the `function_grapher` module can create the graph of `f(x, y)`.
|
||||
|
||||
It depends on the `line3d`, `polyline3d`, `hull_polyline3d` modules so you have to include "line3d.scad", "polyline3d.scad" and "hull_polyline3d.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A set of points `[x, y, f(x, y)]`. See examples below.
|
||||
|
@@ -4,8 +4,6 @@ Gets all points and angles on the path of a golden spiral based on Fibonacci num
|
||||
|
||||
It returns a vector of `[[x, y], angle]`.
|
||||
|
||||
Because of depending on `circle_path` and `rotate_p`, remember to include "circle_path.scad" and "rotate_p.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `from` : The nth Fibonacci number you wanna start from.
|
||||
|
@@ -4,8 +4,6 @@ Extrudes a 2D shape along the path of a golden spiral.
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
Dependencies: `circle_path`, `rotate_p`, `golden_spiral`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -6,8 +6,6 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
|
||||
Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module.
|
||||
|
||||
Dependencies: `helix`, `rotate_p`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -1,46 +0,0 @@
|
||||
# log
|
||||
|
||||
A log module which supports simple level configurations and color titles.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `$log_level` : The accepted values are `"OFF"` (-1), `"INFO"` (20),
|
||||
`"WARNING"` (30), `"ERROR"` (40) or positive integers. The default value is `"INFO"`.
|
||||
- `level` : The accepted values are `"OFF"` (-1), `"INFO"` (20),
|
||||
`"WARNING"` (30), `"ERROR"` (40) or positive integers. If the value is greater or equal to `$log_level`, the `echo` message will display in the console.
|
||||
- `level_color` : Controls the color of level title. It accepts the same values as the CSS `color` property.
|
||||
|
||||
## Examples
|
||||
|
||||
include <log.scad>;
|
||||
|
||||
log()
|
||||
echo(" INFO message");
|
||||
|
||||
log("WARNING")
|
||||
echo(" WARNING message");
|
||||
|
||||
log("ERROR") {
|
||||
echo(" ERROR message 1");
|
||||
echo(" ERROR message 2");
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <log.scad>;
|
||||
|
||||
$log_level = "WARNING";
|
||||
|
||||
log()
|
||||
echo(" INFO message");
|
||||
|
||||
log("WARNING", "purple")
|
||||
echo(" WARNING message");
|
||||
|
||||
log("ERROR", "rgb(255, 100, 100)") {
|
||||
echo(" ERROR message 1");
|
||||
echo(" ERROR message 2");
|
||||
}
|
||||
|
||||

|
||||
|
@@ -1,16 +0,0 @@
|
||||
# parse_number
|
||||
|
||||
Parses the string argument as an number. It depends on the `split_str` and the `sub_str` functions so remember to include split_str.scad and sub_str.scad.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `t` : A string containing the number representation to be parsed.
|
||||
|
||||
## Examples
|
||||
|
||||
include <sub_str.scad>;
|
||||
include <split_str.scad>;
|
||||
include <parse_number.scad>;
|
||||
|
||||
echo(parse_number("10") + 1); // ECHO: 11
|
||||
echo(parse_number("-1.1") + 1); // ECHO: -0.1
|
@@ -2,8 +2,6 @@
|
||||
|
||||
It extrudes a 2D shape along a path. This module is suitable for a path created by a continuous function.
|
||||
|
||||
It depends on the `rotate_p` function and the `polysections` module. Remember to include "rotate_p.scad" and "polysections.scad".
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
## Parameters
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# polyline2d
|
||||
|
||||
Creates a polyline from a list of `x`, `y` coordinates. When the end points are `CAP_ROUND`, you can use `$fa`, `$fs` or `$fn` to controll the circle module used internally. It depends on the `line2d` module so you have to `include` line2d.scad.
|
||||
Creates a polyline from a list of `x`, `y` coordinates. When the end points are `CAP_ROUND`, you can use `$fa`, `$fs` or `$fn` to controll the circle module used internally.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# polyline3d
|
||||
|
||||
Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `line3d` module so you have to `include` line3d.scad.
|
||||
Creates a polyline from a list of `[x, y, z]` coordinates.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
@@ -4,8 +4,6 @@ Rotational extrusion spins a 2D shape around the Z-axis. It's similar to the bui
|
||||
|
||||
Because we cannot retrieve the shape points of built-in 2D modules, it's necessary to provide `shapt_pts` and `triangles`.
|
||||
|
||||
This module depends on `rotate_p`, `cross_section` and `polysections`. Remember to include corresponding ".scad".
|
||||
|
||||
If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
## Parameters
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Returns shape points of two glued circles. They can be used with xxx_extrude modules of dotSCAD. The shape points can be also used with the built-in polygon module.
|
||||
|
||||
Dependencies: `rotate_p`, `bezier_curve`, `shape_pie`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radius of two circles.
|
||||
|
@@ -4,8 +4,6 @@ It extends a 2D stroke along a path to create a 2D shape. This module is suitabl
|
||||
|
||||
When using this function, you should use points to represent the 2D stroke.
|
||||
|
||||
It depends on the `rotate_p` function. Remember to include "rotate_p.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `stroke_pts` : A list of points represent a stroke. See the example below.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# sphere_spiral
|
||||
|
||||
Creates all points and angles on the path of a spiral around a sphere. It returns a vector of `[[x, y, z], [ax, ay, az]]`. `[x, y, z]` is actually obtained from rotating `[radius, 0, 0]` by `[ax, ay, az]`. It depends on the `rotate_p` function. Remember to include rotate_p.scad first.
|
||||
Creates all points and angles on the path of a spiral around a sphere. It returns a vector of `[[x, y, z], [ax, ay, az]]`. `[x, y, z]` is actually obtained from rotating `[radius, 0, 0]` by `[ax, ay, az]`.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
@@ -4,8 +4,6 @@ Extrudes a 2D shape along the path of a sphere spiral.
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
Dependencies: `rotate_p`, `sphere_spiral`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -6,14 +6,16 @@ The power of using transformation matrice is that you can cumulate all transform
|
||||
|
||||
## Parameters
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
- `matrice` : A list of 4x4 transformation matrice.
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_rotation.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <m_translation.scad>;
|
||||
include <m_cumulate.scad>
|
||||
include <matrix/m_rotation.scad>;
|
||||
include <matrix/m_scaling.scad>;
|
||||
include <matrix/m_translation.scad>;
|
||||
include <matrix/m_cumulate.scad>
|
||||
|
||||
m = m_cumulate([
|
||||
m_translation([10, 20, 10]), m_scaling(2), m_rotation(60)]
|
25
docs/lib2-m_mirror.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# m_mirror
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to mirror the child element on a plane through the origin.
|
||||
|
||||
**Since:** 1.1
|
||||
|
||||
## Parameters
|
||||
|
||||
- `v` : The normal vector of a plane intersecting the origin through which to mirror the object.
|
||||
|
||||
## Examples
|
||||
|
||||
include <matrix/m_mirror.scad>;
|
||||
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||
multmatrix(m_mirror([1, 1, 0]))
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||

|
||||
|
@@ -1,5 +1,7 @@
|
||||
# m_rotation
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate the child element about the axis of the coordinate system or around an arbitrary axis.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -11,7 +13,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_rotation.scad>;
|
||||
include <matrix/m_rotation.scad>;
|
||||
|
||||
point = [20, 0, 0];
|
||||
a = [0, -45, 45];
|
@@ -1,5 +1,7 @@
|
||||
# m_scaling
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale its child elements using the specified vector.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -10,7 +12,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale i
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_scaling.scad>;
|
||||
include <matrix/m_scaling.scad>;
|
||||
|
||||
cube(10);
|
||||
translate([15, 0, 0])
|
@@ -1,5 +1,7 @@
|
||||
# m_shearing
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to shear all child elements along the X-axis, Y-axis, or Z-axis in 3D.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -12,7 +14,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to shear a
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_shearing.scad>;
|
||||
include <matrix/m_shearing.scad>;
|
||||
|
||||
color("red") {
|
||||
multmatrix(m_shearing(sx = [1, 0]))
|
@@ -1,5 +1,7 @@
|
||||
# m_translation
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to translates (moves) its child elements along the specified vector.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -10,7 +12,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to transla
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_translation.scad>;
|
||||
include <matrix/m_translation.scad>;
|
||||
|
||||
cube(2, center = true);
|
||||
multmatrix(m_translation([5, 0, 0]))
|
18
docs/lib2-parse_number.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# parse_number
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Parses the string argument as an number.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `t` : A string containing the number representation to be parsed.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/sub_str.scad>;
|
||||
include <util/split_str.scad>;
|
||||
include <util/parse_number.scad>;
|
||||
|
||||
echo(parse_number("10") + 1); // ECHO: 11
|
||||
echo(parse_number("-1.1") + 1); // ECHO: -0.1
|
@@ -18,7 +18,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
include <hull_polyline3d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
|
||||
taiwan = shape_taiwan(100);
|
||||
@@ -42,7 +41,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
include <hull_polyline3d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
|
||||
@@ -67,7 +65,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <rotate_p.scad>;
|
||||
@@ -105,7 +102,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
include <hull_polyline3d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
include <rotate_p.scad>;
|
||||
|
32
docs/lib2-px_circle.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# px_circle
|
||||
|
||||
Returns points that can be used to draw a pixel-style circle.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The circle radius. The value must be an integer.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled circle.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_circle.scad>;
|
||||
|
||||
for(pt = px_circle(10)) {
|
||||
translate(pt)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_circle.scad>;
|
||||
|
||||
for(pt = px_circle(10, filled = true)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
33
docs/lib2-px_cylinder.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# px_cylinder
|
||||
|
||||
Returns points that can be used to draw a pixel-style cylinder.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radius of the cylinder. It also accepts a vector `[r1, r2]`. `r1` is the bottom radius and `r2` is the top radius of a cone. Values must be an integer.
|
||||
- `h` : The height of the cylinder or cone.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled cylinder.
|
||||
- `thickness`: Default to 1. The thickness when `filled` is `false`. The value must be an integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_cylinder.scad>;
|
||||
|
||||
for(pt = px_cylinder([10, 15], 10)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_cylinder.scad>;
|
||||
|
||||
for(pt = px_cylinder([20, 15], h = 10, thickness = 3)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
31
docs/lib2-px_line.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# px_line
|
||||
|
||||
Given two points. `px_line` returns points that can be used to draw a pixel-style line.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `p1` : The start point `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
||||
- `p2` : The end point `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
|
||||
for(pt = px_line([-10, 0], [20, 50])) {
|
||||
translate(pt)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
|
||||
for(pt = px_line([-10, 0, -10], [20, 50, 10])) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
39
docs/lib2-px_polygon.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# px_polygon
|
||||
|
||||
Returns points that can be used to draw a pixel-style polygon.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of points. Each point can be `[x, y]`. x, y must be integer.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled polygon.
|
||||
|
||||
## Examples
|
||||
|
||||
include <in_shape.scad>;
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <pixel/px_polygon.scad>;
|
||||
include <shape_pentagram.scad>;
|
||||
|
||||
pentagram = [
|
||||
for(pt = shape_pentagram(15))
|
||||
[round(pt[0]), round(pt[1])]
|
||||
];
|
||||
|
||||
for(pt = px_polygon(pentagram)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||
translate([30, 0])
|
||||
for(pt = px_polygon(pentagram, filled = true)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
55
docs/lib2-px_polyline.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# px_polyline
|
||||
|
||||
Given a list of points. `px_polyline` returns points that can be used to draw a pixel-style polyline.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of points. Each point can be `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <shape_pentagram.scad>;
|
||||
|
||||
pentagram = [
|
||||
for(pt = shape_pentagram(15))
|
||||
[round(pt[0]), round(pt[1])]
|
||||
];
|
||||
|
||||
for(pt = px_polyline(concat(pentagram, [pentagram[0]]))) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <sphere_spiral.scad>;
|
||||
|
||||
points_angles = sphere_spiral(
|
||||
radius = 20,
|
||||
za_step = 5
|
||||
);
|
||||
|
||||
points = [
|
||||
for(pa = points_angles)
|
||||
let(pt = pa[0])
|
||||
[round(pt[0]), round(pt[1]), round(pt[2])]
|
||||
];
|
||||
|
||||
for(a = [0:30:330]) {
|
||||
rotate(a)
|
||||
for(pt = px_polyline(points)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
}
|
||||
|
||||

|
||||
|
22
docs/lib2-px_sphere.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# px_sphere
|
||||
|
||||
Returns points that can be used to draw a pixel-style sphere.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radius of the sphere. The value must be an integer.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled sphere.
|
||||
- `thickness`: Default to 1. The thickness when `filled` is `false`. The value must be an integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_sphere.scad>;
|
||||
|
||||
for(pt = px_sphere(10)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
16
docs/lib2-reverse.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# reverse
|
||||
|
||||
Reverse a list.
|
||||
|
||||
**Since: **: 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The list to be reversed.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/reverse.scad>;
|
||||
|
||||
echo(reverse([1, 2, 3])); // ECHO: [3, 2, 1]
|
||||
|
18
docs/lib2-slice.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# slice
|
||||
|
||||
Returns a list selected from `begin` to `end`, or to the `end` of the list (`end` not included).
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The original list.
|
||||
- `begin` : The beginning index, inclusive.
|
||||
- `end` : The ending index, exclusive. If it's omitted, the list begins with the character at the specified `begin` and extends to the end of the original list.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/slice.scad>;
|
||||
|
||||
echo(slice([for(c = "helloworld") c], 0, 5)); // ECHO: ["h", "e", "l", "l", "o"]
|
||||
echo(slice([for(c = "helloworld") c], 5)); // ECHO: ["w", "o", "r", "l", "d"]
|
32
docs/lib2-sort.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# sort
|
||||
|
||||
Sorts the elements of a list in ascending order. The list is a list-of-list construct, such as `[[a0, a1, a2...], [b0, b1, b2,...], [c0, c1, c2,...],...]`. When sorting, the function looks only at one index position of each sublist.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The original list.
|
||||
- `by` : Can be `"x"`、`"y"`、`"z"`, or `"idx"` (Default).
|
||||
- `idx` : When `by` is `"idx"`, the value of `idx` is used. The Default value is 0.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/sort.scad>;
|
||||
|
||||
assert(
|
||||
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]] ==
|
||||
sort([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]])
|
||||
);
|
||||
|
||||
assert(
|
||||
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]] ==
|
||||
sort([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]], by = "x")
|
||||
);
|
||||
|
||||
assert(
|
||||
[[0, 2, 0], [0, 5, 0], [0, 7, 0], [0, 9, 0], [0, 10, 0]] ==
|
||||
sort([[0, 10, 0], [0, 5, 0], [0, 7, 0], [0, 2, 0], [0, 9, 0]], by = "idx", idx = 1)
|
||||
);
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# split_str
|
||||
|
||||
Splits the given string around matches of the given delimiting character. It depeneds on the `sub_str` function so remember to `include <sub_str.scad>`.
|
||||
The dir changed since 2.0.
|
||||
|
||||
Splits the given string around matches of the given delimiting character.
|
||||
|
||||
## Parameters
|
||||
|
||||
@@ -9,8 +11,8 @@ Splits the given string around matches of the given delimiting character. It dep
|
||||
|
||||
## Examples
|
||||
|
||||
include <sub_str.scad>;
|
||||
include <split_str.scad>;
|
||||
include <util/sub_str.scad>;
|
||||
include <util/split_str.scad>;
|
||||
|
||||
echo(split_str("hello,world", ",")); // ECHO: ["hello", "world"]
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# sub_str
|
||||
|
||||
Returns a new string that is a substring of the given string.
|
||||
The dir changed since 2.0.
|
||||
|
||||
Returns the part of the string from `begin` to `end`, or to the `end` of the string (`end` not included).
|
||||
|
||||
## Parameters
|
||||
|
||||
@@ -10,7 +12,7 @@ Returns a new string that is a substring of the given string.
|
||||
|
||||
## Examples
|
||||
|
||||
include <sub_str.scad>;
|
||||
include <util/sub_str.scad>;
|
||||
|
||||
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
|
||||
echo(sub_str("helloworld", 5)); // ECHO: "world"
|
@@ -1,5 +1,7 @@
|
||||
# turtle2d
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can get the cooridinate `[x, y]` or `angle` of its current position.
|
||||
|
||||
## Parameters
|
||||
@@ -16,7 +18,7 @@ An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can
|
||||
## Examples
|
||||
|
||||
include <line2d.scad>;
|
||||
include <turtle2d.scad>;
|
||||
include <turtle/turtle2d.scad>;
|
||||
|
||||
module turtle_spiral(t_before, times, side_leng, angle, width) {
|
||||
$fn = 24;
|
||||
@@ -47,7 +49,7 @@ An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can
|
||||

|
||||
|
||||
include <line2d.scad>;
|
||||
include <turtle2d.scad>;
|
||||
include <turtle/turtle2d.scad>;
|
||||
|
||||
module turtle_spiral(t_before, side_leng, d_step, min_leng, angle, width) {
|
||||
$fn = 24;
|
@@ -1,11 +1,11 @@
|
||||
# turtle3d
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
An OpenSCAD implementation of 3D Turtle Graphics. When using the function, imagine that you are sitting on the turtle. You move or turn the turtle from the your viewpoint, not the viewpoint of OpenSCAD coordinates.
|
||||
|
||||
For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/OpenSCAD/3DTurtleGraphics.html).
|
||||
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
- `cmd` : A string command. Different commands use different numbers of arguments.
|
||||
@@ -17,7 +17,7 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op
|
||||
|
||||
## Examples
|
||||
|
||||
include <turtle3d.scad>;
|
||||
include <turtle/turtle3d.scad>;
|
||||
include <hull_polyline3d.scad>;
|
||||
|
||||
leng = 10;
|
||||
@@ -47,7 +47,7 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op
|
||||
|
||||

|
||||
|
||||
include <turtle3d.scad>;
|
||||
include <turtle/turtle3d.scad>;
|
||||
include <hull_polyline3d.scad>;
|
||||
|
||||
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|