-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dude.rb
executable file
·176 lines (167 loc) · 3.62 KB
/
Dude.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
require './Bot.rb'
#require 'Complex'
require './Jacksloon.rb'
require './dudefunks.rb'
class Roto < Bot
def initialize(star,endd,tier)
@start=star
@endor=endd
@tiero=tier
end
def rotate(th)
th=Math::PI*th/180
@arr.map! { |rr|
angol = Math.atan2(rr[1],rr[0])
radio = Math.sqrt((rr[1]*rr[1])+(rr[0]*rr[0]))
euler=Complex.polar(radio,angol+th)
[euler.real,euler.imag]
}
end
end
class Boxx < Roto
def arrdonk(minx,miny,maxx,maxy)
@arr = @arr <<
[minx,miny] <<
[minx,maxy] <<
[maxx,maxy] <<
[maxx,miny] <<
[minx,miny]
end
def initialize(minx,miny,maxx,maxy,star,endd,tier)
minx += $halfwidth
miny += $halfwidth
maxx -= $halfwidth
maxy -= $halfwidth
@arr = []
arrdonk(minx,miny,maxx,maxy)
while (minx < maxx) and (miny < maxy)
minx += $bitwidth
miny += $bitwidth
maxx -= $bitwidth
maxy -= $bitwidth
arrdonk(minx,miny,maxx,maxy)
end
super(star,endd,tier)
end
def cutote(x,y)
incro = (Float(@endor-@start) / Float(@tiero))
skimtoPoint(@arr[0][0]+x,@arr[0][1]+y,@start+0.1)
for i in 1..@tiero do
penetrate(@start + (incro * i))
@arr.each { |rr|
cutoPoint(rr[0]+x,rr[1]+y)
}
end
end
end
class Duxx < Roto
def initialize(starx,stary,dendx,dendy,star,endd,tier)
@arr = [[starx,stary],[dendx,dendy]]
super(star,endd,tier)
end
def cutote(x,y)
incro = (Float(@endor-@start) / Float(@tiero))
skimtoPoint(@arr[0][0]+x,@arr[0][1]+y,@start+0.1)
for i in 1..@tiero do
penetrate(@start + (incro * i))
p = i.divmod(2)[1]
cutoPoint(@arr[p][0]+x,@arr[p][1]+y)
end
end
end
class Kobi
def initialize(x,y,th)
nowchub = (0.367/2)
@parts=[]
@parts<<Boxx.new(nowchub,-0.5,nowchub+$bitwidth,-0.3,0,-0.211,2)
@parts<<Boxx.new(-nowchub,-0.75,nowchub,$halfwidth,0,-0.433,3)
@parts.each{|p| p.rotate(th)
p.cutote(x,y)
}
end
end
class Kyco
def initialize(x,y,th)
@parts=[]
nowchub = (0.266/2) #kyconSHAFT
@parts<<Boxx.new(-nowchub,-0.4,nowchub,$halfwidth+$halfwidth,0,-0.3,3)
nowchub = (0.5/2) #kyconSTEREO
@parts<<Boxx.new(-nowchub,-0.65,nowchub,-0.1,0,-0.351,3)
nowchub -= $halfwidth
@parts<<Duxx.new(-nowchub,-0.5,-nowchub,-0.1-$halfwidth,-0.351,-0.404,1)
@parts<<Duxx.new(+nowchub,-0.5,+nowchub,-0.1-$halfwidth,-0.351,-0.404,1)
@parts.each{|p| p.rotate(th)
p.cutote(x,y)
}
end
end
class Dude < Jacksloon
def initialize(n,z)
@nodes = n
@zygot = z
@nux = 0
@nuy = 0
@wido = 8.0
@hawi = @wido + @@lipp + $halfwidth
@hido= 2.5
@width=@wido*2
@heigh=@hido*2
super(0,0)
end
def max (x,y)
if (x>y) then return x
else return y end
end
def ova(w,h,theta)
xx = w * Math.cos(2*theta * Math::PI)
yy = h * Math.sin(2*theta * Math::PI)
return [@hawi+xx,yy]
end
def rim(theta)
star = ova(@wido+$halfwidth+@@lipp,@hido+$halfwidth+@@lipp,theta)
return star
end
def ducabot()
nuz = 0
retrax 0.1
star = rim(0)
skimtoPoint(star[0],star[1],0.1)
tier = Integer(@depth / 0.15)
tier = @depth / tier
oscacc = 0
numzegs=64.0
while (nuz >= -@depth) do
nuz -= tier
for i in 1..numzegs
oscacc += 1
trank = (oscacc % 2) * 2 - 1
here = rim(i/numzegs)
nuz += 0.2 * trank
cutoPointDeepo(here[0],here[1],nuz)
end
end
end
def boxo
end
def eights(x,y) end
def bomron(x,y) end
def balmet(x,y) end
def brasso(x,y) end
def BRASSO(x,y) end
def duxo
return @curxo
end
end
def dudderat(clasz)
nodes = "BRASSO"
zygot = "FYRALL"
unless ARGV[0].nil? then nodes = String(ARGV[0]) end
unless ARGV[1].nil? then zygot = String(ARGV[1]) end
broth = clasz.new(nodes,zygot)
broth.boxo()
broth.ducabot()
printf "G0 Z0.5\n"
printf "G0 X0 Y0 \n"
#print nodes
#print zygot
end