1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00

refactored

This commit is contained in:
Justin Lin 2017-05-24 10:04:15 +08:00
parent cccba1515b
commit f511c281a5
2 changed files with 22 additions and 21 deletions

View File

@ -0,0 +1,20 @@
function __polytransversals(transversals) =
let(
leng_trs = len(transversals),
leng_tr = len(transversals[0]),
lefts = [
for(i = [1:leng_trs - 2])
let(tr = transversals[leng_trs - i])
tr[0]
],
rights = [
for(i = [1:leng_trs - 2])
let(tr = transversals[i])
tr[leng_tr - 1]
]
) concat(
transversals[0],
rights,
__reverse(transversals[leng_trs - 1]),
lefts
);

View File

@ -12,29 +12,10 @@
**/
include <__private__/__reverse.scad>;
include <__private__/__polytransversals.scad>;
module polytransversals(transversals) {
leng_trs = len(transversals);
leng_tr = len(transversals[0]);
lefts = [
for(i = [1:leng_trs - 2])
let(tr = transversals[leng_trs - i])
tr[0]
];
rights = [
for(i = [1:leng_trs - 2])
let(tr = transversals[i])
tr[leng_tr - 1]
];
polygon(
concat(
transversals[0],
rights,
__reverse(transversals[leng_trs - 1]),
lefts
)
__polytransversals(transversals)
);
}