changed the extrusion to include scaling in one axis, implemented a headband with catears and saved the geogebra file used to model everything here

This commit is contained in:
tessaK9 2026-03-12 10:48:09 +01:00
commit b5a30db507
3 changed files with 43 additions and 7 deletions

View file

@ -7,7 +7,7 @@ module extrusion(points){
polyhedron(points = points_new, faces = faces, convexity = 10);
}
module bezier_extrude(ctrl, shape, mod = function (t) 1, sections = 64){
module bezier_extrude(ctrl, shape, mod = function (t) 1, mod_x = function(t) 1, mod_y = function (t) 1, sections = 128){
B_0 = ctrl[0];
B_1 = 3*(-ctrl[0] + ctrl[1]);
B_2 = 3*(ctrl[0] - 2*ctrl[1] + ctrl[2]);
@ -21,13 +21,11 @@ module bezier_extrude(ctrl, shape, mod = function (t) 1, sections = 64){
slices = [for (i = [0 : sections])
let (t = i/sections, p = bezier(t), normal = normal(t), n = normal/norm(normal))
[for (v = shape) [p.x+(mod(t) * n.x * v.x),p.y+(mod(t) * n.y * v.x), mod(t) * v.y]]];
[for (v = shape) [p.x+(mod(t) * mod_x(t) * n.x * v.x),p.y+(mod(t) *mod_x(t) * n.y * v.x), mod(t) * mod_y(t) * v.y]]];
extrusion(slices);
}
wave = function (x) 0.75+0.25*cos(3*360*x);
shape = [[0,0.5],[0.8,0],[0.5,-1],[-0.5,-1],[-0.8,0]];
ctrl = [[0,0],[0,10],[10,0],[10,10]];
bezier_extrude(ctrl = ctrl, shape = shape, mod = wave);
ctrl = [[0,0],[20,10],[0,20],[10,0]];
wave = function (x) 0.75+0.25*cos(3*360*x);
bezier_extrude(ctrl = ctrl, shape = shape, mod = wave, sections = 8192);