I am using cylinders (with radius1 and radius2 to make slanted walls) with difference and intersection to form a complicated shape with lots of curves. In some cases I only use a small part of a massive ellipse in order to cut away a small piece with a very slight (but necessary) curve. Because I'm using only a small part of the cylinder, I need the resolution to be very high ($fa = 0.01), or it gets artifacts. Because of this, my relatively small model is taking ages to render (close to a minute to preview, and about half an hour to generate). This is getting unusable, because I need to generate a lot of these models with different permutations.
Practically speaking, I don't need the entire circle to be generated with such a high resolution. Is there a way to make a cylinder that it only needs to calculate a certain percentage of the arc? I would imagine that there's some way to do this with a polygon of sorts, but I don't know how.
This is what I ended up using:
function formula(x, exponent) = pow(x,exponent);
module scrape(start, finish, exponent, steepAngle, resolution) {
width = finish.x - start.x;
height = start.y - finish.y;
points = concat(
[[width, formula(width,exponent)+1], [-1, formula(width,exponent)+1], [-1, 0]],
[for(i=[0:width/resolution:width])
[i, formula(i,exponent)]]
);
slantY = 5/tan(90-steepAngle);
linear_extrude(5, scale = (start.y + slantY)/start.y)
translate([start.x, finish.y])
scale([1,height/(formula(0, exponent)-formula(width,exponent)),1])
translate([0, -formula(width, exponent), 0])
polygon(points);
}
scrape([1, 3], [5, 1], 1.4, 10, 30);
The "formula" function was originally the formula of a circle, sqrt(x*x - radius*radius)
, where radius was a number I played around with to affect how sharp the curve should be. But then I realized that with this code I could put any function I want, and I found that an exponential function produced better curves for what I needed.