diff --git a/arrays.scad b/arrays.scad index 5068d3b..5154407 100644 --- a/arrays.scad +++ b/arrays.scad @@ -66,8 +66,8 @@ function select(list, start, end=undef) = list[ (start%l+l)%l ] : assert( is_list(start) || is_range(start), "Invalid start parameter") [for (i=start) list[ (i%l+l)%l ] ] - : assert(is_num(start), "Invalid start parameter.") - assert(is_num(end), "Invalid end parameter.") + : assert(is_finite(start), "Invalid start parameter.") + assert(is_finite(end), "Invalid end parameter.") let( s = (start%l+l)%l, e = (end%l+l)%l ) (s <= e)? [for (i = [s:1:e]) list[i]] : concat([for (i = [s:1:l-1]) list[i]], [for (i = [0:1:e]) list[i]]) ; diff --git a/math.scad b/math.scad index 3ff62d7..55e662b 100644 --- a/math.scad +++ b/math.scad @@ -240,7 +240,7 @@ function atanh(x) = // quant([9,10,10.4,10.5,11,12],3); // Returns: [9,9,9,12,12,12] // quant([[9,10,10.4],[10.5,11,12]],3); // Returns: [[9,9,9],[12,12,12]] function quant(x,y) = - assert(is_finite(y) && !approx(y,0,eps=1e-24), "The multiple must be a non zero integer.") + assert(is_finite(y) && !approx(y,0,eps=1e-24), "The multiple must be a non zero number.") is_list(x) ? [for (v=x) quant(v,y)] : assert( is_finite(x), "The input to quantize must be a number or a list of numbers.") @@ -272,7 +272,7 @@ function quant(x,y) = // quantdn([9,10,10.4,10.5,11,12],3); // Returns: [9,9,9,9,9,12] // quantdn([[9,10,10.4],[10.5,11,12]],3); // Returns: [[9,9,9],[9,9,12]] function quantdn(x,y) = - assert(is_finite(y) && !approx(y,0,eps=1e-24), "The multiple must be a non zero integer.") + assert(is_finite(y) && !approx(y,0,eps=1e-24), "The multiple must be a non zero number.") is_list(x) ? [for (v=x) quantdn(v,y)] : assert( is_finite(x), "The input to quantize must be a number or a list of numbers.") @@ -304,7 +304,7 @@ function quantdn(x,y) = // quantup([9,10,10.4,10.5,11,12],3); // Returns: [9,12,12,12,12,12] // quantup([[9,10,10.4],[10.5,11,12]],3); // Returns: [[9,12,12],[12,12,12]] function quantup(x,y) = - assert(is_finite(y) && !approx(y,0,eps=1e-24), "The multiple must be a non zero integer.") + assert(is_finite(y) && !approx(y,0,eps=1e-24), "The multiple must be a non zero number.") is_list(x) ? [for (v=x) quantup(v,y)] : assert( is_finite(x), "The input to quantize must be a number or a list of numbers.") diff --git a/vectors.scad b/vectors.scad index 51f4735..80909b2 100644 --- a/vectors.scad +++ b/vectors.scad @@ -19,6 +19,8 @@ // Arguments: // v = The value to test to see if it is a vector. // length = If given, make sure the vector is `length` items long. +// zero = If false, require that the length of the vector is not approximately zero. If true, require the length of the vector to be approximately zero-length. Default: `undef` (don't check vector length.) +// eps = The minimum vector length that is considered non-zero. Default: `EPSILON` (`1e-9`) // Example: // is_vector(4); // Returns false // is_vector([4,true,false]); // Returns false diff --git a/version.scad b/version.scad index b6ba49c..483c726 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,399]; +BOSL_VERSION = [2,0,400]; // Section: BOSL Library Version Functions