2020-03-29 14:04:57 +08:00
# ptf_sphere
Transforms a point inside a rectangle to a point of a sphere. It can create things such as [sphere maze ](https://github.com/JustinSDK/dotSCAD/blob/master/examples/maze/sphere_maze.scad ).
2021-02-24 21:09:54 +08:00
![ptf_sphere ](images/lib3x-ptf_sphere-1.JPG )
2020-03-29 14:04:57 +08:00
**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 sphere.
- `angle` : [za, xa] mapping angles.
## Examples
use < hull_polyline3d.scad > ;
use < ptf / ptf_sphere . scad > ;
size = [20, 10];
radius = 5;
angle = [180, 270];
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_sphere(size, p, radius, angle)];
hull_polyline3d(transformed, thickness = .5);
2020-03-29 14:04:57 +08:00
}
for(line = columns) {
2020-04-09 14:54:37 +08:00
transformed = [for(p = line) ptf_sphere(size, p, radius, angle)];
hull_polyline3d(transformed, thickness = .5);
2020-03-29 14:04:57 +08:00
}
2021-02-24 21:09:54 +08:00
![ptf_sphere ](images/lib3x-ptf_sphere-2.JPG )