Commit graph

175 commits

Author SHA1 Message Date
RonaldoCMP
e06519bbfb changes to hide recursion args and avoid repetitive arg validations
cumsum broken in two to hide recursion args and avoid repetitive arg validations.

back_substitute changed to avoid repetitive arg validations in the recursion.

minor change in deriv2 and deriv3 to avoid an unecessary call to is_matrix.

change in is_matrix for better performance

any() and all() broken in two to avoid repetitive arg validation in the recursion and to hide recursion args.

change in polymult to call convolve

break of poly_div in two to avoid repetitive arg validations in the recursion.
2020-08-04 00:38:36 +01:00
RonaldoCMP
0e7517ecfe Merge branch 'master' of https://github.com/RonaldoCMP/BOSL2 2020-08-04 00:16:33 +01:00
RonaldoCMP
c9408a66fa Merge remote-tracking branch 'upstream/master' 2020-08-04 00:13:26 +01:00
RonaldoCMP
e4bd6238b4 Revert "Minor edits in is_matrix"
This reverts commit 764420e71d.
2020-08-04 00:08:23 +01:00
Garth Minette
e56f953c1c Fixed calls to vmul() with heteerogenous vector sizes. 2020-08-02 23:23:50 -07:00
Adrian Mariano
817bdffdef Removed bogus median function 2020-08-02 01:20:11 -04:00
RonaldoCMP
764420e71d Minor edits in is_matrix 2020-08-02 01:15:07 +01:00
RonaldoCMP
84fa648dc5 Revert "Minor is_matrix definition and format"
This reverts commit 2da259c2cc.
2020-08-02 01:08:24 +01:00
RonaldoCMP
afb236f084
Merge branch 'master' into master 2020-08-02 01:03:46 +01:00
RonaldoCMP
2da259c2cc Minor is_matrix definition and format 2020-08-02 00:47:22 +01:00
RonaldoCMP
e858d5627e Merge remote-tracking branch 'upstream/revarbat_dev' 2020-08-02 00:03:05 +01:00
Adrian Mariano
046266778c improved back_substitute, cleaned up a few other functions, removed
some non-breaking space characters.
2020-07-30 20:46:19 -04:00
RonaldoCMP
5c239187e9 removal of duplicate definitions 2020-07-31 00:57:52 +01:00
Garth Minette
aa0e77b1f4 Minor fixes for PR #216 2020-07-29 21:58:12 -07:00
Revar Desmera
5e98cbf679
Merge pull request #216 from RonaldoCMP/master
Extensive changes in arrays.scad, vectors.scad, common.scad and their regression test codes
2020-07-29 21:44:39 -07:00
RonaldoCMP
8a25764744 Overall review, input data check, format, new function definitions
New function definitions in commom.scad:
1. valid_range;
2. _list_pattern

New function definitions in math.scad:
1. binomial;
2. binomial_coefficient;
3. convolve;

Code review in math:
1. sum;
2. median;
3. is_matrix;
4. approx;
5. count_true;
6. doc of deriv2;
7. polynomial;
8. poly_mult;
9; poly_div;
10. _poly_trim

Code change in test_common:
1. new test_valid_range;
2. test_is_consistent

Code change in test_math:
1. test_approx;
2. new test_convolve;
3. new test_binomial;
4. new test_binomial_coefficient;
5. test_outer_product;
6. test_polynomial;
7. test_poly_mult;
8. test_poly_div;
9. test_poly_add;
2020-07-29 22:41:02 +01:00
RonaldoCMP
babc10d60d Revert "input checks in math and new function definitions"
This reverts commit 19e5a9504a.
2020-07-29 21:50:22 +01:00
RonaldoCMP
19e5a9504a input checks in math and new function definitions 2020-07-29 21:49:15 +01:00
RonaldoCMP
ec4d960ecb Revert "input checks, general review, adding new functions"
This reverts commit 51be74b5ec.
2020-07-29 15:30:57 +01:00
RonaldoCMP
281d945ed7 Revert "update"
This reverts commit d45f289a95.
2020-07-29 15:30:35 +01:00
RonaldoCMP
014eea601d Revert "formating"
This reverts commit f67226a6dd.
2020-07-29 06:52:12 +01:00
RonaldoCMP
f67226a6dd formating 2020-07-29 03:19:01 +01:00
RonaldoCMP
d45f289a95 update 2020-07-28 22:55:21 +01:00
RonaldoCMP
51be74b5ec input checks, general review, adding new functions
Defines functions:
1. binomial()
2. convolve()
3. all_numeric()
4. is_addable()

