mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-11 05:54:15 +02:00
Merge remote-tracking branch 'upstream/revarbat_dev'
This commit is contained in:
10
math.scad
10
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.")
|
||||
@@ -1037,7 +1037,7 @@ function count_true(l, nmax) =
|
||||
// data[len(data)-1]. This function uses a symetric derivative approximation
|
||||
// for internal points, f'(t) = (f(t+h)-f(t-h))/2h. For the endpoints (when closed=false) the algorithm
|
||||
// uses a two point method if sufficient points are available: f'(t) = (3*(f(t+h)-f(t)) - (f(t+2*h)-f(t+h)))/2h.
|
||||
//
|
||||
// .
|
||||
// If `h` is a vector then it is assumed to be nonuniform, with h[i] giving the sampling distance
|
||||
// between data[i+1] and data[i], and the data values will be linearly resampled at each corner
|
||||
// to produce a uniform spacing for the derivative estimate. At the endpoints a single point method
|
||||
@@ -1211,7 +1211,7 @@ function polynomial(p,z,k,total) =
|
||||
: polynomial(p,z,k+1, is_num(z) ? total*z+p[k] : C_times(total,z)+[p[k],0]);
|
||||
|
||||
// Function: poly_mult()
|
||||
// Usage
|
||||
// Usage:
|
||||
// polymult(p,q)
|
||||
// polymult([p1,p2,p3,...])
|
||||
// Description:
|
||||
|
Reference in New Issue
Block a user