Various documentation fixes.

This commit is contained in:
Garth Minette 2021-12-06 14:28:04 -08:00
parent 0e99908440
commit 21083277b0
7 changed files with 99 additions and 55 deletions

View file

@ -7,41 +7,42 @@ IgnoreFiles:
builtins.scad
tmp_*.scad
PrioritizeFiles:
constants.scad
transforms.scad
distributors.scad
mutators.scad
attachments.scad
primitives.scad
shapes.scad
shapes2d.scad
drawing.scad
masks.scad
shapes2d.scad
shapes3d.scad
masks2d.scad
masks3d.scad
math.scad
vectors.scad
arrays.scad
quaternions.scad
affine.scad
comparisons.scad
coords.scad
geometry.scad
linalg.scad
lists.scad
vectors.scad
quaternions.scad
edges.scad
vnf.scad
geometry.scad
trigonometry.scad
hull.scad
paths.scad
regions.scad
debug.scad
common.scad
vnf.scad
skin.scad
utility.scad
constants.scad
strings.scad
version.scad
beziers.scad
threading.scad
rounding.scad
knurling.scad
partitions.scad
rounding.scad
skin.scad
hull.scad
triangulation.scad
threading.scad
turtle3d.scad
structs.scad
fnliterals.scad
DefineHeader(BulletList): Side Effects
DefineHeader(Table:Anchor Name|Position): Extra Anchors
DefineHeader(Table:Name|Definition): Terminology

5
.openscad_mdimggen_rc Normal file
View file

@ -0,0 +1,5 @@
docs_dir: "BOSL2.wiki"
image_root: "images/tutorials"
file_prefix: "Tutorial-"
source_files: "tutorials/*.md"

View file

@ -244,8 +244,6 @@ module attach(from, to, overlap, norot=false)
// Description:
// Marks all children with the given tags, so that they will `hide()`/`show()`/`diff()` correctly.
// This is especially useful for working with children that are not attachment enhanced, such as:
// - `square()` (or use [`rect()`](shapes2d.scad#rect))
// - `circle()` (or use [`oval()`](shapes2d.scad#oval))
// - `polygon()`
// - `text()`
// - `projection()`

View file

@ -259,6 +259,8 @@ function u_div(a,b) =
// Section: Hyperbolic Trigonometry
// Function: sinh()
// Usage:
// a = sinh(x);
// Description: Takes a value `x`, and returns the hyperbolic sine of it.
function sinh(x) =
assert(is_finite(x), "The input must be a finite number.")
@ -266,6 +268,8 @@ function sinh(x) =
// Function: cosh()
// Usage:
// a = cosh(x);
// Description: Takes a value `x`, and returns the hyperbolic cosine of it.
function cosh(x) =
assert(is_finite(x), "The input must be a finite number.")
@ -273,6 +277,8 @@ function cosh(x) =
// Function: tanh()
// Usage:
// a = tanh(x);
// Description: Takes a value `x`, and returns the hyperbolic tangent of it.
function tanh(x) =
assert(is_finite(x), "The input must be a finite number.")
@ -280,6 +286,8 @@ function tanh(x) =
// Function: asinh()
// Usage:
// a = asinh(x);
// Description: Takes a value `x`, and returns the inverse hyperbolic sine of it.
function asinh(x) =
assert(is_finite(x), "The input must be a finite number.")
@ -287,6 +295,8 @@ function asinh(x) =
// Function: acosh()
// Usage:
// a = acosh(x);
// Description: Takes a value `x`, and returns the inverse hyperbolic cosine of it.
function acosh(x) =
assert(is_finite(x), "The input must be a finite number.")
@ -294,6 +304,8 @@ function acosh(x) =
// Function: atanh()
// Usage:
// a = atanh(x);
// Description: Takes a value `x`, and returns the inverse hyperbolic tangent of it.
function atanh(x) =
assert(is_finite(x), "The input must be a finite number.")

