Commit graph

153 commits

Author SHA1 Message Date
Adrian Mariano
b82f1b8e5d tweaked vac example in turtle3d
added delete_last() to arrays.scad
added endpoint= option to arc
added tests for last two things
2020-12-12 21:15:33 -05:00
Jerome Plut
1d324128e4 Added more flexibility to get_named_args(), and all the left_half(), etc. as functions 2020-12-03 21:40:32 +01:00
Garth Minette
38873d8ef9 Fixed a bunch of docs errors with Usage headers. 2020-10-03 20:29:35 -07:00
Garth Minette
16ee49e8b2 Fixed a bunch of undef math warnings with dev snapshot OpenSCAD builds. 2020-10-03 19:50:29 -07:00
Garth Minette
e3ccf482fa Make list functions make more sense with strings. 2020-09-28 19:12:07 -07:00
Adrian Mariano
9cd91cc6cc Faster version of norm_fro, and some arg validation 2020-09-02 16:46:58 -04:00
Adrian Mariano
399c40f7a6 Added null_space and diagonal_matrix 2020-09-01 18:38:31 -04:00
Adrian Mariano
8f6c2e8538 Add submatrix_set and block_matrix and tests 2020-09-01 16:42:47 -04:00
RonaldoCMP
42bffef35f Minor doc corrections 2020-08-30 12:18:53 +01:00
RonaldoCMP
bbe4ad1467 Sort debugging and optimizing
There were bugs in the previous sorting functions. They didn't check the homogeneity of the input list before calling _sort_scalars and _sort_vectors. The bug might result in wrong order and missing list elements in the output.
Besides correcting the bug a recode of all sorting functions result in better performance and a enlargement of their scope. With the new functions, list of vectors of any dimension may be sorted, even with idx given, with the native comparison operators. The scope of indexed sorting is also extended.

The file test_arrays has been extended to check the new funcionality.

New functions:

is_homogeneous - checks if a list has elements of the same type (although not distinguing booleans from numbers) up to a given depth
_sort_vectors - internal function to sort homgeneous lists of vectors using native comparison operators; extends the scope of the previous _sort_vectors# functions with better performance
_lexical_sort - internal function to sort non-homogeneous lists; uses compare_vals
_indexed_sort - internal function to perform indexed sorting of non-homogeneous lists; uses compar_vals

Changed/reviewed functions:
_valid_idx - doesn't requires the input of imin and imax args
sort - explores the internal functions to get better performance and an enlarged scope
sortidx - explores the internal functions to get better performance and an enlarged scope
_sort_general - just for sortings of non-homogeneous lists using compare_vals
_array_dim_recurse - changed for bit better performance

Functions eliminated:
 _sort_vectors1
 _sort_vectors2
 _sort_vectors3
 _sort_vectors4
2020-08-30 12:12:36 +01:00
Adrian Mariano
2eb0ce0348 added os_mask to rounding and tweaked error messages in transpose 2020-08-28 23:16:11 -04:00
RonaldoCMP
50b0f170e7 Extend the scope of transpose
It allows a transposition in respect to the secondary "diagonal"
2020-08-11 14:55:25 +01:00
RonaldoCMP
1df84f3552 Revert "Extend scope of transpose"
This reverts commit 5ebf1c80b9.
2020-08-11 14:33:42 +01:00
RonaldoCMP
5ebf1c80b9 Extend scope of transpose
Includes an arg to allow transposing in respecto to the secondary "diagonal"
2020-08-11 14:32:25 +01:00
RonaldoCMP
9a5724aebd
Merge branch 'master' into master 2020-08-05 06:22:07 +01:00
RonaldoCMP
c6b472318f Optimize sorting
Optimize _sort_general and change  accordingly sort and sortidx.
Introduce _valid_idx() to simplify teh validations of arg idx.
Add input validation to subindex().
2020-08-05 06:16:48 +01:00
Revar Desmera
c0481f14eb
Merge pull request #229 from adrianVmariano/master
move submatrix to arrays and relax input restrictions
2020-08-04 00:38:23 -07:00
Adrian Mariano
719f1ff585 doc bugfix 2020-08-03 19:58:11 -04:00
Adrian Mariano
baf4eb76dc doc tweak 2020-08-03 19:52:13 -04:00
Adrian Mariano
4e36eacca8 Moved submatrix to arrays.scad and relaxed requirement for numerical
input.  Added examples and tests.
2020-08-03 19:49:22 -04:00
RonaldoCMP
c9408a66fa Merge remote-tracking branch 'upstream/master' 2020-08-04 00:13:26 +01:00
Adrian Mariano
8f1162e7bf doc typo fix 2020-08-02 10:38:33 -04:00
Adrian Mariano
06b69475cb Fix bug. Add test for subindex. 2020-08-02 10:38:11 -04:00
Adrian Mariano
37ca6efebb Modified subindex to be faster. Note also changed behavior for
idx=singleton list.
2020-08-02 10:35:32 -04:00
RonaldoCMP
e858d5627e Merge remote-tracking branch 'upstream/revarbat_dev' 2020-08-02 00:03:05 +01:00
RonaldoCMP
526c01109c Minor edits in in_list and transpose, removal of is_simple list 2020-07-31 15:52:35 +01:00
RonaldoCMP
3b1d567219 Revert "Minor edits in in_list"
This reverts commit 74cc246c75.
2020-07-31 01:03:32 +01:00
RonaldoCMP
74cc246c75 Minor edits in in_list 2020-07-31 00:59:05 +01:00
Garth Minette
6064dcbed0 Fix list_remove() for null index list. 2020-07-29 22:39:17 -07: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
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
3d226f1ffa doc correction 2020-07-28 21:51:45 +01:00
RonaldoCMP
ab57790c27 Correction of is_vector and doc text 2020-07-28 19:02:35 +01:00
Garth Minette
b5d465cf1e docs_gen.py now shows more docs errors. 2020-07-27 15:15:34 -07:00
RonaldoCMP
c10a8b919d Extensive review of arrays.scad, vectors.scad, common.scad and their regression tests
Here is an extensive review of common.scad, vectors.scad, arrays.scad and their regression test codes. The changes were mostly in input data check and format. Some few functions got more changes either to adapt them to the new asserts or because a better (faster, simpler) code was found.

