Initial release

This commit is contained in:
Kujiu 2021-10-15 00:52:01 +02:00
parent 910450e249
commit 851d30f036
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
5 changed files with 149 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.*.swp

44
black_stone.scad Normal file
View file

@ -0,0 +1,44 @@
include <params.scad>
use <white_stone.scad>
module bstone() {
difference() {
wstone();
rotate([90, 0, 0]) linear_extrude(center=true, height=$stone_radius*2) {
polygon([
[-$stone_radius/7, 0],
[$stone_radius/7, 0],
[0, $stone_height*1.5/5]
]);
polygon([
[-$stone_radius*4/7, 0],
[-$stone_radius*2/7, 0],
[-$stone_radius*3/7, $stone_height*1.5/5]
]);
polygon([
[$stone_radius*4/7, 0],
[$stone_radius*2/7, 0],
[$stone_radius*3/7, $stone_height*1.5/5]
]);
}
rotate([90, 0, 90]) linear_extrude(center=true, height=$stone_radius*2) {
polygon([
[-$stone_radius/7, $stone_height],
[$stone_radius/7, $stone_height],
[0, $stone_height*3.5/5]
]);
polygon([
[-$stone_radius*4/7, $stone_height],
[-$stone_radius*2/7, $stone_height],
[-$stone_radius*3/7, $stone_height*3.5/5]
]);
polygon([
[$stone_radius*4/7, $stone_height],
[$stone_radius*2/7, $stone_height],
[$stone_radius*3/7, $stone_height*3.5/5]
]);
}
}
}
bstone();

61
goban.scad Normal file
View file

@ -0,0 +1,61 @@
include <params.scad>
module goban() {
$goban_width = $cell_width*($goban_size-1) +
$goban_size*$line_width +
$goban_padding*2;
$goban_length = $cell_length*($goban_size-1) +
$goban_size*$line_width +
$goban_padding*2;
difference() {
cube([$goban_width, $goban_length, $goban_height]);
for(n=[0:$goban_size-1]) {
translate([
$goban_padding,
$goban_padding + n*($cell_length+$line_width),
$goban_height - $line_depth])
cube([
$goban_size*($line_width+$cell_width)-$cell_length,
$line_width,
$line_depth+1
]);
translate([
$goban_padding + n*($cell_width+$line_width),
$goban_padding,
$goban_height - $line_depth])
cube([
$line_width,
$goban_size*($line_width+$cell_length)-$cell_length,
$line_depth+1
]);
for(y=[0:$goban_size-1]) {
translate([
$goban_padding + n*($cell_width+$line_width),
$goban_padding + y*($cell_length+$line_width),
-1
]) union() {
translate([0, 0, 1 + $goban_height - $stone_height*0.60])
cylinder(
h=$stone_height*0.60+1,
r=$stone_radius+$stone_clearance,
$fn=200);
if(search(n+1, $hoshi_pos) && search(y+1, $hoshi_pos)) {
cylinder(
h=$goban_height+1,
r=$hoshi_radius,
$fn=200);
} else {
cylinder(
h=$goban_height+1,
r=$goban_hole_radius,
$fn=200);
}
}
}
}
}
}
goban();

13
params.scad Normal file
View file

@ -0,0 +1,13 @@
$stone_height = 10;
$stone_radius = 10;
$stone_clearance = 0.75;
$hoshi_radius = 3;
$goban_hole_radius = 1;
$goban_height = 18;
$line_depth = 2;
$cell_width = 22;
$cell_length = 23.7;
$goban_padding = 25;
$line_width = 1;
$goban_size = 19;
$hoshi_pos = [4, 10, 16]; // [4, 10, 16] for 19x19, [4, 7, 10] for 13x13

30
white_stone.scad Normal file
View file

@ -0,0 +1,30 @@
include <params.scad>
module wstone() {
union() {
x1 = $stone_radius;
y1 = $stone_height*2/5;
x2 = 0;
y2 = 0;
x3 = -$stone_radius;
y3 = $stone_height*2/5;
xc = ((pow(x3, 2)-pow(x2, 2)+pow(y3, 2)-pow(y2, 2))/(2*(y3-y2))-(pow(x2, 2)-pow(x1, 2)+pow(y2, 2)-pow(y1, 2))/(2*(y2-y1)))/((x3-x2)/(y3-y2)-(x2-x1)/(y2-y1));
yc = -(x2-x1)/(y2-y1)*xc+(pow(x2, 2)-pow(x1, 2)+pow(y2, 2)-pow(y1, 2))/(2*(y2-y1));
r = sqrt(pow(x1-xc, 2)+pow(y1-yc, 2));
difference() {
translate([0, 0, r]) sphere(r=r, $fn=200);
translate([-r-1, -r-1, $stone_height*2/5])
cube([r*2+2, r*2+2, r*2+2]);
}
translate([0, 0, $stone_height*2/5])
cylinder(h=2, r=$stone_radius, $fn=200);
translate([0, 0, $stone_height*3/5]) difference() {
translate([0, 0, -r+$stone_height*2/5]) sphere(r=r, $fn=200);
translate([-r-1, -r-1, -r*2-2])
cube([r*2+2, r*2+2, r*2+2]);
}
}
}
wstone();