1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 06:08:31 +01:00
dotSCAD/docs/lib3x-ptf_circle.md

44 lines
1.0 KiB
Markdown
Raw Normal View History

2020-03-26 17:33:35 +08:00
# ptf_circle
Transform a point inside a rectangle to a point inside a circle. You can use it to create something such as a [noisy circle maze](https://github.com/JustinSDK/dotSCAD/blob/master/examples/maze/noisy_circle_maze.scad).
2021-02-24 21:09:54 +08:00
![ptf_circle](images/lib3x-ptf_circle-1.JPG)
2020-03-26 17:33:35 +08:00
2020-03-27 20:06:19 +08:00
**Since:** 2.3
2020-03-26 17:33:35 +08:00
## Parameters
- `size` : 2 value array `[x, y]`, rectangle with dimensions `x` and `y`.
- `point` : The point to be transformed.
## Examples
2022-06-06 13:11:46 +08:00
use <polyline_join.scad>
use <ptf/ptf_circle.scad>
2020-03-26 17:33:35 +08:00
size = [10, 10];
rows = [
2021-12-04 12:16:20 +08:00
for(y = [0:size.y])
[for(x = [0:size.x]) [x, y]]
2020-03-26 17:33:35 +08:00
];
columns = [
2021-12-04 12:16:20 +08:00
for(x = [0:size.x])
[for(y = [0:size.y]) [x, y]]
2020-03-26 17:33:35 +08:00
];
for(line = rows) {
2020-04-09 14:54:37 +08:00
transformed = [for(p = line) ptf_circle(size, p)];
2021-12-04 10:57:29 +08:00
polyline_join(transformed)
sphere(.05);
2020-03-26 17:33:35 +08:00
}
for(line = columns) {
2020-04-09 14:54:37 +08:00
transformed = [for(p = line) ptf_circle(size, p)];
2021-12-04 10:57:29 +08:00
polyline_join(transformed)
sphere(.05);
2020-03-26 17:33:35 +08:00
}
2021-02-24 21:09:54 +08:00
![ptf_circle](images/lib3x-ptf_circle-2.JPG)