mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-12-28 19:18:03 +00:00
Merge pull request #1861 from adrianVmariano/master
remove _EPSILON references from docs
This commit is contained in:
commit
cb89d4eed9
9 changed files with 52 additions and 51 deletions
|
|
@ -61,7 +61,7 @@ function approx(a,b,eps=_EPSILON) =
|
|||
// Otherwise, returns false.
|
||||
// Arguments:
|
||||
// x = The value to check.
|
||||
// eps = The maximum allowed variance. Default: `_EPSILON` (1e-9)
|
||||
// eps = The maximum allowed variance. Default: 1e-9
|
||||
// Example:
|
||||
// a = all_zero(0); // Returns: true.
|
||||
// b = all_zero(1e-3); // Returns: false.
|
||||
|
|
@ -84,7 +84,7 @@ function all_zero(x, eps=_EPSILON) =
|
|||
// Otherwise, returns false.
|
||||
// Arguments:
|
||||
// x = The value to check.
|
||||
// eps = The maximum allowed variance. Default: `_EPSILON` (1e-9)
|
||||
// eps = The maximum allowed variance. Default: 1e-9
|
||||
// Example:
|
||||
// a = all_nonzero(0); // Returns: false.
|
||||
// b = all_nonzero(1e-3); // Returns: true.
|
||||
|
|
@ -231,7 +231,7 @@ function all_equal(vec,eps=0) =
|
|||
// Returns true if the first and last points in the given list are equal to within epsilon.
|
||||
// Arguments:
|
||||
// list = list to check
|
||||
// eps = Tolerance for approximate equality. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance for approximate equality. Default: 1e-9
|
||||
function are_ends_equal(list, eps=_EPSILON) =
|
||||
assert(is_list(list) && len(list)>0, "Must give a nonempty list")
|
||||
approx(list[0], list[len(list)-1], eps=eps);
|
||||
|
|
@ -408,7 +408,7 @@ function max_index(vals, all=false) =
|
|||
// ---
|
||||
// start = The index to start searching from. Default: 0
|
||||
// all = If true, returns a list of all matching item indices. Default: false
|
||||
// eps = The maximum allowed floating point rounding error for numeric comparisons. Default: _EPSILON (1e-9)
|
||||
// eps = The maximum allowed floating point rounding error for numeric comparisons. Default: 1e-9 (1e-9)
|
||||
// Example:
|
||||
// find_approx(3,[4,5,3.01,2,2.99], eps=0.1); // Returns 2
|
||||
// find_approx(9,[4,5,3.01,2,2.99], eps=0.1); // Returns undef
|
||||
|
|
@ -442,7 +442,7 @@ function __find_approx(val, list, eps, i=0) =
|
|||
// Arguments:
|
||||
// list = The list to deduplicate.
|
||||
// closed = If true, treats first and last list entry as adjacent. Default: false
|
||||
// eps = The maximum tolerance between items. Default: _EPSILON
|
||||
// eps = The maximum tolerance between items. Default: 1e-9
|
||||
// Example:
|
||||
// a = deduplicate([8,3,4,4,4,8,2,3,3,8,8]); // Returns: [8,3,4,8,2,3,8]
|
||||
// b = deduplicate(closed=true, [8,3,4,4,4,8,2,3,3,8,8]); // Returns: [8,3,4,8,2,3]
|
||||
|
|
@ -519,7 +519,7 @@ function deduplicate_indexed(list, indices, closed=false, eps=_EPSILON) =
|
|||
// 1 are returned unchanged.
|
||||
// Arguments:
|
||||
// list = list to unwrap
|
||||
// eps = epsilon for comparison. Default: _EPSILON (1e-9)
|
||||
// eps = epsilon for comparison. Default: 1e-9 (1e-9)
|
||||
|
||||
function list_wrap(list, eps=_EPSILON) =
|
||||
assert(is_list(list))
|
||||
|
|
@ -546,7 +546,7 @@ function close_path(list,eps=_EPSILON) =
|
|||
// length 0 or 1 it is returned unchanged.
|
||||
// Arguments:
|
||||
// list = list to unwrap
|
||||
// eps = epsilon for comparison. Default: _EPSILON (1e-9)
|
||||
// eps = epsilon for comparison. Default: 1e-9
|
||||
function list_unwrap(list, eps=_EPSILON) =
|
||||
assert(is_list(list))
|
||||
len(list)>=2 && are_ends_equal(list,eps=eps)? [for (i=[0:1:len(list)-2]) list[i]] : list;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ _BOSL2_GEOMETRY = is_undef(_BOSL2_STD) && (is_undef(BOSL2_NO_STD_WARNING) || !BO
|
|||
// point = The point to test.
|
||||
// line = Array of two points defining the line, ray, or segment to test against.
|
||||
// bounded = boolean or list of two booleans defining endpoint conditions for the line. If false treat the line as an unbounded line. If true treat it as a segment. If [true,false] treat as a ray, based at the first endpoint. Default: false
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
function is_point_on_line(point, line, bounded=false, eps=_EPSILON) =
|
||||
assert(is_finite(eps) && (eps>=0), "\nThe tolerance should be a non-negative value." )
|
||||
assert(is_vector(point), "\nPoint must be a vector.")
|
||||
|
|
@ -156,7 +156,7 @@ function _point_left_of_line2d(point, line, eps=_EPSILON) =
|
|||
// a = First point or list of points.
|
||||
// b = Second point or undef; it should be undef if `c` is undef
|
||||
// c = Third point or undef.
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
function is_collinear(a, b, c, eps=_EPSILON) =
|
||||
assert( is_path([a,b,c],dim=undef)
|
||||
|| ( is_undef(b) && is_undef(c) && is_path(a,dim=undef) ),
|
||||
|
|
@ -284,7 +284,7 @@ function _general_line_intersection(s1,s2,eps=_EPSILON) =
|
|||
// bounded2 = boolean or list of two booleans defining which ends are bounded for line2. Default: [false,false]
|
||||
// ---
|
||||
// bounded = boolean or list of two booleans defining which ends are bounded for both lines. The bounded1 and bounded2 parameters override this if both are given.
|
||||
// eps = tolerance for geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = tolerance for geometric comparisons. Default: 1e-9
|
||||
// Example(2D): The segments do not intersect but the lines do in this example.
|
||||
// line1 = 10*[[9, 4], [5, 7]];
|
||||
// line2 = 10*[[2, 3], [6, 5]];
|
||||
|
|
@ -424,7 +424,7 @@ function line_closest_point(line, pt, bounded=false) =
|
|||
// Arguments:
|
||||
// points = The list of points to find the line through.
|
||||
// check_collinear = If true, don't verify that all points are collinear. Default: false
|
||||
// eps = How much variance is allowed in testing each point against the line. Default: `_EPSILON` (1e-9)
|
||||
// eps = How much variance is allowed in testing each point against the line. Default: 1e-9
|
||||
// Example(FlatSpin,VPD=250): A line fitted to a cloud of points.
|
||||
// points = rot(45, v=[-0.5,1,0],
|
||||
// p=random_points(100,3,scale=[5,5,50],seed=47));
|
||||
|
|
@ -471,7 +471,7 @@ function line_from_points(points, check_collinear=false, eps=_EPSILON, fast) =
|
|||
// Returns true if the given 3D points are non-collinear and are on a plane.
|
||||
// Arguments:
|
||||
// points = The points to test.
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
function is_coplanar(points, eps=_EPSILON) =
|
||||
assert( is_path(points,dim=3) , "\nInput should be a list of 3D points." )
|
||||
assert( is_finite(eps) && eps>=0, "\nThe tolerance should be a non-negative value." )
|
||||
|
|
@ -618,7 +618,7 @@ function _covariance_evec_eval(points, eigenvalue_id) =
|
|||
// Arguments:
|
||||
// points = The list of points to find the best-fit plane.
|
||||
// check_coplanar = If true, verify the point coplanarity within `eps` tolerance. Default: false
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
// Example(FlatSpin,VPD=320,VPT=[-2,5,-2]): 100 non-coplanar random points (yellow spheres) distributed in a volume, showing the best-fit plane (transparent square) with its normal vector.
|
||||
// points = rot(45, v=[-0.3,1,0],
|
||||
// p=random_points(100,3,scale=[50,50,15],seed=47));
|
||||
|
|
@ -663,7 +663,7 @@ function plane_from_points(points, check_coplanar=false, eps=_EPSILON, fast) =
|
|||
// Arguments:
|
||||
// poly = The planar 3D polygon to find the plane of.
|
||||
// check_coplanar = If false, doesn't verify that all points in the polygon are coplanar. Default: true
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
// Example(3D):
|
||||
// xyzpath = rot(45, v=[0,1,0], p=path3d(star(n=5,step=2,d=100), 70));
|
||||
// plane = plane_from_polygon(xyzpath);
|
||||
|
|
@ -759,7 +759,7 @@ function _normalize_plane(plane) =
|
|||
// plane = The [A,B,C,D] values for the equation of the plane.
|
||||
// line = A list of two distinct 3D points that are on the line.
|
||||
// bounded = If false, the line is considered unbounded. If true, it is treated as a bounded line segment. If given as `[true, false]` or `[false, true]`, the boundedness of the points are specified individually, allowing the line to be treated as a half-bounded ray. Default: false (unbounded)
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
function plane_line_intersection(plane, line, bounded=false, eps=_EPSILON) =
|
||||
assert( is_finite(eps) && eps>=0, "\nThe tolerance should be a positive number." )
|
||||
assert(_valid_plane(plane,eps=eps) && _valid_line(line,dim=3,eps=eps), "\nInvalid plane and/or 3d line.")
|
||||
|
|
@ -915,7 +915,7 @@ function _pointlist_greatest_distance(points,plane) =
|
|||
// Arguments:
|
||||
// plane = The plane to test the points on.
|
||||
// points = The list of 3D points to test.
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
function are_points_on_plane(points, plane, eps=_EPSILON) =
|
||||
assert( _valid_plane(plane), "\nInvalid plane." )
|
||||
assert( is_matrix(points,undef,3) && len(points)>0, "\nInvalid pointlist." ) // using is_matrix it accepts len(points)==1
|
||||
|
|
@ -1074,7 +1074,7 @@ function _circle_or_sphere_line_intersection(r, cp, line, bounded=false, d, eps=
|
|||
// cp1 = Centerpoint of the first circle.
|
||||
// r2 = Radius of the second circle.
|
||||
// cp2 = Centerpoint of the second circle.
|
||||
// eps = Tolerance for detecting tangent circles. Default: _EPSILON
|
||||
// eps = Tolerance for detecting tangent circles. Default: 1e-9
|
||||
// ---
|
||||
// d1 = Diameter of the first circle.
|
||||
// d2 = Diameter of the second circle.
|
||||
|
|
@ -1421,7 +1421,7 @@ function circle_circle_tangents(r1, cp1, r2, cp2, d1, d2) =
|
|||
/// Arguments:
|
||||
/// points = List of input points.
|
||||
/// error = Defines the behaviour for collinear input points. When `true`, produces an error, otherwise returns []. Default: `true`.
|
||||
/// eps = Tolerance for collinearity test. Default: _EPSILON.
|
||||
/// eps = Tolerance for collinearity test. Default: 1e-9.
|
||||
function _noncollinear_triple(points,error=true,eps=_EPSILON) =
|
||||
assert( is_path(points), "\nInvalid input points." )
|
||||
assert( is_finite(eps) && (eps>=0), "The tolerance should be a non-negative value." )
|
||||
|
|
@ -1581,7 +1581,7 @@ function _region_centroid(region,eps=_EPSILON) =
|
|||
/// polygons or an error is produced.
|
||||
/// Arguments:
|
||||
/// poly = Points of the polygon from which the centroid is calculated.
|
||||
/// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
/// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
function _polygon_centroid(poly, eps=_EPSILON) =
|
||||
assert( is_path(poly,dim=[2,3]), "\nThe input must be a 2D or 3D polygon." )
|
||||
let(
|
||||
|
|
@ -1683,7 +1683,7 @@ function polygon_normal(poly) =
|
|||
// point = The 2D point to check
|
||||
// poly = The list of 2D points forming the perimeter of the polygon.
|
||||
// nonzero = The rule to use: true for "Nonzero" rule and false for "Even-Odd". Default: false (Even-Odd)
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
// Example(2D): With nonzero set to false (the default), we get this result. Green dots are inside the polygon and red are outside:
|
||||
// a=20*2/3;
|
||||
// b=30*2/3;
|
||||
|
|
@ -1805,7 +1805,7 @@ function point_in_polygon(point, poly, nonzero=false, eps=_EPSILON) =
|
|||
// line = A list of two distinct 3D points on the line.
|
||||
// bounded = If false, the line is considered unbounded. If true, it is treated as a bounded line segment. If given as `[true, false]` or `[false, true]`, the boundedness of the points are specified individually, allowing the line to be treated as a half-bounded ray. Default: false (unbounded)
|
||||
// nonzero = set to true to use the nonzero rule for determining it points are in a polygon. See point_in_polygon. Default: false.
|
||||
// eps = Tolerance in geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Tolerance in geometric comparisons. Default: 1e-9
|
||||
// Example(3D): The line intersects the 3d hexagon in a single point.
|
||||
// hex = zrot(140,p=rot([-45,40,20],p=path3d(hexagon(r=15))));
|
||||
// line = [[5,0,-13],[-3,-5,13]];
|
||||
|
|
@ -2003,7 +2003,7 @@ function _merge_segments(insegs,outsegs, eps, i=1) =
|
|||
// poly = Array of the polygon vertices.
|
||||
// ind = If given, a list of indices indexing the vertices of the polygon in `poly`. Default: use all the points of poly
|
||||
// error = If false, returns `undef` when the polygon cannot be triangulated; otherwise, issues an assert error. Default: true.
|
||||
// eps = A maximum tolerance in geometrical tests. Default: _EPSILON
|
||||
// eps = A maximum tolerance in geometrical tests. Default: 1e-9
|
||||
// Example(2D,NoAxes): a simple polygon; see from above
|
||||
// poly = star(id=10, od=15,n=11);
|
||||
// tris = polygon_triangulate(poly);
|
||||
|
|
@ -2695,7 +2695,7 @@ function _find_first_noncoplanar(plane, points, i=0) =
|
|||
// If the points are collinear or not coplanar an error may be generated.
|
||||
// Arguments:
|
||||
// poly = Polygon to check.
|
||||
// eps = Tolerance for the collinearity and coplanarity tests. Default: _EPSILON.
|
||||
// eps = Tolerance for the collinearity and coplanarity tests. Default: 1e-9.
|
||||
// Example:
|
||||
// test1 = is_polygon_convex(circle(d=50)); // Returns: true
|
||||
// test2 = is_polygon_convex(rot([50,120,30], p=path3d(circle(1,$fn=50)))); // Returns: true
|
||||
|
|
@ -2744,7 +2744,7 @@ function is_polygon_convex(poly,eps=_EPSILON) =
|
|||
// Arguments:
|
||||
// points1 = first list of 2d or 3d points.
|
||||
// points2 = second list of 2d or 3d points.
|
||||
// eps = tolerance in distance evaluations. Default: _EPSILON.
|
||||
// eps = tolerance in distance evaluations. Default: 1e-9.
|
||||
// Example(2D):
|
||||
// pts1 = move([-3,0], p=square(3,center=true));
|
||||
// pts2 = rot(a=45, p=square(2,center=true));
|
||||
|
|
@ -2804,7 +2804,7 @@ function _GJK_distance(points1, points2, eps=_EPSILON, lbd, d, simplex=[]) =
|
|||
// Arguments:
|
||||
// points1 = first list of 2d or 3d points.
|
||||
// points2 = second list of 2d or 3d points.
|
||||
// eps - tolerance for the intersection tests. Default: _EPSILON.
|
||||
// eps - tolerance for the intersection tests. Default: 1e-9.
|
||||
// Example(2D):
|
||||
// pts1 = move([-3,0], p=square(3,center=true));
|
||||
// pts2 = rot(a=45, p=square(2,center=true));
|
||||
|
|
|
|||
|
|
@ -3355,10 +3355,10 @@ function _metaballs2dfield(funclist, transmatrix, bbox, pixsize, nballs) = let(
|
|||
// *exp(-((y+4)/3)^2-x^2-0.5*z^2);
|
||||
//
|
||||
// left(6) isosurface(function(x,y,z) shape(x,y,z),
|
||||
// isovalue = [_EPSILON,INF],
|
||||
// isovalue = [EPSILON,INF],
|
||||
// bounding_box=bbox, voxel_size=0.25);
|
||||
// right(6) isosurface(function(x,y,z) log(shape(x,y,z)),
|
||||
// isovalue = [log(_EPSILON),INF],
|
||||
// isovalue = [log(EPSILON),INF],
|
||||
// bounding_box=bbox, voxel_size=0.25);
|
||||
// Example(3D): Using an array for the `f` argument instead of a function literal. Each row of the array represents an X index for a YZ plane with the array Z indices changing fastest in each plane. The final object may need rotation to get the orientation you want. You don't pass the `bounding_box` argument here; it is implied by the array size and voxel size, and centered on the origin.
|
||||
// field = [
|
||||
|
|
|
|||
15
math.scad
15
math.scad
|
|
@ -21,28 +21,29 @@ _BOSL2_MATH = is_undef(_BOSL2_STD) && (is_undef(BOSL2_NO_STD_WARNING) || !BOSL2_
|
|||
// Constant: PHI
|
||||
// Synopsis: The golden ratio φ (phi). Approximately 1.6180339887
|
||||
// Topics: Constants, Math
|
||||
// See Also: _EPSILON, INF, NAN
|
||||
// See Also: EPSILON, INF, NAN
|
||||
// Description: The golden ratio φ (phi). Approximately 1.6180339887
|
||||
PHI = (1+sqrt(5))/2;
|
||||
|
||||
// Constant: _EPSILON
|
||||
// Synopsis: A tiny value to compare floating point values. `1e-9`
|
||||
// Constant: EPSILON
|
||||
// Synopsis: A tiny value to compare floating point values. 1e-9
|
||||
// Topics: Constants, Math
|
||||
// See Also: PHI, INF, NAN
|
||||
// Description: A really small value useful in comparing floating point numbers. ie: abs(a-b)<_EPSILON `1e-9`
|
||||
_EPSILON = 1e-9;
|
||||
// Description: A really small value useful in comparing floating point numbers. ie: abs(a-b)<EPSILON. This is set to 1e-9, which is larger than machine epsilon, but generally works well in geometric computations.
|
||||
EPSILON = 1e-9;
|
||||
_EPSILON = 1e-9; // This is the private library version
|
||||
|
||||
// Constant: INF
|
||||
// Synopsis: The floating point value for Infinite.
|
||||
// Topics: Constants, Math
|
||||
// See Also: PHI, _EPSILON, NAN
|
||||
// See Also: PHI, EPSILON, NAN
|
||||
// Description: The value `inf`, useful for comparisons.
|
||||
INF = 1/0;
|
||||
|
||||
// Constant: NAN
|
||||
// Synopsis: The floating point value for Not a Number.
|
||||
// Topics: Constants, Math
|
||||
// See Also: PHI, _EPSILON, INF
|
||||
// See Also: PHI, EPSILON, INF
|
||||
// Description: The value `nan`, useful for comparisons.
|
||||
NAN = acos(2);
|
||||
|
||||
|
|
|
|||
14
paths.scad
14
paths.scad
|
|
@ -150,7 +150,7 @@ function _path_select(path, s1, u1, s2, u2, closed=false) =
|
|||
// Arguments:
|
||||
// path = A path of any dimension or a 1-region
|
||||
// closed = treat as closed polygon. Default: false
|
||||
// eps = Largest positional variance allowed. Default: `_EPSILON` (1-e9)
|
||||
// eps = Largest positional variance allowed. Default: 1e-9
|
||||
function path_merge_collinear(path, closed, eps=_EPSILON) =
|
||||
is_1region(path) ? path_merge_collinear(path[0], default(closed,true), eps) :
|
||||
let(closed=default(closed,false))
|
||||
|
|
@ -262,7 +262,7 @@ function path_length_fractions(path, closed) =
|
|||
/// Arguments:
|
||||
/// path = The path to find self intersections of.
|
||||
/// closed = If true, treat path like a closed polygon. Default: true
|
||||
/// eps = The epsilon error value to determine whether two points coincide. Default: `_EPSILON` (1e-9)
|
||||
/// eps = The epsilon error value to determine whether two points coincide. Default: 1e-9
|
||||
/// Example(2D):
|
||||
/// path = [
|
||||
/// [-100,100], [0,-50], [100,100], [100,-100], [0,50], [-100,-100]
|
||||
|
|
@ -691,7 +691,7 @@ function _err_resample(path, maxerr, n, i1=0, i2=2, resultidx=[0], iter=0) =
|
|||
// Arguments:
|
||||
// path = 2D path or 1-region
|
||||
// closed = set to true to treat path as a polygon. Default: false
|
||||
// eps = Epsilon error value used for determine if points coincide. Default: `_EPSILON` (1e-9)
|
||||
// eps = Epsilon error value used for determine if points coincide. Default: 1e-9
|
||||
function is_path_simple(path, closed, eps=_EPSILON) =
|
||||
is_1region(path) ? is_path_simple(path[0], default(closed,true), eps) :
|
||||
let(closed=default(closed,false))
|
||||
|
|
@ -1126,7 +1126,7 @@ function _cut_to_seg_u_form(pathcut, path, closed) =
|
|||
// Arguments:
|
||||
// path = A 2D path or a 1-region.
|
||||
// closed = If true, treat path as a closed polygon. Default: true
|
||||
// eps = Acceptable variance. Default: `_EPSILON` (1e-9)
|
||||
// eps = Acceptable variance. Default: 1e-9
|
||||
// Example(2D,NoAxes):
|
||||
// path = [ [-100,100], [0,-50], [100,100], [100,-100], [0,50], [-100,-100] ];
|
||||
// paths = split_path_at_self_crossings(path);
|
||||
|
|
@ -1197,7 +1197,7 @@ function _tag_self_crossing_subpaths(path, nonzero, closed=true, eps=_EPSILON) =
|
|||
// Arguments:
|
||||
// poly = a 2D polygon or 1-region
|
||||
// nonzero = If true use the nonzero method for checking if a point is in a polygon. Otherwise use the even-odd method. Default: false
|
||||
// eps = The epsilon error value to determine whether two points coincide. Default: `_EPSILON` (1e-9)
|
||||
// eps = The epsilon error value to determine whether two points coincide. Default: 1e-9
|
||||
// Example(2D,NoAxes): This cross-crossing polygon breaks up into its 3 components (regardless of the value of nonzero).
|
||||
// poly = [
|
||||
// [-100,100], [0,-50], [100,100],
|
||||
|
|
@ -1302,7 +1302,7 @@ function _extreme_angle_fragment(seg, fragments, rightmost=true, eps=_EPSILON) =
|
|||
/// fragments = List of paths to be assembled into complete polygons.
|
||||
/// rightmost = If true, assemble paths using rightmost turns. Leftmost if false.
|
||||
/// startfrag = The fragment to start with. Default: 0
|
||||
/// eps = The epsilon error value to determine whether two points coincide. Default: `_EPSILON` (1e-9)
|
||||
/// eps = The epsilon error value to determine whether two points coincide. Default: 1e-9
|
||||
function _assemble_a_path_from_fragments(fragments, rightmost=true, startfrag=0, eps=_EPSILON) =
|
||||
len(fragments)==0? [[],[]] :
|
||||
len(fragments)==1? [fragments[0],[]] :
|
||||
|
|
@ -1357,7 +1357,7 @@ function _assemble_a_path_from_fragments(fragments, rightmost=true, startfrag=0,
|
|||
/// Polygons with area < eps are discarded and not returned.
|
||||
/// Arguments:
|
||||
/// fragments = List of paths to be assembled into complete polygons.
|
||||
/// eps = The epsilon error value to determine whether two points coincide. Default: `_EPSILON` (1e-9)
|
||||
/// eps = The epsilon error value to determine whether two points coincide. Default: 1e-9
|
||||
function _assemble_path_fragments(fragments, eps=_EPSILON, _finished=[]) =
|
||||
len(fragments)==0? _finished :
|
||||
let(
|
||||
|
|
|
|||
10
regions.scad
10
regions.scad
|
|
@ -97,7 +97,7 @@ function is_region(x) = is_list(x) && is_path(x.x);
|
|||
// a region.
|
||||
// Arguments:
|
||||
// region = region to check
|
||||
// eps = tolerance for geometric comparisons. Default: `_EPSILON` = 1e-9
|
||||
// eps = tolerance for geometric comparisons. Default: 1e-9
|
||||
// Example(2D,NoAxes): In all of the examples each polygon in the region appears in a different color. Two non-intersecting squares make a valid region.
|
||||
// region = [square(10), right(11,square(8))];
|
||||
// rainbow(region)stroke($item, width=.2,closed=true);
|
||||
|
|
@ -255,7 +255,7 @@ function _polygon_crosses_region(region, poly, eps=_EPSILON) =
|
|||
// should not create problems with CGAL.
|
||||
// Arguments:
|
||||
// region = region to check
|
||||
// eps = tolerance for geometric comparisons. Default: `_EPSILON` = 1e-9
|
||||
// eps = tolerance for geometric comparisons. Default: 1e-9
|
||||
// Example(2D,NoAxes): Corner contact means it's not simple
|
||||
// region = [move([-2,-2],square(14)), [[0,0],[10,0],[5,5]], [[5,5],[0,10],[10,10]]];
|
||||
// rainbow(region)stroke($item, width=.2,closed=true);
|
||||
|
|
@ -288,7 +288,7 @@ function is_region_simple(region, eps=_EPSILON) =
|
|||
// Arguments:
|
||||
// polys = list of polygons to use
|
||||
// nonzero = set to true to use nonzero rule for polygon membership. Default: false
|
||||
// eps = Epsilon for geometric comparisons. Default: `_EPSILON` (1e-9)
|
||||
// eps = Epsilon for geometric comparisons. Default: 1e-9
|
||||
// Example(2D,NoAxes): The pentagram is self-intersecting, so it is not a region. Here it becomes five triangles:
|
||||
// pentagram = turtle(["move",100,"left",144], repeat=4);
|
||||
// region = make_region(pentagram);
|
||||
|
|
@ -433,7 +433,7 @@ module debug_region(region, vertices=true, edges=true, convexity=2, size=1)
|
|||
// Arguments:
|
||||
// point = The point to test.
|
||||
// region = The region to test against, as a list of polygon paths.
|
||||
// eps = Acceptable variance. Default: `_EPSILON` (1e-9)
|
||||
// eps = Acceptable variance. Default: 1e-9
|
||||
// Example(2D,Med): Red points are in the region.
|
||||
// region = [for(i=[2:4:10]) hexagon(r=i)];
|
||||
// color("#ff7") region(region);
|
||||
|
|
@ -611,7 +611,7 @@ function _region_region_intersections(region1, region2, closed1=true,closed2=tru
|
|||
// region2 = second region
|
||||
// closed1 = if false then treat region1 as list of open paths. Default: true
|
||||
// closed2 = if false then treat region2 as list of open paths. Default: true
|
||||
// eps = Acceptable variance. Default: `_EPSILON` (1e-9)
|
||||
// eps = Acceptable variance. Default: 1e-9
|
||||
// Example(2D):
|
||||
// path = square(50,center=false);
|
||||
// region = [circle(d=80), circle(d=40)];
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ function _format_matrix(M, sig=4, sep=1, eps=1e-9) =
|
|||
// Example(NORENDER):
|
||||
// format("The value of {} is {:.14f}.", ["pi", PI]); // Returns: "The value of pi is 3.14159265358979."
|
||||
// format("The value {1:f} is known as {0}.", ["pi", PI]); // Returns: "The value 3.141593 is known as pi."
|
||||
// format("We use a very small value {1:.6g} as {0}.", ["_EPSILON", _EPSILON]); // Returns: "We use a very small value 1e-9 as _EPSILON."
|
||||
// format("We use a very small value {1:.6g} as {0}.", ["EPSILON", EPSILON]); // Returns: "We use a very small value 1e-9 as EPSILON."
|
||||
// format("{:-5s}{:i}{:b}", ["foo", 12e3, 5]); // Returns: "foo 12000true"
|
||||
// format("{:-10s}{:.3f}", ["plecostamus",27.43982]); // Returns: "plecostamus27.440"
|
||||
// format("{:-10.9s}{:.3f}", ["plecostamus",27.43982]); // Returns: "plecostam 27.440"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ _BOSL2_VECTORS = is_undef(_BOSL2_STD) && (is_undef(BOSL2_NO_STD_WARNING) || !BOS
|
|||
// ---
|
||||
// zero = If false, require that the `norm()` of the vector is not approximately zero. If true, require the `norm()` of the vector to be approximately zero. Default: `undef` (don't check vector `norm()`.)
|
||||
// all_nonzero = If true, requires all elements of the vector to be more than `eps` different from zero. Default: `false`
|
||||
// eps = The minimum vector length that is considered non-zero. Default: `_EPSILON` (`1e-9`)
|
||||
// eps = The minimum vector length that is considered non-zero. Default: 1e-9
|
||||
// Example:
|
||||
// is_vector(4); // Returns false
|
||||
// is_vector([4,true,false]); // Returns false
|
||||
|
|
|
|||
6
vnf.scad
6
vnf.scad
|
|
@ -203,7 +203,7 @@ EMPTY_VNF = [[],[]]; // The standard empty VNF with no vertices or faces.
|
|||
// )
|
||||
// ];
|
||||
// cap = [
|
||||
// for (a = [0:0.01:1+_EPSILON]) apply(
|
||||
// for (a = [0:0.01:1+EPSILON]) apply(
|
||||
// up(90-5*sin(a*360*2)) * scale([a,a,1]),
|
||||
// wall_points[0]
|
||||
// )
|
||||
|
|
@ -803,7 +803,7 @@ function vnf_join(vnfs) =
|
|||
// Arguments:
|
||||
// polygons = The list of 3D polygons to turn into a VNF
|
||||
// fast = Set to true to skip area and coplanarity checks for increased speed. Default: false
|
||||
// eps = Polygons with area smaller than this are discarded. Default: _EPSILON
|
||||
// eps = Polygons with area smaller than this are discarded. Default: 1e-9
|
||||
// Example(3D,VPR=[60,0,40]): Construction of a dodecahedron from pentagon faces.
|
||||
// dihedral = 2*atan(PHI); // dodecahedron face dihedral
|
||||
// rpenta = 10; // pentagon face radius
|
||||
|
|
@ -1114,7 +1114,7 @@ function vnf_quantize(vnf,q=pow(2,-12)) =
|
|||
// To remove such vertices uses {{vnf_drop_unused_points()}}.
|
||||
// Arguments:
|
||||
// vnf = a VNF to consolidate
|
||||
// eps = the tolerance in finding duplicates. Default: _EPSILON
|
||||
// eps = the tolerance in finding duplicates. Default: 1e-9
|
||||
function vnf_merge_points(vnf,eps=_EPSILON) =
|
||||
let(
|
||||
verts = vnf[0],
|
||||
|
|
|
|||
Loading…
Reference in a new issue