I have drawn a triangle in openSCAD using a function/module to give it rounded edges (Largely because I was being slightly lazy, but also because I didn't want to mess this up). I now want to bend the triangle from the top to the bottom.
fn=128;
RoundedPolygon([[0,0],[120,260],[230,0]],25,fn);
module RoundedPolygon(P,r,fn)
{
rotate(a=90, v=[0,0,1]){
rotate([90,180,180]) scale([1,1,5])
{
v = rounded_polygon_v(P,r,fn);
polygon(v);};};
}
function bezier_smooth(path_pts, round_d, t_step = 0.1, closed = false, angle_threshold = 0) =
_bezier_smooth_impl(path_pts, round_d, t_step, closed, angle_threshold);
function rounded_polygon_v(P,r,fn) =
let
(
step = 360 / fn,
n = len(P),
o_v = [ for(i=[0:n-1]) atan2(P[(i+1)%n][1] - P[i][1], P[(i+1)%n][0] - P[i][0]) + 90 + 360 ]
)
[
for(i=[0:n-1])
let
(
n1 = i,
n2 = (i+1)%n,
w1 = o_v[n1],
w2 = (o_v[n2] < w1) ? o_v[n2] : o_v[n2] - 360
)
for (w=[w1:-step:w2])
[ cos(w)*r+P[n2][0], sin(w)*r+P[n2][1] ]
] ;
It works but no matter how I TRY to bend it (from bottom to top or top to bottom, along the z axis (I think that's how you'd describe it anyway).
Does anyone have any tricks or tips in openSCAD to do this?