Input data check in all functions.

Recoding of:
1. cumsum (a non-recursive version)
2. median()
3. count_true() (more efficient version)
4. polynomial functions so that a zero polynomial is represented by [0] and not by []
2020-07-28 22:42:07 +01:00
Garth Minette
b5d465cf1e docs_gen.py now shows more docs errors. 2020-07-27 15:15:34 -07:00
Adrian Mariano
3864f14333 Added error bounds to poly_roots, added poly_div, poly_mult and
poly_add, fixed bugs in factorial.
2020-07-11 12:22:59 -04:00
Revar Desmera
506d3d76a8
Merge pull request #192 from adrianVmariano/master
bug fix for qr_factor in case of zero columns
2020-07-06 19:06:48 -07:00
Adrian Mariano
8fed4dece9 bug fix for qr_factor in case of zero columns 2020-07-06 21:50:50 -04:00
Garth Minette
feba482396 Optimizations for is_vector(), is_matrix(). Added is_finite(). 2020-07-06 18:28:35 -07:00
Revar Desmera
20dfaac113 Bugfix for #182. Added assert_equal() and assert_approx() for regression helpers. 2020-06-20 19:51:58 -07:00
Adrian Mariano
7aab27266f Added polynomial root finding and complex math to math.scad. Changed
path_to_bezier to new algorithm (which uses polynomial roots).  And
updated path_smooth to use the new code.