View file

@ -288,7 +288,7 @@ function force_region(poly) = is_path(poly) ? [poly] : poly;
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `"origin"`
// spin = Rotate this many degrees after anchor. See [spin](attachments.scad#spin). Default: `0`
// cp = Centerpoint for determining intersection anchors or centering the shape. Determintes the base of the anchor vector. Can be "centroid", "mean", "box" or a 2D point. Default: "centroid"
// atype = Set to "hull" or "intersect to select anchor type. Default: "hull"
// atype = Set to "hull" or "intersect" to select anchor type. Default: "hull"
// Example(2D): Displaying a region
// region([circle(d=50), square(25,center=true)]);
// Example(2D): Displaying a list of polygons that intersect each other, which is not a region
@ -328,10 +328,14 @@ module region(r, anchor="origin", spin=0, cp="centroid", atype="hull")
// point = The point to test.
// region = The region to test against, as a list of polygon paths.
// eps = Acceptable variance. Default: `EPSILON` (1e-9)
// Example(2D,NoAxes): Green points are in the region, red ones are outside
// region = [for(i=[2:8]) hexagon(r=i)];
// region(region);
// for(x=[-4.5:4.5],y=[-4.5:4.5]) color(point_in_region([x,y],region)==1?"green":"red") move([x,y])circle(r=.1,$fn=12);
// Example(2D,Med): Red points are in the region.
// region = [for(i=[2:4:10]) hexagon(r=i)];
// color("#ff7") region(region);
// for(x=[-10:10], y=[-10:10])
// if (point_in_region([x,y], region)>=0)
// move([x,y]) color("red") circle(0.15, $fn=12);
// else
// move([x,y]) color("#ddf") circle(0.1, $fn=12);
function point_in_region(point, region, eps=EPSILON) =
let(region=force_region(region))
assert(is_region(region), "Region given to point_in_region is not a region")

View file

