author | Michael Krelin <hacker@klever.net> | 2016-01-08 22:11:51 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2016-01-08 22:11:51 (UTC) |
commit | 59a7256a88fecb14ee79f47d49abdc34df665b81 (patch) (unidiff) | |
tree | 2e1f25ddd7026d1970f8fa7064d6e6d7e5c7341b | |
parent | 9ef193aea9128ec113cfbec7f7eca7e6e51be5be (diff) | |
download | redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.zip redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.tar.gz redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.tar.bz2 |
duetholder math
-rw-r--r-- | delta.jscad | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad index 4716875..a1be156 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -96,48 +96,58 @@ var CONFIG = { | |||
96 | color: { | 96 | color: { |
97 | extrusion: [0.8, 0.8, 0.8, 0.8], | 97 | extrusion: [0.8, 0.8, 0.8, 0.8], |
98 | pcb: [ 0, 0.3, 0.2, 0.8 ], | 98 | pcb: [ 0, 0.3, 0.2, 0.8 ], |
99 | bulk: [ .9, .9, .9, .2 ], | 99 | bulk: [ .9, .9, .9, .2 ], |
100 | parts: [ 0, 0.8, 0, 0.9 ], | 100 | parts: [ 0, 0.8, 0, 0.9 ], |
101 | softparts: [ 0, 0, 0.8, 0.9 ] | 101 | softparts: [ 0, 0, 0.8, 0.9 ] |
102 | } | 102 | } |
103 | }; | 103 | }; |
104 | 104 | ||
105 | var CD = { | 105 | var CD = { |
106 | base: (function(){ | 106 | base: (function(){ |
107 | var rv = {}; | 107 | var rv = {}; |
108 | rv.circumscription_r = | 108 | rv.circumscription_r = |
109 | CONFIG.base.sl/2/Math.cos(Math.PI/6); | 109 | CONFIG.base.sl/2/Math.cos(Math.PI/6); |
110 | rv.outer_inscription_r = | 110 | rv.outer_inscription_r = |
111 | Math.sqrt(Math.pow(rv.circumscription_r,2)- | 111 | Math.sqrt(Math.pow(rv.circumscription_r,2)- |
112 | Math.pow(CONFIG.base.sl/2,2)); | 112 | Math.pow(CONFIG.base.sl/2,2)); |
113 | rv.mid_inscription_r = | 113 | rv.mid_inscription_r = |
114 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | 114 | rv.outer_inscription_r-CONFIG.extrusion.w/2; |
115 | rv.inner_inscription_r = | 115 | rv.inner_inscription_r = |
116 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | 116 | rv.outer_inscription_r-CONFIG.extrusion.w/2; |
117 | // TODO: properly calculate | 117 | // TODO: properly calculate |
118 | rv.column_r = rv.circumscription_r - 48.29; | 118 | rv.column_r = rv.circumscription_r - 48.29; |
119 | return rv; | 119 | return rv; |
120 | })(), | ||
121 | duetholder: (function() { | ||
122 | var rv = {}; | ||
123 | var s = CONFIG.base.sl; | ||
124 | var l = CONFIG.duet.hole_spacing.x; | ||
125 | var w = CONFIG.duet.hole_spacing.y; | ||
126 | var h = s*Math.cos(Math.PI/6); | ||
127 | var h1 = h*(1-l/s); | ||
128 | rv.distance = (h1-w)/3; // hole to side | ||
129 | return rv; | ||
120 | })() | 130 | })() |
121 | }; | 131 | }; |
122 | 132 | ||
123 | var U = { | 133 | var U = { |
124 | hypotenuse: function(a,b) { | 134 | hypotenuse: function(a,b) { |
125 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); | 135 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); |
126 | }, | 136 | }, |
127 | peek: function(x,m) { | 137 | peek: function(x,m) { |
128 | console.log(x,m); | 138 | console.log(x,m); |
129 | return x; | 139 | return x; |
130 | } | 140 | } |
131 | }; | 141 | }; |
132 | 142 | ||
133 | /* {h:,w:} */ | 143 | /* {h:,w:} */ |
134 | function nut(o) { | 144 | function nut(o) { |
135 | var rv = CSG.cylinder({ | 145 | var rv = CSG.cylinder({ |
136 | start:[0,0,0],end:[0,0,o.h], | 146 | start:[0,0,0],end:[0,0,o.h], |
137 | radius: o.w/2/Math.cos(Math.PI/6), | 147 | radius: o.w/2/Math.cos(Math.PI/6), |
138 | resolution: 6 | 148 | resolution: 6 |
139 | }); | 149 | }); |
140 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); | 150 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); |
141 | return rv; | 151 | return rv; |
142 | } | 152 | } |
143 | 153 | ||