Also removed extra (?) include<skin.scad> and
include<strings.scad> from rounding.scad and
removed the common $fn=36 that was forced on all the examples.  (May
break something...we'll look at the examples and see.)  I added $fn=36
to some examples.
2020-06-18 17:50:25 -04:00
Adrian Mariano
a5753d7953 Added non-uniform sampling to deriv and uniform option to
path_tangents, and path_segment_lengths.
2020-06-13 22:35:22 -04:00
Adrian Mariano
224555a9ec Speed improvement for sum() in vector and list of vectors case 2020-06-13 20:39:45 -04:00
Revar Desmera
53c1e25395 Standardize indention on spaces, not tabs. 2020-05-29 19:04:34 -07:00
Revar Desmera
a9e72f06da
Merge branch 'master' into master 2020-03-22 21:42:14 -07:00
Revar Desmera
d52c10f03b Improved approx() to handle matrices. 2020-03-22 02:41:47 -07:00
Adrian Mariano
72aae0e42c Expanded sqr() to take lists and removed vsqr() 2020-03-21 09:19:49 -04:00
Adrian Mariano
02ab8ea1d8 bug fix for back_substitute that breaks underdetermined solves in
linear_solve with matrix RHS.
2020-03-17 23:50:57 -04:00
Revar Desmera
b0a57dab7d Tweaked math.scad code formatting. 2020-03-17 19:55:07 -07:00
Revar Desmera
8999338d63
Merge branch 'master' into master 2020-03-17 19:51:36 -07:00
Adrian Mariano
8fc3af0264 modified linear solvers to handle matrix RHS, added error checking to
lerp and affine_frame_map, adde same_shape(), added square option to
is_matrix.
2020-03-17 07:11:25 -04:00
Revar Desmera
3ac23e15e6 Added median() 2020-03-17 01:13:47 -07:00
Adrian Mariano
ee82a8bb97 bug fix qr factorization, removed echo in plane intersection, fixed
bezier_surface so vnf arg is in right order
2020-03-09 21:05:57 -04:00
Adrian Mariano
4722cc0d01 Added is_matrix() and error handling for linear_solve() and qr() 2020-03-06 18:33:53 -05:00
Adrian Mariano
fcbeadc363 renamed replist to repeat
fixed normalization issue in path_to_bezier
2020-03-04 23:22:39 -05:00
Adrian Mariano
51af394c24 Added force_list, path_to_bezier, smooth_path, associate_vertices,
improved skin and sweep error handling.  Allow path_sweep to take a 2d
path.
2020-03-04 20:24:00 -05:00
Adrian Mariano
243dd7723e added is_consistent, added error check to sum(), clarified docs to
is_path, and added fast versions of path2d, path3d and path4d.
2020-03-02 21:39:57 -05:00
Revar Desmera
28114b49b5 Cleaned up code formatting in math.scad. 2020-03-01 15:42:12 -08:00
Adrian Mariano
1e6cf426a9 changed order so linear_solve and submatrix are first. 2020-02-29 22:59:39 -05:00
Adrian Mariano
5bd2cba0ff Added colons to "Function" doc strings 2020-02-29 22:56:24 -05:00
Adrian Mariano
629d1c00b2 Added linear_solve() 2020-02-28 17:40:52 -05:00
Adrian Mariano
f8fc8cb544 Adds sweep and new version of path_sweep to skin.scad, which probably
needs a name change.  Adds apply(), apply_list() and
affine_frame_map() to affine.scad.  Adds derivative calcluation to
math.scad.  Adds path_tangent, path_normal, path_curvature and
path_torsion functions.  Adds path_length_fraction().
Fixed bug in reindex_polygon where it randomly reverses a 3d path (due
to clockwise check that is bogus in 3d) and put a check in
polygon_is_clockwise to trap this case.
2020-02-27 17:32:03 -05:00
Revar Desmera
019961aef7 Added dflt= arg to sum(), defaulting to 0. 2020-02-08 21:54:39 -08:00
Revar Desmera
ba032e2f4d Added NAN, INF, and is_nan(). 2020-02-06 22:51:16 -08:00
Revar Desmera
231bb69634 Fixed bug introduced into sum() when summing lists of vectors. 2020-01-09 14:28:54 -08:00
Revar Desmera
48d30fc686 Reorganize math.scad 2020-01-08 20:43:19 -08:00
Adrian Mariano
29b682be96 Added lcm() and gcd() and is_integer() to math.scad. Added a couple
3d examples for supershape() that I snagged from
list-comprehension-demo.  Added repeat_entries to array.scad.  Note
dependence on _sum_preserving_round which is in paths.scad.  Also note
it's possible _force_list (added to math.scad) should be exposed, or
placed elsewhere.
2019-12-06 19:27:49 -05:00
Revar Desmera
9f92fe8775 Enhanced lerp() to allow list/range u values to return lists of results. 2019-11-18 21:11:38 -08:00
Revar Desmera
5cca83958f gaussian_rand() -> gaussian_rands(), log_rand() -> log_rands() 2019-11-06 22:19:19 -08:00
Revar Desmera
50acb3c0b0 Various bugfixes, optimizations, and docs improvements found via regressions. 2019-10-25 15:16:48 -07:00
Revar Desmera
bbabc641da Removed redundant vquant*() functions. Improved docs." 2019-10-22 17:09:08 -07:00
Revar Desmera
a85ea4ecc9 Added modang() to standardize angles to <-180,180> 2019-09-23 16:38:07 -07:00
Revar Desmera
ccfed6b306 Fixed a typo in det2() docs. 2019-09-19 02:42:42 -07:00
Revar Desmera
e4ecb21217 quant\*() now work on vectors and pointlists. 2019-08-24 11:51:24 -07:00
Revar Desmera
aa8a084d62 Added log2() and cumsum() 2019-08-06 17:12:28 -07:00
Revar Desmera
e8300c5bb6 Fixed indexing of rand_int() 2019-07-18 21:58:41 -07:00
Revar Desmera
56b41b487b Improved compare_vals() and compare_lists() for heterogenous types. 2019-06-24 15:31:59 -07:00
Adrian Mariano
49365add3c Added faster and simpler versions of max_index and min_index. 2019-06-23 13:17:04 -04:00
Revar Desmera
62f913a148 Added rand_ints() and shuffle() 2019-05-29 17:42:09 -07:00
Revar Desmera
aadd189c97 Added det2(), det3(), and determinant() 2019-05-27 17:50:04 -07:00
Revar Desmera
4fb825ce14 Bugfix for deltas() 2019-05-26 23:30:44 -07:00
Revar Desmera
11e5406951 Fixed product() for matrices. 2019-05-12 13:41:26 -07:00
Revar Desmera
ba9b7c5b3b Added product() 2019-05-12 13:32:34 -07:00
Revar Desmera
e946031d99 Added deltas() 2019-05-10 03:00:41 -07:00
Revar Desmera
414f06df86 Fixed scalar approx() 2019-05-04 20:19:35 -07:00
Revar Desmera
55ff7f3a93 Added sqr() and approx() 2019-05-04 20:10:23 -07:00
Revar Desmera
c79e887612 Removed per-file copyright messages in favor of the LICENSE file. 2019-05-03 12:30:20 -07:00
Revar Desmera
cc36235736 Updated copyright years. Split math.scad up. Enabled attach for lots of shapes. Removed backwards compatability. 2019-04-19 17:02:17 -07:00
Revar Desmera
019aae4347 Brought args for rotate_points3d in line with rot() and rotate(). 2019-04-19 11:36:38 -07:00
Revar Desmera
1d6aefc867 Removed all uses and incudes. Document all includes needed for each file. Added std.scad include. 2019-04-19 00:25:10 -07:00
Revar Desmera
a46ea27fca Changed all BOSL references to BOSL2. 2019-04-18 23:45:46 -07:00
Revar Desmera
6b0e796462 Renamed all V_ constants. Removed ALIGN_ constants. 2019-04-18 23:32:17 -07:00
Revar Desmera
08711565e7 Removed deprecations. 2019-04-18 21:16:10 -07:00
Revar Desmera
96739c3ea0 Added convex_hull() 2019-04-16 15:34:54 -07:00
Revar Desmera
fde93d9991 Added PHI constant. 2019-04-12 00:08:56 -07:00
Revar Desmera
54d6ca2bd0 Added gaussian_rand() and log_rand(). 2019-04-10 15:53:40 -07:00
Revar Desmera
b7e3644df3 Fixed compare_vals for lists with single lists. 2019-04-08 20:51:29 -07:00
Revar Desmera
a84dec40fc Fixed rotate_points3d() and vector_axis() for un-normalized co-axial vectors. 2019-04-08 18:49:34 -07:00
Revar Desmera
670c47ca86 Added enumerate() and sortidx() 2019-04-04 20:27:01 -07:00
Revar Desmera
843268e9b8 Fixes for bugs found my math test suite. 2019-04-04 00:37:21 -07:00
Revar Desmera
e435660f11 Fixed recursive comparison of lists. 2019-04-03 13:54:48 -07:00
Revar Desmera
cc37b39344 Added matrix_transpose() 2019-04-02 19:07:13 -07:00
Revar Desmera
6f99eb7925 Fix dropped section header. 2019-04-01 23:44:12 -07:00
Revar Desmera
229b9e1e3c Optimizations to compare_vals() 2019-04-01 23:40:15 -07:00
Revar Desmera
a4c4738f80 Fixed rotate_points3d(from,to) 2019-04-01 18:55:48 -07:00
Revar Desmera
d1a9d98033 Made rotate_points3d() accept axis or from/to args. 2019-03-31 18:43:54 -07:00
Revar Desmera
282207701a Added replist() 2019-03-31 04:06:51 -07:00
Revar Desmera
f3c6fbc593 Commented out top-level variables in math.scad, due to pathological OpenSCAD behavious. 2019-03-31 03:21:07 -07:00
Revar Desmera
d7320b7c0a More select and posmod optimizations. 2019-03-31 00:03:02 -07:00
Revar Desmera
015c34d637 Large optimization to select() 2019-03-30 22:39:44 -07:00