@ -15,6 +15,7 @@
// be lowered to different depths to create different sizes of recess.
// Arguments:
// size = The size of the bit as a number or string. "#0", "#1", "#2", "#3", or "#4"
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`
@ -29,26 +30,24 @@
// Specs for phillips recess here:
// https://www.fasteners.eu/tech-info/ISO/4757/
_phillips_shaft = [3,4.5,6,8,10];
_ph_bot_angle = 28.0;
_ph_side_angle = 26.5;
function _phillips_shaft(x) = [3,4.5,6,8,10][x];
function _ph_bot_angle() = 28.0;
function _ph_side_angle() = 26.5;
module phillips_mask(size="#2", $fn=36, anchor=BOTTOM, spin=0, orient=UP) {
assert(in_list(size,["#0","#1","#2","#3","#4",0,1,2,3,4]));
num = is_num(size) ? size : ord(size[1]) - ord("0");
shaft = _phillips_shaft[num];
shaft = _phillips_shaft(num);
b = [0.61, 0.97, 1.47, 2.41, 3.48][num];
e = [0.31, 0.435, 0.815, 2.005, 2.415][num];
g = [0.81, 1.27, 2.29, 3.81, 5.08][num];
//f = [0.33, 0.53, 0.70, 0.82, 1.23][num];
//r = [0.30, 0.50, 0.60, 0.80, 1.00][num];
alpha = [ 136, 138, 140, 146, 153][num];
beta = [7.00, 7.00, 5.75, 5.75, 7.00][num];
gamma = 92.0;
h1 = adj_ang_to_opp(g/2, _ph_bot_angle); // height of the small conical tip
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle); // height of larger cone
h1 = adj_ang_to_opp(g/2, _ph_bot_angle()); // height of the small conical tip
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle()); // height of larger cone
l = h1+h2;
h3 = adj_ang_to_opp(b/2, _ph_bot_angle); // height where cutout starts
h3 = adj_ang_to_opp(b/2, _ph_bot_angle()); // height where cutout starts
p0 = [0,0];
p1 = [adj_ang_to_opp(e/2, 90-alpha/2), -e/2];
p2 = p1 + [adj_ang_to_opp((shaft-e)/2, 90-gamma/2),-(shaft-e)/2];
@ -92,13 +91,11 @@ function phillips_depth(size, d) =
num = is_num(size) ? size : ord(size[1]) - ord("0"),
shaft = [3,4.5,6,8,10][num],
g = [0.81, 1.27, 2.29, 3.81, 5.08][num],
_ph_bot_angle = 28.0,
_ph_side_angle = 26.5,
h1 = adj_ang_to_opp(g/2, _ph_bot_angle), // height of the small conical tip
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle) // height of larger cone
h1 = adj_ang_to_opp(g/2, _ph_bot_angle()), // height of the small conical tip
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle()) // height of larger cone
)
d>=shaft || d<g ? undef :
(d-g) / 2 / tan(_ph_side_angle) + h1;
(d-g) / 2 / tan(_ph_side_angle()) + h1;
// Function: phillips_diam()
@ -114,13 +111,13 @@ function phillips_diam(size, depth) =
assert(in_list(size,["#0","#1","#2","#3","#4",0,1,2,3,4]))
let(
num = is_num(size) ? size : ord(size[1]) - ord("0"),
shaft = _phillips_shaft[num],
shaft = _phillips_shaft(num),
g = [0.81, 1.27, 2.29, 3.81, 5.08][num],
h1 = adj_ang_to_opp(g/2, _ph_bot_angle), // height of the small conical tip
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle) // height of larger cone
h1 = adj_ang_to_opp(g/2, _ph_bot_angle()), // height of the small conical tip
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle()) // height of larger cone
)
depth<h1 || depth>= h1+h2 ? undef :
2 * tan(_ph_side_angle)*(depth-h1) + g;
2 * tan(_ph_side_angle())*(depth-h1) + g;
@ -128,6 +125,8 @@ function phillips_diam(size, depth) =
// Function: torx_outer_diam()
// Usage:
// diam = torx_outer_diam(size);
// Description: Get the typical outer diameter of Torx profile.
// Arguments:
// size = Torx size.
@ -152,6 +151,8 @@ function torx_outer_diam(size) = lookup(size, [
// Function: torx_inner_diam()
// Usage:
// diam = torx_inner_diam(size);
// Description: Get typical inner diameter of Torx profile.
// Arguments:
// size = Torx size.
@ -176,6 +177,8 @@ function torx_inner_diam(size) = lookup(size, [
// Function: torx_depth()
// Usage:
// depth = torx_depth(size);
// Description: Gets typical drive hole depth.
// Arguments:
// size = Torx size.
@ -200,6 +203,8 @@ function torx_depth(size) = lookup(size, [
// Function: torx_tip_radius()
// Usage:
// rad = torx_tip_radius(size);
// Description: Gets minor rounding radius of Torx profile.
// Arguments:
// size = Torx size.
@ -224,6 +229,8 @@ function torx_tip_radius(size) = lookup(size, [
// Function: torx_rounding_radius()
// Usage:
// rad = torx_rounding_radius(size);
// Description: Gets major rounding radius of Torx profile.
// Arguments:
// size = Torx size.
@ -249,6 +256,8 @@ function torx_rounding_radius(size) = lookup(size, [
// Module: torx_mask2d()
// Usage:
// torx_mask2d(size);
// Description: Creates a torx bit 2D profile.
// Arguments:
// size = Torx size.
@ -287,11 +296,14 @@ module torx_mask2d(size) {
// Module: torx_mask()
// Usage:
// torx_mask(size, l, [center]);
// Description: Creates a torx bit tip.
// Arguments:
// size = Torx size.
// l = Length of bit.
// center = If true, centers bit vertically.
// ---
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#spin). Default: `0`
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`

