User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

design_guide_rectangular_extrude [2018/03/08 13:19] (current)
z3dev created
Line 1: Line 1:
 +==== Rectangular Extrude ====
 +
 +Extrude the path by following it with a rectangle (upright, perpendicular to the path direction), returns a CSG solid.
 +
 +Simplified (openscad like, even though OpenSCAD doesn'​t provide this) via rectangular_extrude(),​ where as 
 +  * w: width (default: 1), 
 +  * h: height (default: 1), 
 +  * fn: resolution (default: 8), and 
 +  * closed: whether path is closed or not (default: false)
 +
 +<code javascript>​
 +rectangular_extrude([ [10,10], [-10,10], [-20,0], [-10,-10], [10,-10] ],  // path is an array of 2d coords
 +    {w: 1, h: 3, closed: true});
 +</​code>​
 +
 +or more low-level ​ via rectangularExtrude(),​ with following unnamed variables:
 +  * width of the extrusion, in the z=0 plane
 +  * height of the extrusion in the z direction
 +  * resolution, number of segments per 360 degrees for the curve in a corner
 +  * roundEnds: if true, the ends of the polygon will be rounded, otherwise they will be flat
 +
 +<code javascript>​
 +// first creating a 2D path, and then extrude it
 +var path = new CSG.Path2D([ [10,10], [-10,10], [-20,0], [-10,-10], [10,-10] ], /​*closed=*/​true);​
 +var csg = path.rectangularExtrude(3,​ 4, 16, true); ​  // w, h, resolution, roundEnds
 +return csg;
 +</​code>​