From 1900801cad7f21e027f9e89284ca2c775cb54d1a Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 13 Feb 2020 08:04:45 +0800 Subject: [PATCH] add tf_x_twist --- src/experimental/tf_x_twist.scad | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/experimental/tf_x_twist.scad diff --git a/src/experimental/tf_x_twist.scad b/src/experimental/tf_x_twist.scad new file mode 100644 index 00000000..faae1da4 --- /dev/null +++ b/src/experimental/tf_x_twist.scad @@ -0,0 +1,16 @@ +use ; + +/* + size: The size of a rectangle. + point: A point in the rectangle. + angle: twisted angle. +*/ +function tf_x_twist(size, point, angle) = + let( + xlen = size[0], + ylen = size[1], + y_offset = ylen / 2, + a_step = angle / xlen, + y_centered = [point[0], point[1], 0] + [0, -y_offset, 0] + ) + rotate_p(y_centered, [point[0] * a_step, 0, 0]) + [0, y_offset, 0]; \ No newline at end of file