mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Various documentation fixes.
This commit is contained in:
parent
0e99908440
commit
21083277b0
7 changed files with 99 additions and 55 deletions
|
@ -7,41 +7,42 @@ IgnoreFiles:
|
||||||
builtins.scad
|
builtins.scad
|
||||||
tmp_*.scad
|
tmp_*.scad
|
||||||
PrioritizeFiles:
|
PrioritizeFiles:
|
||||||
constants.scad
|
|
||||||
transforms.scad
|
transforms.scad
|
||||||
distributors.scad
|
distributors.scad
|
||||||
mutators.scad
|
mutators.scad
|
||||||
attachments.scad
|
attachments.scad
|
||||||
primitives.scad
|
|
||||||
shapes.scad
|
|
||||||
shapes2d.scad
|
|
||||||
drawing.scad
|
drawing.scad
|
||||||
masks.scad
|
shapes2d.scad
|
||||||
|
shapes3d.scad
|
||||||
|
masks2d.scad
|
||||||
|
masks3d.scad
|
||||||
math.scad
|
math.scad
|
||||||
vectors.scad
|
comparisons.scad
|
||||||
arrays.scad
|
|
||||||
quaternions.scad
|
|
||||||
affine.scad
|
|
||||||
coords.scad
|
coords.scad
|
||||||
geometry.scad
|
linalg.scad
|
||||||
|
lists.scad
|
||||||
|
vectors.scad
|
||||||
|
quaternions.scad
|
||||||
edges.scad
|
edges.scad
|
||||||
vnf.scad
|
geometry.scad
|
||||||
|
trigonometry.scad
|
||||||
|
hull.scad
|
||||||
paths.scad
|
paths.scad
|
||||||
regions.scad
|
regions.scad
|
||||||
debug.scad
|
vnf.scad
|
||||||
common.scad
|
skin.scad
|
||||||
|
utility.scad
|
||||||
|
constants.scad
|
||||||
strings.scad
|
strings.scad
|
||||||
|
version.scad
|
||||||
beziers.scad
|
beziers.scad
|
||||||
threading.scad
|
|
||||||
rounding.scad
|
|
||||||
knurling.scad
|
knurling.scad
|
||||||
partitions.scad
|
partitions.scad
|
||||||
rounding.scad
|
rounding.scad
|
||||||
skin.scad
|
threading.scad
|
||||||
hull.scad
|
|
||||||
triangulation.scad
|
|
||||||
turtle3d.scad
|
turtle3d.scad
|
||||||
structs.scad
|
structs.scad
|
||||||
|
fnliterals.scad
|
||||||
DefineHeader(BulletList): Side Effects
|
DefineHeader(BulletList): Side Effects
|
||||||
DefineHeader(Table:Anchor Name|Position): Extra Anchors
|
DefineHeader(Table:Anchor Name|Position): Extra Anchors
|
||||||
DefineHeader(Table:Name|Definition): Terminology
|
DefineHeader(Table:Name|Definition): Terminology
|
||||||
|
|
5
.openscad_mdimggen_rc
Normal file
5
.openscad_mdimggen_rc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
docs_dir: "BOSL2.wiki"
|
||||||
|
image_root: "images/tutorials"
|
||||||
|
file_prefix: "Tutorial-"
|
||||||
|
source_files: "tutorials/*.md"
|
||||||
|
|
|
@ -244,8 +244,6 @@ module attach(from, to, overlap, norot=false)
|
||||||
// Description:
|
// Description:
|
||||||
// Marks all children with the given tags, so that they will `hide()`/`show()`/`diff()` correctly.
|
// 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:
|
// 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()`
|
// - `polygon()`
|
||||||
// - `text()`
|
// - `text()`
|
||||||
// - `projection()`
|
// - `projection()`
|
||||||
|
|
12
math.scad
12
math.scad
|
@ -259,6 +259,8 @@ function u_div(a,b) =
|
||||||
// Section: Hyperbolic Trigonometry
|
// Section: Hyperbolic Trigonometry
|
||||||
|
|
||||||
// Function: sinh()
|
// Function: sinh()
|
||||||
|
// Usage:
|
||||||
|
// a = sinh(x);
|
||||||
// Description: Takes a value `x`, and returns the hyperbolic sine of it.
|
// Description: Takes a value `x`, and returns the hyperbolic sine of it.
|
||||||
function sinh(x) =
|
function sinh(x) =
|
||||||
assert(is_finite(x), "The input must be a finite number.")
|
assert(is_finite(x), "The input must be a finite number.")
|
||||||
|
@ -266,6 +268,8 @@ function sinh(x) =
|
||||||
|
|
||||||
|
|
||||||
// Function: cosh()
|
// Function: cosh()
|
||||||
|
// Usage:
|
||||||
|
// a = cosh(x);
|
||||||
// Description: Takes a value `x`, and returns the hyperbolic cosine of it.
|
// Description: Takes a value `x`, and returns the hyperbolic cosine of it.
|
||||||
function cosh(x) =
|
function cosh(x) =
|
||||||
assert(is_finite(x), "The input must be a finite number.")
|
assert(is_finite(x), "The input must be a finite number.")
|
||||||
|
@ -273,6 +277,8 @@ function cosh(x) =
|
||||||
|
|
||||||
|
|
||||||
// Function: tanh()
|
// Function: tanh()
|
||||||
|
// Usage:
|
||||||
|
// a = tanh(x);
|
||||||
// Description: Takes a value `x`, and returns the hyperbolic tangent of it.
|
// Description: Takes a value `x`, and returns the hyperbolic tangent of it.
|
||||||
function tanh(x) =
|
function tanh(x) =
|
||||||
assert(is_finite(x), "The input must be a finite number.")
|
assert(is_finite(x), "The input must be a finite number.")
|
||||||
|
@ -280,6 +286,8 @@ function tanh(x) =
|
||||||
|
|
||||||
|
|
||||||
// Function: asinh()
|
// Function: asinh()
|
||||||
|
// Usage:
|
||||||
|
// a = asinh(x);
|
||||||
// Description: Takes a value `x`, and returns the inverse hyperbolic sine of it.
|
// Description: Takes a value `x`, and returns the inverse hyperbolic sine of it.
|
||||||
function asinh(x) =
|
function asinh(x) =
|
||||||
assert(is_finite(x), "The input must be a finite number.")
|
assert(is_finite(x), "The input must be a finite number.")
|
||||||
|
@ -287,6 +295,8 @@ function asinh(x) =
|
||||||
|
|
||||||
|
|
||||||
// Function: acosh()
|
// Function: acosh()
|
||||||
|
// Usage:
|
||||||
|
// a = acosh(x);
|
||||||
// Description: Takes a value `x`, and returns the inverse hyperbolic cosine of it.
|
// Description: Takes a value `x`, and returns the inverse hyperbolic cosine of it.
|
||||||
function acosh(x) =
|
function acosh(x) =
|
||||||
assert(is_finite(x), "The input must be a finite number.")
|
assert(is_finite(x), "The input must be a finite number.")
|
||||||
|
@ -294,6 +304,8 @@ function acosh(x) =
|
||||||
|
|
||||||
|
|
||||||
// Function: atanh()
|
// Function: atanh()
|
||||||
|
// Usage:
|
||||||
|
// a = atanh(x);
|
||||||
// Description: Takes a value `x`, and returns the inverse hyperbolic tangent of it.
|
// Description: Takes a value `x`, and returns the inverse hyperbolic tangent of it.
|
||||||
function atanh(x) =
|
function atanh(x) =
|
||||||
assert(is_finite(x), "The input must be a finite number.")
|
assert(is_finite(x), "The input must be a finite number.")
|
||||||
|
|
14
regions.scad
14
regions.scad
|
@ -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"`
|
// 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`
|
// 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"
|
// 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
|
// Example(2D): Displaying a region
|
||||||
// region([circle(d=50), square(25,center=true)]);
|
// region([circle(d=50), square(25,center=true)]);
|
||||||
// Example(2D): Displaying a list of polygons that intersect each other, which is not a region
|
// 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.
|
// point = The point to test.
|
||||||
// region = The region to test against, as a list of polygon paths.
|
// region = The region to test against, as a list of polygon paths.
|
||||||
// eps = Acceptable variance. Default: `EPSILON` (1e-9)
|
// eps = Acceptable variance. Default: `EPSILON` (1e-9)
|
||||||
// Example(2D,NoAxes): Green points are in the region, red ones are outside
|
// Example(2D,Med): Red points are in the region.
|
||||||
// region = [for(i=[2:8]) hexagon(r=i)];
|
// region = [for(i=[2:4:10]) hexagon(r=i)];
|
||||||
// region(region);
|
// color("#ff7") 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);
|
// 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) =
|
function point_in_region(point, region, eps=EPSILON) =
|
||||||
let(region=force_region(region))
|
let(region=force_region(region))
|
||||||
assert(is_region(region), "Region given to point_in_region is not a region")
|
assert(is_region(region), "Region given to point_in_region is not a region")
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
// be lowered to different depths to create different sizes of recess.
|
// be lowered to different depths to create different sizes of recess.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = The size of the bit as a number or string. "#0", "#1", "#2", "#3", or "#4"
|
// 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`
|
// 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`
|
// 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`
|
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`
|
||||||
|
@ -29,26 +30,24 @@
|
||||||
// Specs for phillips recess here:
|
// Specs for phillips recess here:
|
||||||
// https://www.fasteners.eu/tech-info/ISO/4757/
|
// https://www.fasteners.eu/tech-info/ISO/4757/
|
||||||
|
|
||||||
_phillips_shaft = [3,4.5,6,8,10];
|
function _phillips_shaft(x) = [3,4.5,6,8,10][x];
|
||||||
_ph_bot_angle = 28.0;
|
function _ph_bot_angle() = 28.0;
|
||||||
_ph_side_angle = 26.5;
|
function _ph_side_angle() = 26.5;
|
||||||
|
|
||||||
module phillips_mask(size="#2", $fn=36, anchor=BOTTOM, spin=0, orient=UP) {
|
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]));
|
assert(in_list(size,["#0","#1","#2","#3","#4",0,1,2,3,4]));
|
||||||
num = is_num(size) ? size : ord(size[1]) - ord("0");
|
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];
|
b = [0.61, 0.97, 1.47, 2.41, 3.48][num];
|
||||||
e = [0.31, 0.435, 0.815, 2.005, 2.415][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];
|
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];
|
alpha = [ 136, 138, 140, 146, 153][num];
|
||||||
beta = [7.00, 7.00, 5.75, 5.75, 7.00][num];
|
beta = [7.00, 7.00, 5.75, 5.75, 7.00][num];
|
||||||
gamma = 92.0;
|
gamma = 92.0;
|
||||||
h1 = adj_ang_to_opp(g/2, _ph_bot_angle); // height of the small conical tip
|
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
|
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle()); // height of larger cone
|
||||||
l = h1+h2;
|
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];
|
p0 = [0,0];
|
||||||
p1 = [adj_ang_to_opp(e/2, 90-alpha/2), -e/2];
|
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];
|
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"),
|
num = is_num(size) ? size : ord(size[1]) - ord("0"),
|
||||||
shaft = [3,4.5,6,8,10][num],
|
shaft = [3,4.5,6,8,10][num],
|
||||||
g = [0.81, 1.27, 2.29, 3.81, 5.08][num],
|
g = [0.81, 1.27, 2.29, 3.81, 5.08][num],
|
||||||
_ph_bot_angle = 28.0,
|
h1 = adj_ang_to_opp(g/2, _ph_bot_angle()), // height of the small conical tip
|
||||||
_ph_side_angle = 26.5,
|
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>=shaft || d<g ? undef :
|
||||||
(d-g) / 2 / tan(_ph_side_angle) + h1;
|
(d-g) / 2 / tan(_ph_side_angle()) + h1;
|
||||||
|
|
||||||
|
|
||||||
// Function: phillips_diam()
|
// 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]))
|
assert(in_list(size,["#0","#1","#2","#3","#4",0,1,2,3,4]))
|
||||||
let(
|
let(
|
||||||
num = is_num(size) ? size : ord(size[1]) - ord("0"),
|
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],
|
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
|
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
|
h2 = adj_ang_to_opp((shaft-g)/2, 90-_ph_side_angle()) // height of larger cone
|
||||||
)
|
)
|
||||||
depth<h1 || depth>= h1+h2 ? undef :
|
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()
|
// Function: torx_outer_diam()
|
||||||
|
// Usage:
|
||||||
|
// diam = torx_outer_diam(size);
|
||||||
// Description: Get the typical outer diameter of Torx profile.
|
// Description: Get the typical outer diameter of Torx profile.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
|
@ -152,6 +151,8 @@ function torx_outer_diam(size) = lookup(size, [
|
||||||
|
|
||||||
|
|
||||||
// Function: torx_inner_diam()
|
// Function: torx_inner_diam()
|
||||||
|
// Usage:
|
||||||
|
// diam = torx_inner_diam(size);
|
||||||
// Description: Get typical inner diameter of Torx profile.
|
// Description: Get typical inner diameter of Torx profile.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
|
@ -176,6 +177,8 @@ function torx_inner_diam(size) = lookup(size, [
|
||||||
|
|
||||||
|
|
||||||
// Function: torx_depth()
|
// Function: torx_depth()
|
||||||
|
// Usage:
|
||||||
|
// depth = torx_depth(size);
|
||||||
// Description: Gets typical drive hole depth.
|
// Description: Gets typical drive hole depth.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
|
@ -200,6 +203,8 @@ function torx_depth(size) = lookup(size, [
|
||||||
|
|
||||||
|
|
||||||
// Function: torx_tip_radius()
|
// Function: torx_tip_radius()
|
||||||
|
// Usage:
|
||||||
|
// rad = torx_tip_radius(size);
|
||||||
// Description: Gets minor rounding radius of Torx profile.
|
// Description: Gets minor rounding radius of Torx profile.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
|
@ -224,6 +229,8 @@ function torx_tip_radius(size) = lookup(size, [
|
||||||
|
|
||||||
|
|
||||||
// Function: torx_rounding_radius()
|
// Function: torx_rounding_radius()
|
||||||
|
// Usage:
|
||||||
|
// rad = torx_rounding_radius(size);
|
||||||
// Description: Gets major rounding radius of Torx profile.
|
// Description: Gets major rounding radius of Torx profile.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
|
@ -249,6 +256,8 @@ function torx_rounding_radius(size) = lookup(size, [
|
||||||
|
|
||||||
|
|
||||||
// Module: torx_mask2d()
|
// Module: torx_mask2d()
|
||||||
|
// Usage:
|
||||||
|
// torx_mask2d(size);
|
||||||
// Description: Creates a torx bit 2D profile.
|
// Description: Creates a torx bit 2D profile.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
|
@ -287,11 +296,14 @@ module torx_mask2d(size) {
|
||||||
|
|
||||||
|
|
||||||
// Module: torx_mask()
|
// Module: torx_mask()
|
||||||
|
// Usage:
|
||||||
|
// torx_mask(size, l, [center]);
|
||||||
// Description: Creates a torx bit tip.
|
// Description: Creates a torx bit tip.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = Torx size.
|
// size = Torx size.
|
||||||
// l = Length of bit.
|
// l = Length of bit.
|
||||||
// center = If true, centers bit vertically.
|
// center = If true, centers bit vertically.
|
||||||
|
// ---
|
||||||
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#anchor). Default: `CENTER`
|
// 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`
|
// 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`
|
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#orient). Default: `UP`
|
||||||
|
|
36
vectors.scad
36
vectors.scad
|
@ -63,6 +63,8 @@ function add_scalar(v,s) =
|
||||||
|
|
||||||
|
|
||||||
// Function: v_mul()
|
// Function: v_mul()
|
||||||
|
// Usage:
|
||||||
|
// v3 = v_mul(v1, v2);
|
||||||
// Description:
|
// Description:
|
||||||
// Element-wise multiplication. Multiplies each element of `v1` by the corresponding element of `v2`.
|
// 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.
|
// 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()
|
// Function: v_div()
|
||||||
|
// Usage:
|
||||||
|
// v3 = v_div(v1, v2);
|
||||||
// Description:
|
// Description:
|
||||||
// Element-wise vector division. Divides each element of vector `v1` by
|
// Element-wise vector division. Divides each element of vector `v1` by
|
||||||
// the corresponding element of vector `v2`. Returns a vector of the quotients.
|
// the corresponding element of vector `v2`. Returns a vector of the quotients.
|
||||||
|
@ -91,6 +95,8 @@ function v_div(v1, v2) =
|
||||||
|
|
||||||
|
|
||||||
// Function: v_abs()
|
// Function: v_abs()
|
||||||
|
// Usage:
|
||||||
|
// v2 = v_abs(v);
|
||||||
// Description: Returns a vector of the absolute value of each element of vector `v`.
|
// Description: Returns a vector of the absolute value of each element of vector `v`.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// v = The vector to get the absolute values of.
|
// v = The vector to get the absolute values of.
|
||||||
|
@ -102,6 +108,8 @@ function v_abs(v) =
|
||||||
|
|
||||||
|
|
||||||
// Function: v_floor()
|
// Function: v_floor()
|
||||||
|
// Usage:
|
||||||
|
// v2 = v_floor(v);
|
||||||
// Description:
|
// Description:
|
||||||
// Returns the given vector after performing a `floor()` on all items.
|
// Returns the given vector after performing a `floor()` on all items.
|
||||||
function v_floor(v) =
|
function v_floor(v) =
|
||||||
|
@ -110,6 +118,8 @@ function v_floor(v) =
|
||||||
|
|
||||||
|
|
||||||
// Function: v_ceil()
|
// Function: v_ceil()
|
||||||
|
// Usage:
|
||||||
|
// v2 = v_ceil(v);
|
||||||
// Description:
|
// Description:
|
||||||
// Returns the given vector after performing a `ceil()` on all items.
|
// Returns the given vector after performing a `ceil()` on all items.
|
||||||
function v_ceil(v) =
|
function v_ceil(v) =
|
||||||
|
@ -118,6 +128,8 @@ function v_ceil(v) =
|
||||||
|
|
||||||
|
|
||||||
// Function: v_lookup()
|
// Function: v_lookup()
|
||||||
|
// Usage:
|
||||||
|
// v2 = v_ceil(x, v);
|
||||||
// Description:
|
// 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.
|
// 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:
|
// Arguments:
|
||||||
|
@ -147,7 +159,7 @@ function v_lookup(x, v) =
|
||||||
|
|
||||||
// Function: unit()
|
// Function: unit()
|
||||||
// Usage:
|
// Usage:
|
||||||
// unit(v, [error]);
|
// v = unit(v, [error]);
|
||||||
// Description:
|
// Description:
|
||||||
// Returns the unit length normalized version of vector v. If passed a zero-length vector,
|
// 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.
|
// 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()
|
// Function: vector_angle()
|
||||||
// Usage:
|
// Usage:
|
||||||
// vector_angle(v1,v2);
|
// ang = vector_angle(v1,v2);
|
||||||
// vector_angle([v1,v2]);
|
// ang = vector_angle([v1,v2]);
|
||||||
// vector_angle(PT1,PT2,PT3);
|
// ang = vector_angle(PT1,PT2,PT3);
|
||||||
// vector_angle([PT1,PT2,PT3]);
|
// ang = vector_angle([PT1,PT2,PT3]);
|
||||||
// Description:
|
// 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 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.
|
// 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()
|
// Function: vector_axis()
|
||||||
// Usage:
|
// Usage:
|
||||||
// vector_axis(v1,v2);
|
// axis = vector_axis(v1,v2);
|
||||||
// vector_axis([v1,v2]);
|
// axis = vector_axis([v1,v2]);
|
||||||
// vector_axis(PT1,PT2,PT3);
|
// axis = vector_axis(PT1,PT2,PT3);
|
||||||
// vector_axis([PT1,PT2,PT3]);
|
// axis = vector_axis([PT1,PT2,PT3]);
|
||||||
// Description:
|
// 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 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.
|
// 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()
|
// Function: vector_nearest()
|
||||||
// Usage:
|
// Usage:
|
||||||
// indices = vector_nearest(query, k, target)
|
// indices = vector_nearest(query, k, target);
|
||||||
// See Also: vector_search(), vector_search_tree()
|
// See Also: vector_search(), vector_search_tree()
|
||||||
// Description:
|
// Description:
|
||||||
// Search `target` for the `k` points closest to point `query`.
|
// Search `target` for the `k` points closest to point `query`.
|
||||||
|
@ -560,8 +572,8 @@ function _insert_sorted(list, k, new) =
|
||||||
|
|
||||||
function _insert_many(list, k, newlist,i=0) =
|
function _insert_many(list, k, newlist,i=0) =
|
||||||
i==len(newlist)
|
i==len(newlist)
|
||||||
? list
|
? list
|
||||||
: assert(is_vector(newlist[i],2), "The tree is invalid.")
|
: assert(is_vector(newlist[i],2), "The tree is invalid.")
|
||||||
_insert_many(_insert_sorted(list,k,newlist[i]),k,newlist,i+1);
|
_insert_many(_insert_sorted(list,k,newlist[i]),k,newlist,i+1);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue