diff --git a/README.md b/README.md index 863c045c..8f4c1b7c 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ See [examples](examples). - [ptf/ptf_x_twist](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_x_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_bend + - [ptf/ptf_bend](https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_bend.html) - ptf/ptf_ring - ptf/ptf_sphere - ptf/ptf_torus diff --git a/docs/images/lib2x-ptf_bend-1.JPG b/docs/images/lib2x-ptf_bend-1.JPG new file mode 100644 index 00000000..12a1996f Binary files /dev/null and b/docs/images/lib2x-ptf_bend-1.JPG differ diff --git a/docs/lib2x-ptf_bend.md b/docs/lib2x-ptf_bend.md new file mode 100644 index 00000000..ec5ac7a9 --- /dev/null +++ b/docs/lib2x-ptf_bend.md @@ -0,0 +1,32 @@ +# ptf_bend + +Transforms a point inside a rectangle to a point of an arc. + +**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 arc. +- `angle` : The central angle of the arc. + +## Examples + + use ; + use ; + + t = "dotSCAD"; + size = [len(t) * 8, 8]; + radius = 20; + angle = 180; + + for(i = [0:len(t) - 1]) { + for(pt = px_ascii(t[i], invert = true)) { + bended = ptf_bend(size, pt + [i * 8, 0], radius, angle); + translate(bended) + sphere(0.5, $fn = 24); + } + } + +![ptf_bend](images/lib2x-ptf_bend-1.JPG) diff --git a/src/ptf/ptf_bend.scad b/src/ptf/ptf_bend.scad index d5da7b2c..a6e3a1f3 100644 --- a/src/ptf/ptf_bend.scad +++ b/src/ptf/ptf_bend.scad @@ -1,9 +1,12 @@ -/* - size: The size of the rectangle which can contain the point. - point: A point in the rectangle. - radius: The radius of the arc after being bent - angle: The central angle of the arc. -*/ +/** +* ptf_bend.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_bend.html +* +**/ function ptf_bend(size, point, radius, angle) = let(