View file

@ -63,6 +63,8 @@ function add_scalar(v,s) =
// Function: v_mul()
// Usage:
// v3 = v_mul(v1, v2);
// Description:
// Element-wise multiplication. Multiplies each element of `v1` by the corresponding element of `v2`.
// Both `v1` and `v2` must be the same length. Returns a vector of the products.
@ -77,6 +79,8 @@ function v_mul(v1, v2) =
// Function: v_div()
// Usage:
// v3 = v_div(v1, v2);
// Description:
// Element-wise vector division. Divides each element of vector `v1` by
// the corresponding element of vector `v2`. Returns a vector of the quotients.
@ -91,6 +95,8 @@ function v_div(v1, v2) =
// Function: v_abs()
// Usage:
// v2 = v_abs(v);
// Description: Returns a vector of the absolute value of each element of vector `v`.
// Arguments:
// v = The vector to get the absolute values of.
@ -102,6 +108,8 @@ function v_abs(v) =
// Function: v_floor()
// Usage:
// v2 = v_floor(v);
// Description:
// Returns the given vector after performing a `floor()` on all items.
function v_floor(v) =
@ -110,6 +118,8 @@ function v_floor(v) =
// Function: v_ceil()
// Usage:
// v2 = v_ceil(v);
// Description:
// Returns the given vector after performing a `ceil()` on all items.
function v_ceil(v) =
@ -118,6 +128,8 @@ function v_ceil(v) =
// Function: v_lookup()
// Usage:
// v2 = v_ceil(x, v);
// Description:
// Works just like the built-in function [`lookup()`](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Mathematical_Functions#lookup), except that it can also interpolate between vector result values of the same length.
// Arguments:
@ -147,7 +159,7 @@ function v_lookup(x, v) =
// Function: unit()
// Usage:
// unit(v, [error]);
// v = unit(v, [error]);
// Description:
// Returns the unit length normalized version of vector v. If passed a zero-length vector,
// asserts an error unless `error` is given, in which case the value of `error` is returned.
@ -180,10 +192,10 @@ function v_theta(v) =
// Function: vector_angle()
// Usage:
// vector_angle(v1,v2);
// vector_angle([v1,v2]);
// vector_angle(PT1,PT2,PT3);
// vector_angle([PT1,PT2,PT3]);
// ang = vector_angle(v1,v2);
// ang = vector_angle([v1,v2]);
// ang = vector_angle(PT1,PT2,PT3);
// ang = vector_angle([PT1,PT2,PT3]);
// Description:
// If given a single list of two vectors, like `vector_angle([V1,V2])`, returns the angle between the two vectors V1 and V2.
// If given a single list of three points, like `vector_angle([A,B,C])`, returns the angle between the line segments AB and BC.
@ -222,10 +234,10 @@ function vector_angle(v1,v2,v3) =
// Function: vector_axis()
// Usage:
// vector_axis(v1,v2);
// vector_axis([v1,v2]);
// vector_axis(PT1,PT2,PT3);
// vector_axis([PT1,PT2,PT3]);
// axis = vector_axis(v1,v2);
// axis = vector_axis([v1,v2]);
// axis = vector_axis(PT1,PT2,PT3);
// axis = vector_axis([PT1,PT2,PT3]);
// Description:
// If given a single list of two vectors, like `vector_axis([V1,V2])`, returns the vector perpendicular the two vectors V1 and V2.
// If given a single list of three points, like `vector_axis([A,B,C])`, returns the vector perpendicular to the plane through a, B and C.
@ -487,7 +499,7 @@ function _bt_tree(points, ind, leafsize=25) =
// Function: vector_nearest()
// Usage:
// indices = vector_nearest(query, k, target)
// indices = vector_nearest(query, k, target);
// See Also: vector_search(), vector_search_tree()
// Description:
// Search `target` for the `k` points closest to point `query`.