1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
This commit is contained in:
Justin Lin 2020-03-27 20:14:59 +08:00
parent afd0ee52a4
commit 4c92640aaf
6 changed files with 57 additions and 9 deletions

View File

@ -150,7 +150,7 @@ See [examples](examples).
- [ptf/ptf_y_twist](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_y_twist.html)
- [ptf/ptf_circle](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_circle.html)
- [ptf/ptf_bend](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_bend.html)
- ptf/ptf_ring
- [ptf/ptf_ring](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_ring.html)
- ptf/ptf_sphere
- ptf/ptf_torus

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

45
docs/lib2x-ptf_ring.md Normal file
View File

@ -0,0 +1,45 @@
# ptf_ring
Transforms a point inside a rectangle to a point of a ring. It can create things such as [tiled_line_mobius](https://github.com/JustinSDK/dotSCAD/blob/master/examples/tiled_line_mobius.scad).
![ptf_ring](images/lib2x-ptf_ring-1.JPG)
**Since:** 2.3
## Parameters
- `size` : 2 value array `[x, y]`, rectangle with dimensions `x` and `y`.
- `point` : The point to be transformed.
- `radius` : The radius of the ring.
- `angle` : The central angle of the arc.
- `twist` : The number of degrees of through which the rectangle is twisted.
## Examples
use <hull_polyline3d.scad>;
use <ptf/ptf_ring.scad>;
size = [20, 10];
radius = 5;
rows = [
for(y = [0:size[1]])
[for(x = [0:size[0]]) [x, y]]
];
columns = [
for(x = [0:size[0]])
[for(y = [0:size[1]]) [x, y]]
];
for(line = rows) {
twisted = [for(p = line) ptf_ring(size, p, radius, 360, 180)];
hull_polyline3d(twisted, thickness = .5);
}
for(line = columns) {
twisted = [for(p = line) ptf_ring(size, p, radius, 360, 180)];
hull_polyline3d(twisted, thickness = .5);
}
![ptf_ring](images/lib2x-ptf_ring-2.JPG)

View File

@ -39,4 +39,4 @@ Twist a point along the x-axis. You can use it to create something such as a [tw
hull_polyline3d(twisted, thickness = .1);
}
![ptf_x_twist](images/lib2x-ptf_x_twist-1.JPG)
![ptf_x_twist](images/lib2x-ptf_x_twist-2.JPG)

View File

@ -1,13 +1,16 @@
/**
* ptf_ring.scad
*
* @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_ring.html
*
**/
use <ptf/ptf_rotate.scad>;
use <ptf/ptf_y_twist.scad>;
/*
size: The size of a rectangle.
point: A point in the rectangle.
radius: ring radius.
angle: arc angle.
twist: The number of degrees of through which the rectangle is twisted.
*/
function ptf_ring(size, point, radius, angle = 360, twist = 0) =
let(
yleng = size[1],