Another change was moving add_scalar from vectors.scad to arrays.scad. It is in fact an array operation. Some few documentation examples and test codes were added. Some function argument names were changed to keep them consistent with the names they have in other similar functions. That name changes were not as extensive as I would like but it is advisable to favor users.

Most, but not all, changed function codes are followed by a comment with a short summary of the changes done. Those comments always start with:
//***

I can eliminate those comments before a merge is done or in a second round.
2020-07-25 20:27:19 +01:00
RonaldoCMP
bdba4c0821 A broad review of input data check and code format
Some functions were changed for sake of clarity or better performance.
2020-07-24 22:54:34 +01:00
RonaldoCMP
d2e851ae42
Merge branch 'master' into master 2020-07-24 14:47:25 +01:00
RonaldoCMP
464c65ce8c Eliminating tabs 2020-07-24 13:30:19 +01:00
RonaldoCMP
f61e30add2 Update 2020-07-24 00:23:07 +01:00
RonaldoCMP
877a07b711 Full review of input data checking, formating and improvement in some functions
Refactorigng of list_set(), list_insert() and list_remove() without any sorting and speed gain.

Some argument names changed for consistence between functions.

test_array() updated.
2020-07-24 00:19:49 +01:00
Adrian Mariano
a73ca6368c fixed in_list bug 2020-07-21 19:55:05 -04:00
Garth Minette
4ebe89661a Enhanced force_list() with n= and fill= 2020-07-03 15:22:21 -07:00
Revar Desmera
53c1e25395 Standardize indention on spaces, not tabs. 2020-05-29 19:04:34 -07:00
Revar Desmera
0524194391 Optimizations for decompose_path() 2020-04-01 01:36:48 -07:00
Revar Desmera
abf1a78290 Bugfix for set_union() when b contains duplicate items. 2020-03-31 03:09:04 -07:00
Revar Desmera
1e2995fcf7 Added set_union(), set_difference(), set_intersection(). 2020-03-30 23:09:20 -07:00
Revar Desmera
8cd0168f27 Added asserts to select() 2020-03-25 15:05:27 -07:00
Revar Desmera
6183e6d0d2 Added deduplicate_indexed() 2020-03-24 14:51:37 -07:00
Adrian Mariano
6fa46ecb7c unique_count empty string bug fix 2020-03-18 21:31:22 -04:00
Adrian Mariano
b2538b4b19 nonrecursive rewrite of unique_count() 2020-03-17 22:01:21 -04: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
Revar Desmera
0f78d3bdc6 Removed accidental redundant is_consistent() implementation. 2020-03-02 21:26:59 -08:00
Revar Desmera
da7190ccbb Added is_consistent() 2020-03-02 20:23:44 -08:00
Revar Desmera
f838e8a1e2 Bugfix for variable error in unique() 2020-02-28 21:32:57 -08:00
Adrian Mariano
e096c193cd add unique_count 2020-02-11 20:23:31 -05:00
Revar Desmera
4662348aa6
Merge pull request #117 from adrianVmariano/master
Changed dovetail orientation to be more intuitive.
2020-01-24 22:24:17 -08:00
Revar Desmera
0de692f681 Example typo fix. 2020-01-23 17:01:41 -08:00
Adrian Mariano
07e111489c bselect() was broken 2020-01-22 23:23:28 -05:00
Revar Desmera
49ffaacb28 Tweak docs formatting in arrays.scad 2020-01-09 16:14:12 -08:00
Revar Desmera
2f1760a342 Reorganize arrays.scad docs 2020-01-09 16:10:18 -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
c05b6bfa5c Fixed erroneous assertion in list_range() 2019-11-19 18:02:36 -08:00
Adrian Mariano
c0d18ab0b1 Corrected processing of $fn for round_corners, added two examples
to skin (from list comp demos) and added another error check to zip.
2019-11-13 18:17:30 -05:00
Revar Desmera
0b38d7b546 Fixed error in shuffle() 2019-11-06 23:42:00 -08:00
Revar Desmera
302b8c4b2f Removed assert_in_list() in favor of assert(in_list()) 2019-10-31 01:33:28 -07:00
Revar Desmera
faea648e66 Simplified list_rotate() and polygon_shift() 2019-10-30 01:19:34 -07:00
Revar Desmera
b0cdbcca0a Added list_rotate() and a bunch of assert()s 2019-10-29 22:42:41 -07:00
Revar Desmera
18ec424317 Fixed list_decreasing() 2019-10-23 22:48:47 -07:00
Revar Desmera
bbabc641da Removed redundant vquant*() functions. Improved docs." 2019-10-22 17:09:08 -07:00
Revar Desmera
c0478728d2 Added list_remove_values() 2019-10-21 02:28:45 -07:00
Revar Desmera
ce724d2691 Added start= arg for idx() 2019-09-19 02:41:59 -07:00
Revar Desmera
7809b7bbe1 Added end option to idx() 2019-08-19 20:41:40 -07:00
Revar Desmera
a51e3563fe Added ability to list_insert() to multiple positions at once. 2019-08-17 01:14:00 -07:00
Revar Desmera
1e0ca09182 Added list_set() optimization for single scalar indices. 2019-08-15 20:49:04 -07:00
Revar Desmera
4a72997fb8 Fix for idx() and shuffle() docs formatting. 2019-07-18 21:28:15 -07:00
Revar Desmera
959781d6fe Added closed option to deduplicate(). Fixed inconsistent indentation. 2019-07-18 21:24:32 -07:00
Adrian Mariano
d86b94193b Handle zero length inputs for list_set and list_remove 2019-07-12 20:19:33 -04:00
Revar Desmera
c158d31289 Added idx() to return index range of a given list. 2019-07-09 18:40:36 -07:00
Adrian Mariano
48b154b9f8 Fixed bug in list_set and arg order 2019-06-28 18:26:05 -04:00
Revar Desmera
206946e7f2 Merge branch 'master' of github.com:revarbat/BOSL2 2019-06-25 17:44:25 -07:00
Revar Desmera
e162e14cc5 Added bselect() and list_bset() 2019-06-25 17:44:21 -07:00
Adrian Mariano
8ce98ab286 Changed sort and sortidx to use efficient method for certain cases. 2019-06-25 19:16:40 -04:00
Adrian Mariano
ba9011f002 Use each in flatten(). It's faster. 2019-06-22 17:00:12 -04:00
Adrian Mariano
60be226e85 Added 3 examples to roundcorners.
Added doc text for list_increasing and list_decreasing.
Added str_match, str_matches, starts_width, ends_width.
Fixed substr to use tail recursion.
2019-06-22 13:33:49 -04:00
Revar Desmera
5133734cfd Changed list_range(s,e,n) to auto-set step to (e-s)/(n-1). 2019-06-19 01:51:47 -07:00
Revar Desmera
d069cf39ce Added triplet() and triplet_wrap(). 2019-06-19 01:31:44 -07:00
Revar Desmera
3b1df57d5d Added deduplicate() 2019-06-16 23:54:44 -07:00
Revar Desmera
5edbb339bf Added list_set, list_increasing, list_decreasing 2019-06-11 19:26:06 -07:00
Revar Desmera
62f913a148 Added rand_ints() and shuffle() 2019-05-29 17:42:09 -07:00
Revar Desmera
9a860c53ef Optimized transpose() slightly. 2019-05-26 23:21:05 -07:00
Revar Desmera
8f2b9c4ef1 Optimized various array functions. 2019-05-26 23:18:49 -07:00
Revar Desmera
f378b70151 Added in range step of 1 to avoid errors. 2019-05-26 22:34:46 -07:00
Revar Desmera
e8e0d8f3d3 Fixed transpose() examples. 2019-05-12 12:54:09 -07:00
Revar Desmera
dba2edc984 Fixed transpose for vectors and non-array lists 2019-05-12 12:51:58 -07:00
Revar Desmera
78e3cd3c27 matrix_transpose() generalized to transpose() 2019-05-12 12:32:03 -07:00
Revar Desmera
09e89e9182 Fixed pair() and pair_wrap() 2019-05-10 02:59:12 -07:00