-
Notifications
You must be signed in to change notification settings - Fork 1
/
Grassi.rb
executable file
·118 lines (105 loc) · 2.39 KB
/
Grassi.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
#require './Dude.rb'
require './Okuda.rb'
require './Jacksloon.rb'
@@numero = 0
class Grassi < Jacksloon
def initialize(starx, stary)
@depth=0.55
@zstep = 4
@numzegs=64
@shorter=-6
@longer=8
@pampers=[]
for i in @shorter..@longer
@pampers = @pampers << i
end
@nux = 0
@nuy = 0
@wido = 8.0
@hawi = @wido + @@lipp + $halfwidth
@hido= 1.8
@heigh = @hido*2
super(starx, stary)
s = ova(@shorter+@numzegs/4)
d = ova(@longer+@numzegs/4)
x= s[0]-d[0]
y = s[1]-d[1]
@sidebide = Math.sqrt(x*x+y*y)
end
def ova(theta)
theta = theta/Float(@numzegs)
w = @wido+$halfwidth+@@lipp
h = @hido+$halfwidth+@@lipp
xx = w * Math.sin(2*theta * Math::PI)
yy = h * Math.cos(2*theta * Math::PI)
return [@hawi+xx,yy+@stary]
end
def rim(theta)
#use closure to return in place
leftshore = @shorter+@numzegs/4
leftlore = @longer+@numzegs/4
if theta>leftshore and theta<leftlore
start = ova(leftshore)
endor = ova(leftlore)
num = theta-leftshore
seg = leftlore-leftshore
primp=[]
primp[0] = num*(endor[0]-start[0])/seg+start[0]
primp[1] = num*(endor[1]-start[1])/seg+start[1]
return primp
end
leftshore = 3*@numzegs/4- @shorter
leftlore = 3*@numzegs/4-@longer
if theta<leftshore and theta>leftlore
start = ova(leftlore)
endor = ova(leftshore)
num = theta-leftlore
seg = leftshore-leftlore
primp=[]
primp[0] = num*(endor[0]-start[0])/seg+start[0]
primp[1] = num*(endor[1]-start[1])/seg+start[1]
return primp
end
star = ova(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)
nuz += 0.2 * trank
cutoPointDeepo(here[0],here[1],nuz)
end
end
end
def boxo
if @@numero == 1 then
fox(@hawi-2.125,-1.2+@stary,@hawi+2.125,1.2+@stary,0,-@depth,4)
end
@@numero += 1
@@numero %= 2
#fox(@hawi-2.125-2.2,-3.5-@sidebide/2,@hawi+2.125-2.2,-3.5+@sidebide/2,0,-@depth,4)
#fox(@hawi-2.125+2.2,-3.5-@sidebide/2,@hawi+2.125+2.2,-3.5+@sidebide/2,0,-@depth,4)
end
def ducatop
end
def eights(x,y) end
def bomron(x,y) end
def balmet(x,y) end
def brasso(x,y) end
def duxo
return @curxo
end
end
stutterat(Grassi)