Browse Source

add licences and add option for 2 clusters (thumb and fingers)

main
phschoen 2 years ago
parent
commit
a44e0bb016
  1. 50
      config.scad
  2. 12
      constant.scad
  3. 12
      keycap_gen.scad
  4. 12
      keycap_stl.scad
  5. 11
      keycaps.scad
  6. 1
      kinessis.scad
  7. 105
      main.scad
  8. 10
      matlab/calc_angle_switch.m
  9. 9
      matlab/calc_finger_pos.m
  10. 9
      matlab/euklid_dist.m
  11. 9
      matlab/find_next_switch_pos.m
  12. 9
      matlab/local_minimas.m
  13. 9
      matlab/start.m
  14. 9
      matlab/test.m
  15. 11
      pcb/amoeba-royale.scad
  16. 11
      pcb/pmw3360_sensor.scad
  17. 11
      pcb/rp2040.scad
  18. 11
      switch.scad
  19. 11
      switch_cutout.scad
  20. 11
      switch_holder.scad
  21. 299
      switch_holder_plate.scad
  22. 1
      trackball/trackball.scad

50
config.scad

@ -1,42 +1,54 @@
switch_t=[
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
switch_finger_t=[
// colum 3
[ [0,70,50], [37,60,20] ],
[ [0,70,50], [30 ,60,20] , [50, 60, 20] , [70, 60,20] , [95, 60,20] ],
// colum 2
[ [0,40,40], [32,40,10] ],
[ [0,40,40], [30 ,40,10] , [50, 40, 10] , [70, 40,10] , [95, 40,10] ],
// colum 2
[ [0,20,25], [28.5, 20, 5] ],
[ [0,20,25], [28.5,20, 5] , [50, 20, 5] , [70, 20, 5] , [95, 20, 5] ],
// colum 1
[ [0, 0,15], [25,0,0] ]
[ [0, 0,15], [25 ,0 ,0 ] , [50, 0, 0] , [70, 0, 0] , [95, 0, 0] ]
];
switch_r=[
switch_finger_r=[
// row 3
[ [0,0,0], [0,0,-10] ],
[ [0,0,0], [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] ],
// row 2
[ [0,0,0], [20,0,-10] ],
[ [0,0,0], [20,0,-10] , [20,0,-10] , [20,0,-10] , [20,0,-10] , [20,0,-10] ],
// row 2
[ [0,0,0], [10,0,-10] ],
[ [0,0,0], [10,0,-10] , [10,0,-10] , [10,0,-10] , [10,0,-10] , [10,0,-10] ],
// row 1
[ [0,0,0], [0,0,-10] ]
[ [0,0,0], [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] , [0,0,-10] ]
];
switch_thumb_t=[
// colum 2
[ [0,70,50], [37,60,20] , [37,60,20] ],
[ [-35,-45,15], [-9,-30,15] , [30,-30,15] ],
// colum 1
[ [0,40,40], [32,40,10], [32,40,10] ],
[ [-25,-70,10], [0,-50,10], [30,-50,10] ],
];
switch_thumb__r=[
[ [0,0,0], [10,0,-10] , [10,0,-10] ],
switch_thumb_r=[
[ [0,0,30], [10,0,20] , [10,0,10] ],
// row 1
[ [0,0,0], [10,0,-10] , [0,0,-10] ]
[ [0,0,30], [10,0,20] , [0,0,10] ]
];
switch_keycap=[
[["mt3", 1], ["SA", 1], ],
[["mt3", 1], ["SA", 1], ],
[["mt3", 1], ["SA", 1], ],
[["mt3", 1], ["SA", 1], ],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
[["mt3", 1], ["SA", 1], ["SA", 1],["SA", 1],["SA", 1],],
];
// the trackball diameter itself

12
constant.scad

@ -1,3 +1,15 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
$c=0.1;
$fn=60;
$e=0.01;

12
keycap_gen.scad

@ -1,3 +1,15 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
// the point of this file is to be a sort of DSL for constructing keycaps.
// when you create a method chain you are just changing the parameters
// key.scad uses, it doesn't generate anything itself until the end. This

12
keycap_stl.scad

@ -1,3 +1,15 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
module keycap(type="sa",row=1)
{
if(type == "sa" || type == "SA" ) {

11
keycaps.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
/* [Key] */
//length in units of key

1
kinessis.scad

@ -1,6 +1,5 @@
// tip dip pip mcp
finger_h = 0.1*[
[ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ], [ 10, 15, 18, 28 ]];

105
main.scad

@ -1,86 +1,19 @@
use <switch.scad>;
// rows
finger_colums=[-1,0,1,2,3,4];
finger_rows = [
4, // -1
4, // 0
4, // 1
4, // 2
4, // 3
4, // 3
];
angle_switch_x=[
[-10,0,10,20,30], // -1
[-10,0,10,20,30], // 0
[-10,0,10,20,30], // 1
[-10,0,10,20,30], // 2
[-10,0,10,20,30], // 3
[-10,0,10,20,30], // 4
];
offset_switch_y=[
[0,0,0,0,0], // -1
[0,0,0,0,0], // 0
[0,0,0,0,0], // 1
[0,0,0,0,0], // 2
[0,0,0,0,0], // 3
[0,0,0,0,0], // 4
];
offset_switch_z=[
[0,0,0,0,0], // -1
[0,0,0,0,0], // 0
[0,0,0,0,0], // 1
[0,0,0,0,0], // 2
[0,0,0,0,0], // 3
[0,0,0,0,0], // 4
];
angle_switch_y=[
[0,0,0,0,0], // -1
[0,0,0,0,0], // 0
[0,0,0,0,0], // 1
[0,0,0,0,0], // 2
[0,0,0,0,0], // 3
[0,0,0,0,0], // 4
];
keycaps_row=[
[3,4,3,2,1,1], // -1
[3,4,3,2,1,1], // 0
[3,4,3,2,1,1], // 1
[3,4,3,2,1,1], // 2
[3,4,3,2,1,1], // 3
[3,4,3,2,1,1], // 4
];
row_offset=[
-15.1, -13.1, -13.15, -13.1
];
//for(idx_x=[1:len(finger_colums)]) {
for(idx_x=[0:len(finger_colums)-1]) {
for(idx_y=[0:finger_rows[idx_x]-1]) {
// first try
finger_offset=19.0;
//translate([finger_offset*finger_colums[idx_x],finger_offset*idx_y,0])
//rotate([angle_switch_x[idx_x][idx_y],angle_switch_y[idx_x][idx_y],0])
// switch($t=$t, travel_max = 4, kap_type="sa", kap_row = keycaps_row[idx_x][idx_y]);
// second try
// translate([0,0,42]) // lower by radius of keycaps
// rotate([20*(idx_y-2),0,0])
// translate([0,0,-42]) // lower by radius of keycaps
// translate([0,0,row_offset[keycaps_row[idx_x][idx_y]-1]]) // bring keycaps in heigth
// switch($t=$t, travel_max = 4, kap_type="sa", kap_row = keycaps_row[idx_x][idx_y]);
// third try
// cos alpha = b/c
translate([0,offset_switch_y[idx_x][idx_y],offset_switch_z[idx_x][idx_y]])
rotate([angle_switch_x[idx_x][idx_y],angle_switch_y[idx_x][idx_y],0])
translate([0,0,row_offset[keycaps_row[idx_x][idx_y]-1]]) // bring keycaps in heigth
switch($t=$t, travel_max = 4, kap_type="sa", kap_row = keycaps_row[idx_x][idx_y]);
}
}
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
use <switch_holder_plate.scad>;
include <config.scad>;
include <constant.scad>;
switch_holder_plate(switch_finger_r, switch_finger_t,10);
switch_holder_plate(switch_thumb_r, switch_thumb_t, 10);

10
matlab/calc_angle_switch.m

@ -1,3 +1,13 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
function [angle_1,angle_2] = calc_angle_switch(idx,range,X,Y,Z)
angle_1 = 0;
angle_2 = 0;

9
matlab/calc_finger_pos.m

@ -1,3 +1,12 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
function [org] = calc_finger_pos(angles,trans,translate)
{
org = [0,0,0];

9
matlab/euklid_dist.m

@ -1,3 +1,12 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
function dist=euklid_dist(a,b)
v=abs(a-b);
dist = sqrt(sum(v.*v));

9
matlab/find_next_switch_pos.m

@ -1,3 +1,12 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
function [p1,m1] = find_next_switch_pos(start_pos,X,Y,Z,switch_offset)
D = [];
for i = [1:length(X)]

9
matlab/local_minimas.m

@ -1,3 +1,12 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
function minis = local_minimas( D )
minis = []
for i = [1:length(D)-2]

9
matlab/start.m

@ -1,3 +1,12 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
clearvars
clear
close all

9
matlab/test.m

@ -1,3 +1,12 @@
#
# Copyright 2022 Philipp Schönberger - mail@phschoen.de
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/>.
xf = [0:0.05:10];
yf = sin (2*pi*xf/5);
xp = [0:10];

11
pcb/amoeba-royale.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
amoeba_royale_pcb();
module amoeba_royale_pcb(color_pcb="green") {
color(color_pcb)

11
pcb/pmw3360_sensor.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
include <../config.scad>
include <../constant.scad>

11
pcb/rp2040.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
include <../config.scad>
include <../constant.scad>

11
switch.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
include <constant.scad>
include <config.scad>

11
switch_cutout.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
include<constant.scad>;
include<config.scad>;
use<pcb/amoeba-royale.scad>;

11
switch_holder.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
use <switch.scad>;
use <switch_cutout.scad>;
use <pcb/amoeba-royale.scad>;

299
switch_holder_plate.scad

@ -1,3 +1,14 @@
/*
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See <http://www.gnu.org/licenses/>.
*/
include <config.scad>;
include <constant.scad>;
@ -6,215 +17,239 @@ use <switch_holder.scad>;
use <switch.scad>;
use <pcb/amoeba-royale.scad>;
for(c=[0:len(switch_r[0])-1],r=[0:len(switch_r)-1]) {
function switch_rc_point(switch_r,switch_t, row,colum,a,h,offset=[0,0,0]) = v_rot(switch_r[row][colum]) * (switch_point(a,h) + offset) + switch_t[row][colum];
echo("switches c",c,"d",r);
translate(switch_t[r][c])
rotate(switch_r[r][c]) {
if($show_switches == true)
switch(0, $show_keycaps ? switch_keycap[r][c][0]: "none", switch_keycap[r][c][1] );
if($show_switch_pcb == true)
translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c])
amoeba_royale_pcb();
switch_holder_with_cutouts(type="B");
}
}
function switch_rc_point(row,colum,a,h,offset=[0,0,0]) = v_rot(switch_r[row][colum]) * (switch_point(a,h) + offset) + switch_t[row][colum];
function switch_bz(row,colum,a,h,offset=[0,-10,0]) = [
function switch_bz(switch_r,switch_t, row,colum,a,h,offset=[0,-10,0]) = [
[
switch_rc_point(row,colum,a[0],h,[0,0,0]),
switch_rc_point(row,colum,a[1],h,[0,0,0]),
switch_rc_point(switch_r,switch_t, row,colum,a[0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t, row,colum,a[1],h,[0,0,0]),
],
[
switch_rc_point(row,colum,a[0],h,offset),
switch_rc_point(row,colum,a[1],h,offset),
switch_rc_point(switch_r,switch_t, row,colum,a[0],h,offset),
switch_rc_point(switch_r,switch_t, row,colum,a[1],h,offset),
],
[
zero_axis("z", switch_rc_point(row,colum,a[0],h,offset), -20),
zero_axis("z", switch_rc_point(row,colum,a[1],h,offset), -20)
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a[0],h,offset), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a[1],h,offset), -20)
],
];
function switch_bz_edge(row,colum,a,h,offset1=[0,-10,0],offset2=[0,-10,0]) = [
function switch_bz_edge(switch_r,switch_t, row,colum,a,h,offset1=[0,-10,0],offset2=[0,-10,0]) = [
[
switch_rc_point(row,colum,a,h,$e*offset1),
switch_rc_point(row,colum,a,h, 0*offset1),
switch_rc_point(row,colum,a,h,$e*offset2),
switch_rc_point(switch_r,switch_t, row,colum,a,h,$e*offset1),
switch_rc_point(switch_r,switch_t, row,colum,a,h, 0*offset1),
switch_rc_point(switch_r,switch_t, row,colum,a,h,$e*offset2),
],
[
switch_rc_point(row,colum,a,h,offset1),
switch_rc_point(row,colum,a,h,offset1+offset2),
switch_rc_point(row,colum,a,h,offset2),
switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1),
switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1+offset2),
switch_rc_point(switch_r,switch_t, row,colum,a,h,offset2),
],
[
zero_axis("z", switch_rc_point(row,colum,a,h,offset1), -20),
zero_axis("z", switch_rc_point(row,colum,a,h,offset1+offset2), -20),
zero_axis("z", switch_rc_point(row,colum,a,h,offset2), -20)
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a,h,offset1+offset2), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t, row,colum,a,h,offset2), -20)
],
];
function switch_bz_offset(a)= (
(a == "N" ) ? [ 10, 0, 0] :
(a == "S" ) ? [-10, 0, 0] :
(a == "O" ) ? [ 0, 10, 0] :
(a == "W" ) ? [ 0,-10, 0] :
undef
);
function switch_bz_between(rows,colums,a,h,offset_bz=[2,0,0],offset_out=[0,-10,0]) = [
function switch_bz_between(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0],offset_out=[0,-10,0]) = [
[
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]),
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_bz),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]),
],
[
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_out),
switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz+offset_out),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_out),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz+offset_out),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out),
],
[
zero_axis("z", switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0],h,[0,0,0]+offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]-offset_bz+offset_out), -20),
zero_axis("z", switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1],h,[0,0,0]+offset_out), -20),
],
];
function switch_bz_connection(rows,colums,a,h,offset_bz=[2,0,0]) = [
function switch_bz_connection(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [
[
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz),
switch_rc_point(rows[0],colums[0],a[0][1],h,[0,0,0]-$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]-$e*offset_bz),
],
[
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(rows[0],colums[0],a[0][1],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]),
],
[
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz),
switch_rc_point(rows[0],colums[0],a[0][1],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][1],h,[0,0,0]+offset_bz),
],
[
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]-offset_bz),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]-offset_bz),
],
[
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]),
],
[
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]+$e*offset_bz),
switch_rc_point(rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]+$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][0],h,[0,0,0]+$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[len(rows) == 1 ? 0 : 1],colums[len(colums) == 1 ? 0 : 1],a[1][1],h,[0,0,0]+$e*offset_bz),
],
];
function switch_bz_connection_cross(rows,colums,a,h,offset_bz=[2,0,0]) = [
function switch_bz_connection_cross(switch_r,switch_t,rows,colums,a,h,offset_bz=[2,0,0]) = [
[
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz),
switch_rc_point(rows[1],colums[0],a[0][1],h,[0,0,0]-$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]-$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]-$e*offset_bz),
],
[
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(rows[1],colums[0],a[0][1],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]),
],
[
switch_rc_point(rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz),
switch_rc_point(rows[1],colums[0],a[0][1],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[0],a[0][0],h,[0,0,0]+offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[0],a[0][1],h,[0,0,0]+offset_bz),
],
[
switch_rc_point(rows[0],colums[1],a[1][0],h,[0,0,0]-offset_bz),
switch_rc_point(rows[1],colums[1],a[1][1],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]-offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]-offset_bz),
],
[
switch_rc_point(rows[0],colums[1],a[1][0],h,[0,0,0]),
switch_rc_point(rows[1],colums[1],a[1][1],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]),
],
[
switch_rc_point(rows[0],colums[1],a[1][0],h,[0,0,0]+$e*offset_bz),
switch_rc_point(rows[1],colums[1],a[1][1],h,[0,0,0]+$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[0],colums[1],a[1][0],h,[0,0,0]+$e*offset_bz),
switch_rc_point(switch_r,switch_t,rows[1],colums[1],a[1][1],h,[0,0,0]+$e*offset_bz),
],
];
function reverse_bz(points) = [for(i = [len(points)-1:-1:0]) points[i], ];
function switch_bz_all_w(colum,a,h,offset=[0,-10,0]) = [for (r=[0:3]) switch_bz(row, colum, a, h, offset),];
switch_holder_plate(switch_thumb_r, switch_thumb_t, 10);
module switch_holder_plate(switch_r, switch_t, w_extra)
{
t_step = 0.1;
thickness = switch_holder_height+1;
ctrl_pts_S = [
// S curve
switch_bz(3,0,["SW","SO"],"top",[0,-10,0]),
switch_bz(3,1,["SW","SO"],"top",[0,-10,0]),
switch_bz_between([3], [0,1],["SO","SW"],"top",[1,0,0],[0,-10,0]),
ctrl_pts_S = [
for(r=len(switch_r)-1, c=[0:len(switch_r[r])-1])
switch_bz(switch_r,switch_t,r,c,["SW","SO"],"top",[0,-w_extra,0]),
];
echo("ctrl_pts_S", ctrl_pts_S);
// between the s curves
ctrl_pts_S_B = [
for(r=len(switch_r)-1, c=[0:len(switch_r[r])-2])
switch_bz_between(switch_r,switch_t,[r], [c,c+1],["SO","SW"],"top",[1,0,0],[0,-w_extra,0]),
];
ctrl_pts_N = [
// N curve
switch_bz(0,0,["NO","NW"],"top",[0,10,0]),
switch_bz(0,1,["NO","NW"],"top",[0,10,0]),
switch_bz_between([0], [1,0],["NW","NO"],"top",[-1,0,0],[0,+10,0]),
for(r=0, c=[0:len(switch_r[r])-1])
switch_bz(switch_r,switch_t,r,c,["NO","NW"],"top",[0,w_extra,0]),
];
ctrl_pts_N_B = [
for(r=0, c=[0:len(switch_r[r])-2])
switch_bz_between(switch_r,switch_t,[r], [c+1,c],["NW","NO"],"top",[-1,0,0],[0,+w_extra,0]),
];
// within OW
switch_bz_connection([0], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]),
switch_bz_connection([1], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]),
switch_bz_connection([2], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]),
switch_bz_connection([3], [1,0],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]),
// W curve
ctrl_pts_W = [
for(r=[0:len(switch_r)-1], c=0)
switch_bz(switch_r,switch_t,r,c,["NW","SW"],"top",[-w_extra,0,0]),
];
// within NS
switch_bz_connection([0,1], [0],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
switch_bz_connection([1,2], [0],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
switch_bz_connection([2,3], [0],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
switch_bz_connection([0,1], [1],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
switch_bz_connection([1,2], [1],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
switch_bz_connection([2,3], [1],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
ctrl_pts_W_B = [
for(r=[0:len(switch_r)-2], c=0)
switch_bz_between(switch_r,switch_t,[r,r+1], [c],["SW","NW"],"top",[1,0,0],[-w_extra,0,0]),
];
switch_bz_connection_cross([1,0], [0,1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]),
switch_bz_connection_cross([2,1], [0,1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]),
switch_bz_connection_cross([3,2], [0,1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]),
// O curve
ctrl_pts_O = [
for(r=[0:len(switch_r)-1], c=len(switch_r[r])-1)
switch_bz(switch_r,switch_t,r,c,["SO","NO"],"top",[+w_extra,0,0]),
];
// W curve
switch_bz(0,0,["NW","SW"],"top",[-10,0,0]),
switch_bz(1,0,["NW","SW"],"top",[-10,0,0]),
switch_bz(2,0,["NW","SW"],"top",[-10,0,0]),
switch_bz(3,0,["NW","SW"],"top",[-10,0,0]),
switch_bz_between([0,1], [0],["SW","NW"],"top",[1,0,0],[-10,0,0]),
switch_bz_between([1,2], [0],["SW","NW"],"top",[1,0,0],[-10,0,0]),
switch_bz_between([2,3], [0],["SW","NW"],"top",[1,0,0],[-10,0,0]),
switch_bz_between([1,0], [1],["NO","SO"],"top",[1,0,0],[10,0,0]),
switch_bz_between([2,1], [1],["NO","SO"],"top",[1,0,0],[10,0,0]),
switch_bz_between([3,2], [1],["NO","SO"],"top",[1,0,0],[10,0,0]),
ctrl_pts_O_B = [
for(r=[0:len(switch_r)-2], c=len(switch_r[r])-1)
switch_bz_between(switch_r,switch_t,[r+1,r], [c],["NO","SO"],"top",[1,0,0],[w_extra,0,0]),
];
// O curve
switch_bz(0,1,["SO","NO"],"top",[+10,0,0]),
switch_bz(1,1,["SO","NO"],"top",[+10,0,0]),
switch_bz(2,1,["SO","NO"],"top",[+10,0,0]),
switch_bz(3,1,["SO","NO"],"top",[+10,0,0]),
// edge
switch_bz_edge(3,0,"SW","top",[-10,0,0],[0,-10,0]),
reverse_bz(switch_bz_edge(3,1,"SO","top",[ 10,0,0],[0,-10,0])),
reverse_bz(switch_bz_edge(0,0,"NW","top",[-10,0,0],[0, 10,0])),
switch_bz_edge(0,1,"NO","top",[ 10,0,0],[0, 10,0]),
ctrl_pts_E = [
switch_bz_edge(switch_r,switch_t,len(switch_r)-1,0,"SW","top",[-w_extra,0,0],[0,-w_extra,0]),
switch_bz_edge(switch_r,switch_t,0,len(switch_r[0])-1,"NO","top",[ w_extra,0,0],[0, w_extra,0]),
reverse_bz(switch_bz_edge(switch_r,switch_t,len(switch_r)-1,len(switch_r[0])-1,"SO","top",[ w_extra,0,0],[0,-w_extra,0])),
reverse_bz(switch_bz_edge(switch_r,switch_t,0,0,"NW","top",[-w_extra,0,0],[0, w_extra,0])),
];
ctrl_pts_NS_IN = [
// within OW
for(r=[0:len(switch_r)-1], c=[0:len(switch_r[r])-2])
switch_bz_connection(switch_r,switch_t,[r], [c+1,c],[ ["NW", "SW"],["NO", "SO"] ],"top",[-1,0,0]),
];
ctrl_pts_OW_IN = [
// within NS
for(r=[0:len(switch_r)-2], c=[0:len(switch_r[r])-1])
switch_bz_connection(switch_r,switch_t,[r,r+1], [c],[ ["SW", "SO"],["NW", "NO"] ],"top",[0,-1,0]),
];
for(k=[0:len(ctrl_pts_S)-1]) {
g_S = bezier_surface(t_step, ctrl_pts_S[k]);
// g_S = sf_splines(t_step, ctrl_pts_S);
ctrl_pts_CROSS_IN = [
for(r=[0:len(switch_r)-2], c=[0:len(switch_r[r])-2])
switch_bz_connection_cross(switch_r,switch_t,[r+1,r], [c,c+1],[ [ "NO", "SO"],["NW", "SW"] ],"top",[1,0,0]),
];
ctrl_pts = [
ctrl_pts_S ,
ctrl_pts_S_B,
ctrl_pts_N_B , ctrl_pts_N,
ctrl_pts_W_B , ctrl_pts_W,
ctrl_pts_O_B , ctrl_pts_O,
ctrl_pts_E,
ctrl_pts_OW_IN,
ctrl_pts_NS_IN,
ctrl_pts_CROSS_IN,
];
for(r=[0:len(switch_r)-1], c=[0:len(switch_r[r])-1])
translate(switch_t[r][c])
rotate(switch_r[r][c]) {
if($show_switches == true)
switch(0, $show_keycaps ? switch_keycap[r][c][0]: "none", switch_keycap[r][c][1] );
if($show_switch_pcb == true)
translate([0,0,-switch_holder_height-amoeba_royale_pcb_h-$c])
amoeba_royale_pcb();
switch_holder_with_cutouts(type="B");
}
for(j=[0:len(ctrl_pts)-1]) {
for(k=[0:len(ctrl_pts[j])-1]) {
g_S = bezier_surface(t_step, ctrl_pts[j][k]);
// g_S = sf_splines(t_step, ctrl_pts[j][k]);
sf_thicken(g_S, thickness,"FORWARD");
//function_grapher(g_S,thickness,"FORWARD");
}
}
// draw bezier_points
color("black")
for(k=[0:len(ctrl_pts_S)-1])
for(i=[0:len(ctrl_pts_S[k])-1])
for(j=[0:len(ctrl_pts_S[k][i])-1])
translate(ctrl_pts_S[k][i][j])
for(k=[0:len(ctrl_pts)-1])
for(i=[0:len(ctrl_pts[k])-1])
for(j=[0:len(ctrl_pts[k][i])-1])
translate(ctrl_pts[k][i][j])
{
%sphere(d=0.5);
}
}

1
trackball/trackball.scad

@ -1,6 +1,7 @@
/*
* Trackball
* Copyright 2022 Thomas Buck - thomas@xythobuz.de
* Philipp Schönberger - mail@phschoen.de
*
* Required parts:
* - 1x Raspberry Pi Pico

Loading…
Cancel
Save