mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-10 16:54:23 +02:00
add doc
This commit is contained in:
@@ -150,7 +150,7 @@ See [examples](examples).
|
|||||||
- [ptf/ptf_y_twist](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_y_twist.html)
|
- [ptf/ptf_y_twist](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_y_twist.html)
|
||||||
- [ptf/ptf_circle](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_circle.html)
|
- [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_bend](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_bend.html)
|
||||||
- ptf/ptf_ring
|
- [ptf/ptf_ring](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_ring.html)
|
||||||
- ptf/ptf_sphere
|
- ptf/ptf_sphere
|
||||||
- ptf/ptf_torus
|
- ptf/ptf_torus
|
||||||
|
|
||||||
|
BIN
docs/images/lib2x-ptf_ring-1.JPG
Normal file
BIN
docs/images/lib2x-ptf_ring-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
BIN
docs/images/lib2x-ptf_ring-2.JPG
Normal file
BIN
docs/images/lib2x-ptf_ring-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 KiB |
45
docs/lib2x-ptf_ring.md
Normal file
45
docs/lib2x-ptf_ring.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# ptf_ring
|
||||||
|
|
||||||
|
Transforms a point inside a rectangle to a point of a ring. It can create things such as [tiled_line_mobius](https://github.com/JustinSDK/dotSCAD/blob/master/examples/tiled_line_mobius.scad).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**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 ring.
|
||||||
|
- `angle` : The central angle of the arc.
|
||||||
|
- `twist` : The number of degrees of through which the rectangle is twisted.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
use <hull_polyline3d.scad>;
|
||||||
|
use <ptf/ptf_ring.scad>;
|
||||||
|
|
||||||
|
size = [20, 10];
|
||||||
|
radius = 5;
|
||||||
|
|
||||||
|
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_ring(size, p, radius, 360, 180)];
|
||||||
|
hull_polyline3d(twisted, thickness = .5);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(line = columns) {
|
||||||
|
twisted = [for(p = line) ptf_ring(size, p, radius, 360, 180)];
|
||||||
|
hull_polyline3d(twisted, thickness = .5);
|
||||||
|
}
|
||||||
|
|
||||||
|

|
@@ -39,4 +39,4 @@ Twist a point along the x-axis. You can use it to create something such as a [tw
|
|||||||
hull_polyline3d(twisted, thickness = .1);
|
hull_polyline3d(twisted, thickness = .1);
|
||||||
}
|
}
|
||||||
|
|
||||||

|

|
||||||
|
@@ -1,13 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* ptf_ring.scad
|
||||||
|
*
|
||||||
|
* @copyright Justin Lin, 2020
|
||||||
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
|
*
|
||||||
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_ring.html
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
use <ptf/ptf_rotate.scad>;
|
use <ptf/ptf_rotate.scad>;
|
||||||
use <ptf/ptf_y_twist.scad>;
|
use <ptf/ptf_y_twist.scad>;
|
||||||
|
|
||||||
/*
|
|
||||||
size: The size of a rectangle.
|
|
||||||
point: A point in the rectangle.
|
|
||||||
radius: ring radius.
|
|
||||||
angle: arc angle.
|
|
||||||
twist: The number of degrees of through which the rectangle is twisted.
|
|
||||||
*/
|
|
||||||
function ptf_ring(size, point, radius, angle = 360, twist = 0) =
|
function ptf_ring(size, point, radius, angle = 360, twist = 0) =
|
||||||
let(
|
let(
|
||||||
yleng = size[1],
|
yleng = size[1],
|
||||||
|
Reference in New Issue
Block a user