1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-29 17:30:11 +02:00

change dir

This commit is contained in:
Justin Lin
2021-03-06 15:58:56 +08:00
parent 5c4c0b1e08
commit 2b2beb873e
20 changed files with 41 additions and 40 deletions

View File

@@ -29,6 +29,8 @@ New modules/functions
- `util/find_index`
- `maze/mz_theta_cells`
- `maze/mz_theta_get`
- `util/set/hashset` ...
- `util/map/hashmap` ...
- delete `m_cumulate`
- delete `trianglate`, use `tri_ear_clipping`?

View File

@@ -1,5 +1,5 @@
use <_hashmap_add_impl.scad>;
use <_hashmap_put_impl.scad>;
function _hashmap(kv_lt, leng, buckets, eq, hash, i = 0) =
i == leng ? buckets :
_hashmap(kv_lt, leng, _hashmap_add(buckets, kv_lt[i][0], kv_lt[i][1], eq, hash), eq, hash, i + 1);
_hashmap(kv_lt, leng, _hashmap_put(buckets, kv_lt[i][0], kv_lt[i][1], eq, hash), eq, hash, i + 1);

View File

@@ -1,6 +1,6 @@
use <../../util/slice.scad>;
use <../../util/some.scad>;
use <../../util/find_index.scad>;
use <../../slice.scad>;
use <../../some.scad>;
use <../../find_index.scad>;
function _hashmap_put(map, key, value, eq, hash) =
let(

View File

@@ -1,6 +1,6 @@
use <../__comm__/_str_hash.scad>;
use <../../__comm__/_str_hash.scad>;
use <_impl/_hashmap_impl.scad>;
use <_impl/_hashmap_add_impl.scad>;
use <_impl/_hashmap_put_impl.scad>;
function hashmap(kv_lt, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e), bucket_numbers) =
let(

View File

@@ -1,6 +1,6 @@
use <../__comm__/_str_hash.scad>;
use <../util/slice.scad>;
use <../util/find_index.scad>;
use <../../__comm__/_str_hash.scad>;
use <../slice.scad>;
use <../find_index.scad>;
function hashmap_del(map, key, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =
let(

View File

@@ -1,6 +1,6 @@
use <../__comm__/_str_hash.scad>;
use <../util/slice.scad>;
use <../util/find_index.scad>;
use <../../__comm__/_str_hash.scad>;
use <../slice.scad>;
use <../find_index.scad>;
function hashmap_get(map, key, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =
let(

View File

@@ -1,4 +1,4 @@
use <../util/sum.scad>;
use <../sum.scad>;
function hashmap_len(map) = sum([
for(bucket = map)

View File

@@ -1,4 +1,4 @@
use <../__comm__/_str_hash.scad>;
use <../../__comm__/_str_hash.scad>;
use <_impl/_hashmap_put_impl.scad>;
function hashmap_put(map, key, value, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =

View File

@@ -1,5 +1,5 @@
use <../../util/slice.scad>;
use <../../util/some.scad>;
use <../../slice.scad>;
use <../../some.scad>;
function _hashset_add(set, elem, eq, hash) =
let(

View File

@@ -1,4 +1,4 @@
use <../__comm__/_str_hash.scad>;
use <../../__comm__/_str_hash.scad>;
use <_impl/_hashset_impl.scad>;
use <_impl/_hashset_add_impl.scad>;

View File

@@ -1,4 +1,4 @@
use <../__comm__/_str_hash.scad>;
use <../../__comm__/_str_hash.scad>;
use <_impl/_hashset_add_impl.scad>;
function hashset_add(set, elem, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =

View File

@@ -1,6 +1,6 @@
use <../__comm__/_str_hash.scad>;
use <../util/slice.scad>;
use <../util/find_index.scad>;
use <../../__comm__/_str_hash.scad>;
use <../slice.scad>;
use <../find_index.scad>;
function hashset_del(set, elem, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =
let(

View File

@@ -1,5 +1,5 @@
use <../__comm__/_str_hash.scad>;
use <../util/some.scad>;
use <../../__comm__/_str_hash.scad>;
use <../some.scad>;
function hashset_has(set, elem, eq = function(e1, e2) e1 == e2, hash = function(e) _str_hash(e)) =
some(set[hash(elem) % len(set)], function(e) eq(e, elem));

View File

@@ -1,4 +1,4 @@
use <../util/sum.scad>;
use <../sum.scad>;
function hashset_len(set) = sum([
for(bucket = set)

View File

@@ -72,6 +72,8 @@ include <util/test_dedup.scad>;
include <util/test_zip.scad>;
include <util/test_some.scad>;
include <util/test_every.scad>;
include <util/set/test_hashset.scad>;
include <util/map/test_hashmap.scad>;
// Voxel
include <voxel/test_vx_line.scad>;
@@ -81,6 +83,3 @@ include <voxel/test_vx_cylinder.scad>;
include <voxel/test_vx_sphere.scad>;
include <voxel/test_vx_polygon.scad>;
// Collection
include <collection/test_hashset.scad>;
include <collection/test_hashmap.scad>;

View File

@@ -1,9 +1,9 @@
use <collection/hashmap.scad>;
use <collection/hashmap_list.scad>;
use <collection/hashmap_put.scad>;
use <collection/hashmap_len.scad>;
use <collection/hashmap_del.scad>;
use <collection/hashmap_get.scad>;
use <util/map/hashmap.scad>;
use <util/map/hashmap_list.scad>;
use <util/map/hashmap_put.scad>;
use <util/map/hashmap_len.scad>;
use <util/map/hashmap_del.scad>;
use <util/map/hashmap_get.scad>;
module test_hashmap() {
echo("==== test_hashmap ====");

View File

@@ -1,9 +1,9 @@
use <collection/hashset.scad>;
use <collection/hashset_list.scad>;
use <collection/hashset_add.scad>;
use <collection/hashset_del.scad>;
use <collection/hashset_has.scad>;
use <collection/hashset_len.scad>;
use <util/set/hashset.scad>;
use <util/set/hashset_list.scad>;
use <util/set/hashset_add.scad>;
use <util/set/hashset_del.scad>;
use <util/set/hashset_has.scad>;
use <util/set/hashset_len.scad>;
module test_hashset() {
echo("==== test_hashset ====");