Skip to content

Instantly share code, notes, and snippets.

@SharpCoder
Last active January 19, 2020 04:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save SharpCoder/3c63781813ece0c1f139a414d33b1865 to your computer and use it in GitHub Desktop.
function parametric_points(fx, fy, t0=0, t1=10, delta=0.01)
= [for(i = [t0:delta:t1]) [fx(i), fy(i)]];
function reverse(vector)
= [for(i = [1:len(vector)]) vector[len(vector) - i]];
x = function(t) t;
y = function(t) -2 * pow(t, 2) + 2;
y2 = function(t) y(t) + .25;
points_1 = parametric_points(fx=x, fy=y, t0=-1, t1=1);
points_2 = parametric_points(fx=x, fy=y2,t0=-1, t1=1);
color("lime")
linear_extrude(2)
union() {
polygon(
concat(
points_1,
points_2
)
);
translate([0,0 + 0.1,0])
square(center=true, [2,1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment