From cd46a948df130197c8b8b57f7cabee4fbcc02c70 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 17 Feb 2020 14:30:46 +0800 Subject: [PATCH] add tf_bend --- src/experimental/tf_bend.scad | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/experimental/tf_bend.scad diff --git a/src/experimental/tf_bend.scad b/src/experimental/tf_bend.scad new file mode 100644 index 00000000..3c7f45de --- /dev/null +++ b/src/experimental/tf_bend.scad @@ -0,0 +1,18 @@ +/* + 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. +*/ + +function tf_bend(size, point, radius, angle) = + let( + xlen = size[0], + // ignored + // ylen = size[1], + y = point[0], + z = point[1], + a_step = angle / xlen, + a = a_step * y + ) + [radius * cos(a), radius * sin(a), z]; \ No newline at end of file