added version numbers into the catears model
This commit is contained in:
parent
8c0588eaf5
commit
df7c90ec26
5 changed files with 66675 additions and 3 deletions
31
scad/base/binary.scad
Normal file
31
scad/base/binary.scad
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
module lcyl(size, depth){
|
||||
translate([size/2,depth/2,size/2])
|
||||
rotate([90,0,0])
|
||||
cylinder(h = depth, d = size, center = true, $fn = 32);
|
||||
}
|
||||
|
||||
module binary(n, size, depth = size, sep = size/2){
|
||||
cube([sep,depth,size]);
|
||||
translate([0,0,-size/4])
|
||||
lcyl(size = sep, depth = depth);
|
||||
translate([0,0,3*size/4])
|
||||
lcyl(size = sep, depth = depth);
|
||||
translate([2*sep,0,0])
|
||||
binary_rec(n = n, size = size, depth = depth, sep = sep);
|
||||
}
|
||||
|
||||
module binary_rec(n, size, depth, sep){
|
||||
if(n != 0){
|
||||
if(n % 2 == 0){
|
||||
translate([size+sep,0,0])
|
||||
binary_rec(n = n/2, size = size, depth = depth, sep = sep);
|
||||
}
|
||||
else{
|
||||
lcyl(size = size, depth = depth);
|
||||
translate([size+sep,0,0])
|
||||
binary_rec(n = (n-1)/2, size = size, depth = depth, sep = sep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binary(n = 23, size = 2, depth = 2, sep = 1);
|
||||
Loading…
Add table
Add a link
Reference in a new issue