-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ovaltop.rb
185 lines (163 loc) · 3.67 KB
/
Ovaltop.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
require './Oval.rb'
$bitwidth = 2.0/25.4
$halfwidth = $bitwidth/2
class Ovaltop < Oval
def initialize(n,z)
@zstep = 4
super(n,z)
end
def max (x,y)
if (x>y) then return x
else return y end
end
def brasso_specifico(x,y)
skimtoPoint(x,y,0.1)
thetai = 0
maxrad = 1.0/8.0 - 1.0/25.4
radif = 1.0/8.0 - 2.0/25.4
i = 0
z = 0
incro = (Float(@depth) / Float(@zstep))
while z > -@depth do
z -= incro / NUMSEGS
radioi = maxrad - (z/-@depth)*radif
radioi /= 2.0
yy = radioi * Math.sin(2 * i * Math::PI / NUMSEGS)
xx = radioi * Math.cos(2 * i * Math::PI / NUMSEGS)
cutoPointDeepo(x+xx,y+yy,z)
i += 1
end
while z < 0 do
z += incro / NUMSEGS
radioi = maxrad - (z/-@depth)*radif
radioi /= 2.0
yy = radioi * Math.sin(2 * i * Math::PI / NUMSEGS)
xx = radioi * Math.cos(2 * i * Math::PI / NUMSEGS)
cutoPointDeepo(x+xx,y+yy,z)
i += 1
end
end
def dx(x)
return @@lipp + $halfwidth + x#(@wido*2)-x
#return x+@@lipp + $halfwidth
end
def alpstot(x,y,theta)
skimtoPoint(x,y,0.1)
#innerrad =
outerrad = 3.0/25.4 - $halfwidth #3.2!
i = 0
z = 0
deepak = -0.45 #was 40
incro = (Float(-deepak) / Float(@zstep))
drepak = deepak - incro
while z > drepak do
z -= incro / NUMSEGS
zz = max(z,deepak)
thetai = i % NUMSEGS
radioi = outerrad
if thetai < 6 then
thetai = 6
end
if thetai >26 then
thetai = 26
end
thetai += theta*NUMSEGS/360
yy = radioi * Math.sin(2 * thetai * Math::PI / NUMSEGS)
xx = radioi * Math.cos(2 * thetai * Math::PI / NUMSEGS)
cutoPointDeepo(x+xx,y+yy,zz)
i += 1
end
while z < 0 do
z += incro / NUMSEGS
zz = max(z,deepak)
thetai = i % NUMSEGS
radioi = outerrad
if thetai < 6 then
thetai = 7
end
if thetai >26 then
thetai = 25
end
thetai += theta*NUMSEGS/360
yy = radioi * Math.sin(2 * thetai * Math::PI / NUMSEGS)
xx = radioi * Math.cos(2 * thetai * Math::PI / NUMSEGS)
cutoPointDeepo(x+xx,y+yy,zz)
i += 1
end
end
def balpsMET(x,y,t)
x = dx(x)
alpstot(x,y,90)
alpstot(x,y,90)
#alpsdot(x,y,90)
tubo(x,y,0.35,0,-0.12,2)
spyrtub(x,y,1.5,0)
end
def balpsMET(x,y,t) #dear Darron
x = dx(x)
tubo(x,y,10.0/25.4,0,-10.7/25.4,4)
spyrtub(x,y,1.5,0)
end
def balpsQMET(x,y,t)
x = dx(x)
alpspot(x,y,t-90)
if (t<0) then
box(x-0.5,y-0.25,x-0.3,y+0.25,0,-0.1,1)
else
box(x+0.3,y-0.25,x+0.5,y+0.25,0,-0.1,1)
end
end
def eights(x,y,t)
x = dx(x)
spyrtub(x,y,1.0/14,0.15/32)
end
def omronish(x,y)
x = dx(x)
tubo(x,y,0.35,0,-0.11,1)
tubo(x,y,0.38/2.0,-0.11,-0.4,3)
spyrtub(x,y,0.5,0)
end
def omron(x,y,t)
omronish(x,y)
x=dx(x)
tubo(x,-y,0.250,0,-0.125,1)
spyrtub(x,-y,5.0/25.4,0)
end
def eights(x,y,t)
x = dx(x)
spyrtub(x,y,1.0/14,0.15/32)
end
def BRASSO(x,y,t)
x = dx(x)
if @nodes=="BRASSO" then
brasso_specifico(x,y)
elsif @nodes=="STUDS" then
spyrtub(x,y,0.05,0)
elsif @nodes=="SPESAL" then
spyrtub(x,y,3.2/25.4,0)
else johnson(x,y) end
end
def cronktor(x,y)
for i in 0..5 do
box(x-0.7,y-0.5+Float(i)/10,
x+0.7,y,
-Float(i)/15,-Float(i+1)/15,1)
end
end
def cronktori(x,y)
for i in 0..5 do
box(x-0.7,y,
x+0.7,y+0.5-Float(i)/10,
-Float(i)/15,-Float(i+1)/15,1)
end
end
def boxo
if @zygot=="FYRALL" then fyral()
elsif @zygot=="SRINE" then srine()
elsif @zygot=="STUBER" then stuber()
end
cronktor(@hawi, 2.4)
cronktori(@hawi, -2.4)
end
end
dudderat(Ovaltop)