1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-29 01:11:30 +02:00
This commit is contained in:
Justin Lin
2020-03-30 09:24:15 +08:00
parent 050a94412a
commit 58cc135db3
4 changed files with 49 additions and 2 deletions

View File

@@ -152,8 +152,8 @@ See [examples](examples).
- [ptf/ptf_bend](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_bend.html)
- [ptf/ptf_ring](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_ring.html)
- [ptf/ptf_sphere](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_sphere.html)
- ptf/ptf_torus
- [ptf/ptf_torus](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_torus.html)
----
- Turtle

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

47
docs/lib2x-ptf_torus.md Normal file
View File

@@ -0,0 +1,47 @@
# ptf_torus
Transforms a point inside a rectangle to a point of a torus. It can create things such as [torus maze](https://github.com/JustinSDK/dotSCAD/blob/master/examples/maze/torus_maze.scad).
![ptf_torus](images/lib2x-ptf_torus-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` : Torus `[R, r]`.
- `angle` : Torus `[A, a]`.
- `twist` : The number of degrees of through which the rectangle is twisted.
## Examples
use <hull_polyline3d.scad>;
use <ptf/ptf_torus.scad>;
size = [20, 10];
radius = [10, 5];
angle = [180, 180];
twist = 90;
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_torus(size, p, radius, angle, twist)];
hull_polyline3d(twisted, thickness = .5);
}
for(line = columns) {
twisted = [for(p = line) ptf_torus(size, p, radius, angle, twist)];
hull_polyline3d(twisted, thickness = .5);
}
![ptf_torus](images/lib2x-ptf_torus-2.JPG)