mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-29 11:58:39 +01:00
refactored
This commit is contained in:
parent
d5f27902ed
commit
4edd189db7
@ -24,6 +24,17 @@ module hexagons(radius, spacing, levels) {
|
||||
circle(r_hexagon, $fn = 6);
|
||||
}
|
||||
|
||||
function hexagons_pts(hex_datum) =
|
||||
let(
|
||||
tx = hex_datum[0][0],
|
||||
ty = hex_datum[0][1],
|
||||
n = hex_datum[1],
|
||||
offset_xs = [for(i = [0:n - 1]) i * offset_step + center_offset]
|
||||
)
|
||||
[
|
||||
for(x = offset_xs) [x + tx, ty, 0]
|
||||
];
|
||||
|
||||
module line_hexagons(hex_datum) {
|
||||
tx = hex_datum[0][0];
|
||||
ty = hex_datum[0][1];
|
||||
@ -34,9 +45,6 @@ module hexagons(radius, spacing, levels) {
|
||||
p = [x + tx, ty, 0];
|
||||
translate(p)
|
||||
hexagon();
|
||||
|
||||
// hook for testing
|
||||
test_each_hexagon(r_hexagon, p);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,11 +71,17 @@ module hexagons(radius, spacing, levels) {
|
||||
);
|
||||
|
||||
for(hex_datum = total_hex_data) {
|
||||
line_hexagons(hex_datum);
|
||||
pts = hexagons_pts(hex_datum);
|
||||
for(pt = pts) {
|
||||
translate(pt)
|
||||
hexagon();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// override it to test
|
||||
module test_each_hexagon(hex_r, pt) {
|
||||
module test_each_hexagon(hex_r, pts) {
|
||||
|
||||
}
|
@ -29,7 +29,7 @@ function shift_to_int(point, digits) =
|
||||
[round(pt[0]), round(pt[1])] :
|
||||
[round(pt[0]), round(pt[1]), round(pt[2])];
|
||||
|
||||
function all_shift_to_int(points, digits) =
|
||||
function round_pts(points, digits) =
|
||||
[for(pt = points) shift_to_int(pt, digits) / digits];
|
||||
|
||||
module assertEqualPoint(expected, actual) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user