added comments to files and removed the geogebra file
This commit is contained in:
parent
ba6d1396dc
commit
76a3aa2915
7 changed files with 22 additions and 15 deletions
|
|
@ -1,3 +1,4 @@
|
|||
// extrusion takes a list of polygons (list of points in 3d space) and connects these into one big polyeder
|
||||
module extrusion(points){
|
||||
//points[0] must have its points ordered clockwise
|
||||
n = len(points);
|
||||
|
|
@ -8,12 +9,13 @@ module extrusion(points){
|
|||
polyhedron(points = points_new, faces = faces, convexity = 10);
|
||||
}
|
||||
|
||||
//ctrl is a list containing 4 control points of the bezier curve. shape is polygon in the 2d plane which is being extruded. mod is a function [0,1] -> |R scaling the shape, mod_x in the x-direction (of the shape), mod_y in the y-direction. if partial is true, then the polyeder is rendered in slices with length given by merlon and gap size given by gap, section defines the number of sections the bezier curve is broken into
|
||||
module bezier_extrude(ctrl, shape, mod = function (t) 1, mod_x = function(t) 1, mod_y = function (t) 1, partial = false, merlon = 1, gap = 1, sections = 128){
|
||||
B_0 = ctrl[0];
|
||||
B_1 = 3*(-ctrl[0] + ctrl[1]);
|
||||
B_2 = 3*(ctrl[0] - 2*ctrl[1] + ctrl[2]);
|
||||
B_3 = -ctrl[0] + 3*(ctrl[1] - ctrl[2]) + ctrl[3];
|
||||
function bezier(t) = B_0 + t*B_1 + (t^2)*B_2 + (t^3)*B_3;
|
||||
function bezier(t) = B_0 + t*B_1 + (t^2)*B_2 + (t^3)*B_3;
|
||||
|
||||
Bn_0 = [B_1.y,-B_1.x];
|
||||
Bn_1 = [2*B_2.y,(-2)*B_2.x];
|
||||
|
|
@ -33,6 +35,7 @@ module bezier_extrude(ctrl, shape, mod = function (t) 1, mod_x = function(t) 1,
|
|||
}
|
||||
}
|
||||
|
||||
//some thing to play arounf with
|
||||
shape = [[0,0.5],[0.8,0],[0.5,-1],[-0.5,-1],[-0.8,0]];
|
||||
ctrl = [[0,0],[0,20],[20,20],[20,0]];
|
||||
wave1 = function (x) 0.75+0.25*cos(8*360*x);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue