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

48 lines
1.2 KiB
Markdown
Raw Normal View History

2020-03-30 09:24:15 +08:00
# 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) {
2020-04-09 14:54:37 +08:00
transformed = [for(p = line) ptf_torus(size, p, radius, angle, twist)];
hull_polyline3d(transformed, thickness = .5);
2020-03-30 09:24:15 +08:00
}
for(line = columns) {
2020-04-09 14:54:37 +08:00
transformed = [for(p = line) ptf_torus(size, p, radius, angle, twist)];
hull_polyline3d(transformed, thickness = .5);
2020-03-30 09:24:15 +08:00
}
![ptf_torus](images/lib2x-ptf_torus-2.JPG)