mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
add doc
This commit is contained in:
parent
9967327dbc
commit
a8eab1fc07
@ -151,7 +151,7 @@ See [examples](examples).
|
||||
- [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](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_ring.html)
|
||||
- ptf/ptf_sphere
|
||||
- [ptf/ptf_sphere]https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_sphere.html)
|
||||
- ptf/ptf_torus
|
||||
|
||||
----
|
||||
|
BIN
docs/images/lib2x-ptf_sphere-1.JPG
Normal file
BIN
docs/images/lib2x-ptf_sphere-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
BIN
docs/images/lib2x-ptf_sphere-2.JPG
Normal file
BIN
docs/images/lib2x-ptf_sphere-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
45
docs/lib2x-ptf_sphere.md
Normal file
45
docs/lib2x-ptf_sphere.md
Normal file
@ -0,0 +1,45 @@
|
||||
# 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).
|
||||
|
||||
![ptf_sphere](images/lib2x-ptf_sphere-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 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) {
|
||||
twisted = [for(p = line) ptf_sphere(size, p, radius, angle)];
|
||||
hull_polyline3d(twisted, thickness = .5);
|
||||
}
|
||||
|
||||
for(line = columns) {
|
||||
twisted = [for(p = line) ptf_sphere(size, p, radius, angle)];
|
||||
hull_polyline3d(twisted, thickness = .5);
|
||||
}
|
||||
|
||||
![ptf_sphere](images/lib2x-ptf_sphere-2.JPG)
|
@ -1,11 +1,15 @@
|
||||
/**
|
||||
* ptf_sphere.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2020
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_sphere.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <ptf/ptf_rotate.scad>;
|
||||
|
||||
/*
|
||||
size: The size of the rectangle mapping to a sphere.
|
||||
point: A point in the rectangle.
|
||||
radius: sphere radius.
|
||||
angle: [za, xa] mapping angles.
|
||||
*/
|
||||
function ptf_sphere(size, point, radius, angle = [180, 360]) =
|
||||
let(
|
||||
x = point[0],
|
||||
|
Loading…
x
Reference in New Issue
Block a user