diff --git a/rounding.scad b/rounding.scad index 958db31..6f96b50 100644 --- a/rounding.scad +++ b/rounding.scad @@ -24,25 +24,29 @@ include // tactile "bump" where the curvature changes from flat to circular. // See https://hackernoon.com/apples-icons-have-that-shape-for-a-very-good-reason-720d4e7c8a14 // . -// You select the type of rounding using the `method` option, which should be `"smooth"` to +// You select the type of rounding using the `method` parameter, which should be `"smooth"` to // get continuous curvature rounding, `"circle"` to get circular rounding, or `"chamfer"` to get chamfers. The default is circle -// rounding. Each method has two options you can use to specify the amount of rounding. -// All of the rounding methods accept the cut option. This mode specifies the distance from the unrounded corner to the rounded tip, so how +// rounding. Each method accepts multiple options to specify the amount of rounding. +// . +// The `cut` parameter specifies the distance from the unrounded corner to the rounded tip, so how // much of the corner to "cut" off. This can be easier to understand than setting a circular radius, which can be // unexpectedly extreme when the corner is very sharp. It also allows a systematic specification of // corner treatments that are the same size for all three methods. // . -// For circular rounding you can also use the `radius` parameter, which sets a circular rounding -// radius. For chamfers and smooth rounding you can specify the `joint` parameter, which specifies the distance +// The `joint` parameter specifies the distance // away from the corner along the path where the roundover or chamfer should start. The figure below shows -// the cut and joint distances for a given roundover. +// the cut and joint distances for a given roundover. This parameter is good for ensuring that your roundover will +// fit on the polygon, since you can easily tell whether adjacent corner treatments will interfere. +// . +// For circular rounding you can also use the `radius` parameter, which sets a circular rounding +// radius. // . // The `"smooth"` method rounding also has a parameter that specifies how smooth the curvature match // is. This parameter, `k`, ranges from 0 to 1, with a default of 0.5. Larger values give a more // abrupt transition and smaller ones a more gradual transition. If you set the value much higher // than 0.8 the curvature changes abruptly enough that though it is theoretically continuous, it may // not be continuous in practice. If you set it very small then the transition is so gradual that -// the length of the roundover may be extremely long. +// the length of the roundover may be extremely long. // . // If you select curves that are too large to fit the function will fail with an error. You can set `verbose=true` to // get a message showing a list of scale factors you can apply to your rounding parameters so that the @@ -54,6 +58,9 @@ include // of the curve are not rounded. In this case you can specify a full list of points anyway, and the endpoint values are ignored, // or you can specify a list that has length len(path)-2, omitting the two dummy values. // . +// If your input path includes collinear points you must use a cut or radius value of zero for those "corners". You can +// choose a nonzero joint parameter, which will cause extra points to be inserted. +// . // Examples: // * `method="circle", radius=2`: // Rounds every point with circular, radius 2 roundover @@ -211,7 +218,6 @@ function round_corners(path, method="circle", radius, cut, joint, k, closed=true assert(k_ok,method=="smooth" ? str("Input k must be a number or list with length ",len(path), closed?"":str(" or ",len(path)-2)) : "Input k is only allowed with method=\"smooth\"") assert(method=="circle" || measure!="radius", "radius parameter allowed only with method=\"circle\"") - assert(method!="circle" || measure!="joint", "joint parameter not allowed with method=\"circle\"") let( parm = is_num(size) ? repeat(size, len(path)) : len(size)