extract_curves 0.0.1-i586-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. data/CVS/Entries +4 -0
  2. data/CVS/Repository +1 -0
  3. data/CVS/Root +1 -0
  4. data/bin/CVS/Entries +5 -0
  5. data/bin/CVS/Repository +1 -0
  6. data/bin/CVS/Root +1 -0
  7. data/bin/ec_rect2polar.rb +22 -0
  8. data/bin/ec_rev_lines.rb +5 -0
  9. data/bin/ec_sph_area.rb +30 -0
  10. data/bin/extract_curves.rb +2145 -0
  11. data/ruby_ext/CVS/Entries +1 -0
  12. data/ruby_ext/CVS/Repository +1 -0
  13. data/ruby_ext/CVS/Root +1 -0
  14. data/ruby_ext/pav/CVS/Entries +14 -0
  15. data/ruby_ext/pav/CVS/Repository +1 -0
  16. data/ruby_ext/pav/CVS/Root +1 -0
  17. data/ruby_ext/pav/extconf.rb +22 -0
  18. data/ruby_ext/pav/pav.so +0 -0
  19. data/ruby_libs/CVS/Entries +1 -0
  20. data/ruby_libs/CVS/Repository +1 -0
  21. data/ruby_libs/CVS/Root +1 -0
  22. data/ruby_libs/pav/CVS/Entries +20 -0
  23. data/ruby_libs/pav/CVS/Repository +1 -0
  24. data/ruby_libs/pav/CVS/Root +1 -0
  25. data/ruby_libs/pav/attr_cache.rb +211 -0
  26. data/ruby_libs/pav/attr_cache.t1.rb +32 -0
  27. data/ruby_libs/pav/cache.rb +31 -0
  28. data/ruby_libs/pav/dbg_log.rb +458 -0
  29. data/ruby_libs/pav/floatsio.rb +53 -0
  30. data/ruby_libs/pav/generator_cache.rb +165 -0
  31. data/ruby_libs/pav/gtk/CVS/Entries +4 -0
  32. data/ruby_libs/pav/gtk/CVS/Repository +1 -0
  33. data/ruby_libs/pav/gtk/CVS/Root +1 -0
  34. data/ruby_libs/pav/gtk/button.rb +130 -0
  35. data/ruby_libs/pav/gtk/icons.rb +87 -0
  36. data/ruby_libs/pav/gtk/toolbar.rb +192 -0
  37. data/ruby_libs/pav/heap.rb +54 -0
  38. data/ruby_libs/pav/icons/CVS/Entries +17 -0
  39. data/ruby_libs/pav/icons/CVS/Repository +1 -0
  40. data/ruby_libs/pav/icons/CVS/Root +1 -0
  41. data/ruby_libs/pav/icons/alt_handle.xpm +3832 -0
  42. data/ruby_libs/pav/icons/alt_handle_hover.xpm +3368 -0
  43. data/ruby_libs/pav/icons/alt_handle_pressed.xpm +3828 -0
  44. data/ruby_libs/pav/icons/extract_curves/CVS/Entries +6 -0
  45. data/ruby_libs/pav/icons/extract_curves/CVS/Repository +1 -0
  46. data/ruby_libs/pav/icons/extract_curves/CVS/Root +1 -0
  47. data/ruby_libs/pav/icons/extract_curves/extract_curves-icon-rgb.ppm +14 -0
  48. data/ruby_libs/pav/icons/extract_curves/extract_curves-logo-rgb.gif +0 -0
  49. data/ruby_libs/pav/icons/extract_curves/trace_mark.xpm +38 -0
  50. data/ruby_libs/pav/icons/handle.xpm +213 -0
  51. data/ruby_libs/pav/icons/next.xpm +29 -0
  52. data/ruby_libs/pav/icons/next_hover.xpm +315 -0
  53. data/ruby_libs/pav/icons/next_pressed.xpm +144 -0
  54. data/ruby_libs/pav/icons/prev.xpm +29 -0
  55. data/ruby_libs/pav/icons/prev_hover.xpm +315 -0
  56. data/ruby_libs/pav/icons/prev_pressed.xpm +144 -0
  57. data/ruby_libs/pav/icons/vnext.xpm +29 -0
  58. data/ruby_libs/pav/icons/vprev.xpm +29 -0
  59. data/ruby_libs/pav/numeric/CVS/Entries +2 -0
  60. data/ruby_libs/pav/numeric/CVS/Repository +1 -0
  61. data/ruby_libs/pav/numeric/CVS/Root +1 -0
  62. data/ruby_libs/pav/numeric/ext.rb +13 -0
  63. data/ruby_libs/pav/pav_find.rb +90 -0
  64. data/ruby_libs/pav/pix/CVS/Entries +11 -0
  65. data/ruby_libs/pav/pix/CVS/Repository +1 -0
  66. data/ruby_libs/pav/pix/CVS/Root +1 -0
  67. data/ruby_libs/pav/pix/aapix.rb +378 -0
  68. data/ruby_libs/pav/pix/blob.rb +543 -0
  69. data/ruby_libs/pav/pix/circle.rb +73 -0
  70. data/ruby_libs/pav/pix/contour/CVS/Entries +5 -0
  71. data/ruby_libs/pav/pix/contour/CVS/Repository +1 -0
  72. data/ruby_libs/pav/pix/contour/CVS/Root +1 -0
  73. data/ruby_libs/pav/pix/contour/calc_situations.rb +9 -0
  74. data/ruby_libs/pav/pix/contour/carp_calc.rb +212 -0
  75. data/ruby_libs/pav/pix/contour/situations.dmp +0 -0
  76. data/ruby_libs/pav/pix/contour/situations.rb +21 -0
  77. data/ruby_libs/pav/pix/contour.rb +644 -0
  78. data/ruby_libs/pav/pix/curve.rb +1508 -0
  79. data/ruby_libs/pav/pix/img_obj.rb +751 -0
  80. data/ruby_libs/pav/pix/node.rb +712 -0
  81. data/ruby_libs/pav/pix/node_grp.rb +853 -0
  82. data/ruby_libs/pav/pix/shaved_core.rb +534 -0
  83. data/ruby_libs/pav/pix/subpix.rb +212 -0
  84. data/ruby_libs/pav/pix.rb +402 -0
  85. data/ruby_libs/pav/rand_accessible.rb +16 -0
  86. data/ruby_libs/pav/rangeset.rb +63 -0
  87. data/ruby_libs/pav/search.rb +210 -0
  88. data/ruby_libs/pav/set.rb +20 -0
  89. data/ruby_libs/pav/string/CVS/Entries +6 -0
  90. data/ruby_libs/pav/string/CVS/Repository +1 -0
  91. data/ruby_libs/pav/string/CVS/Root +1 -0
  92. data/ruby_libs/pav/string/bits.rb +523 -0
  93. data/ruby_libs/pav/string/ext.rb +58 -0
  94. data/ruby_libs/pav/string/observable.rb +155 -0
  95. data/ruby_libs/pav/string/text.rb +79 -0
  96. data/ruby_libs/pav/string/words.rb +42 -0
  97. data/ruby_libs/pav/sub_arr.rb +55 -0
  98. data/ruby_libs/pav/traced_obj.rb +79 -0
  99. metadata +147 -0
@@ -0,0 +1,13 @@
1
+ class Numeric
2
+ def scaled_floor(toler)
3
+ (sc = self / toler).finite? ? sc.floor * toler : self
4
+ end
5
+
6
+ def scaled_ceil(toler)
7
+ (sc = self / toler).finite? ? sc.ceil * toler : self
8
+ end
9
+
10
+ def scaled_round(toler)
11
+ (sc = self / toler).finite? ? sc.round * toler : self
12
+ end
13
+ end
@@ -0,0 +1,90 @@
1
+ # From Ruby's Find module:
2
+ module PavFind
3
+ def self.pfind_follow_symlinks(paths)
4
+ paths = paths.collect{|d| d.dup}
5
+ while file = paths.shift
6
+ catch(:prune) do
7
+ next unless File.exist? file
8
+ yield file.dup.taint
9
+ begin
10
+ if File.directory?(file) then
11
+ d = Dir.open(file)
12
+ begin
13
+ for f in d
14
+ next if f == "." or f == ".."
15
+ if File::ALT_SEPARATOR and
16
+ file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
17
+ f = file + f
18
+ elsif file == "/" then
19
+ f = "/" + f
20
+ else
21
+ f = File.join(file, f)
22
+ end
23
+ paths.unshift f.untaint
24
+ end
25
+ ensure
26
+ d.close
27
+ end
28
+ end
29
+ rescue Errno::ENOENT, Errno::EACCES
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ def self.pfind_no_follow_symlinks(paths)
36
+ paths = paths.collect{|d| d.dup}
37
+ while file = paths.shift
38
+ catch(:prune) do
39
+ next unless File.exist? file
40
+ yield file.dup.taint
41
+ begin
42
+ if File.lstat(file).directory? then
43
+ d = Dir.open(file)
44
+ begin
45
+ for f in d
46
+ next if f == "." or f == ".."
47
+ if File::ALT_SEPARATOR and
48
+ file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then
49
+ f = file + f
50
+ elsif file == "/" then
51
+ f = "/" + f
52
+ else
53
+ f = File.join(file, f)
54
+ end
55
+ paths.unshift f.untaint
56
+ end
57
+ ensure
58
+ d.close
59
+ end
60
+ end
61
+ rescue Errno::ENOENT, Errno::EACCES
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ def self.pfind(paths, follow_symlinks=true, entry_visit_once=true, &block)
68
+ if follow_symlinks
69
+ if entry_visit_once
70
+ visited = {}
71
+ self.pfind_follow_symlinks(paths) { |path|
72
+ if visited.include?(path)
73
+ self.prune
74
+ else
75
+ yield(path)
76
+ visited[path] = true
77
+ end
78
+ }
79
+ else
80
+ self.pfind_follow_symlinks(paths, &block)
81
+ end
82
+ else
83
+ self.pfind_no_follow_symlinks(paths, &block)
84
+ end
85
+ end
86
+
87
+ def self.prune
88
+ throw :prune
89
+ end
90
+ end
@@ -0,0 +1,11 @@
1
+ /aapix.rb/1.1.1.1/Tue Nov 15 17:32:14 2005//
2
+ /blob.rb/1.1.1.1/Tue Nov 15 17:32:14 2005//
3
+ /circle.rb/1.1.1.1/Tue Nov 15 17:32:14 2005//
4
+ /contour.rb/1.1.1.1/Tue Nov 15 17:32:16 2005//
5
+ /curve.rb/1.1.1.1/Tue Nov 15 17:32:15 2005//
6
+ /img_obj.rb/1.1.1.1/Tue Nov 15 17:32:14 2005//
7
+ /node.rb/1.1.1.1/Tue Nov 15 17:32:16 2005//
8
+ /node_grp.rb/1.1.1.1/Tue Nov 15 17:32:13 2005//
9
+ /shaved_core.rb/1.1.1.1/Tue Nov 15 17:32:13 2005//
10
+ /subpix.rb/1.1.1.1/Tue Nov 15 17:32:16 2005//
11
+ D/contour////
@@ -0,0 +1 @@
1
+ extract-curves/ruby_libs/pav/pix
@@ -0,0 +1 @@
1
+ :ext:pavpen@rubyforge.org:/var/cvs/extract-curves
@@ -0,0 +1,378 @@
1
+ require 'pav/pix'
2
+ require 'pav/numeric/ext'
3
+
4
+ module PPix
5
+
6
+ class Xy
7
+ def a_eql?(pix, eps=2e-10)
8
+ (self.ay - pix.ay).abs < eps && (self.ax - pix.ax).abs < eps
9
+ end
10
+
11
+ alias_method :ax, :x
12
+ alias_method :ay, :y
13
+ alias_method :eql?, :a_eql?
14
+
15
+ def a_neighb8?(pix, eps=2e-10)
16
+ dx = (self.ax - pix.ax).abs; dy = (self.ay - pix.ay).abs
17
+ dx <= 1.0+eps && dy <= 1.0+eps
18
+ end
19
+
20
+ def a_neighb4?(pix, eps=2e-10)
21
+ dx = (self.ax - pix.ax).abs; dy = (self.ay - pix.ay).abs
22
+ (dx <= 1.0+eps && dy < eps) || (dy <= 1.0+eps && dx < eps)
23
+ end
24
+
25
+ def a_close_neighb?(pix, eps=2e-10)
26
+ dx = (self.ax - pix.ax).abs; dy = (self.ay - pix.ay).abs
27
+ (dx <= 0.5+eps && dy <= 0.5+eps)
28
+ end
29
+
30
+ def semi_neighb8?(pix, eps=2e-10)
31
+ dx = (self.ax - pix.ax).abs; dy = (self.ay - pix.ay).abs
32
+ dx <= 1.5+eps && dy <= 1.5+eps
33
+ end
34
+
35
+ def semi_neighb4?(pix, eps=2e-10)
36
+ dx = (self.ax - pix.ax).abs; dy = (self.ay - pix.ay).abs
37
+ (dx <= 1.5+eps && dy < eps) || (dy <= 1.5+eps && dx < eps)
38
+ end
39
+
40
+ def semi_close_neighb?(pix, eps=2e-10)
41
+ dx = (self.ax - pix.ax).abs; dy = (self.ay - pix.ay).abs
42
+ (dx <= 0.5-eps && dy <= 0.5-eps)
43
+ end
44
+
45
+ def a_yx(eps=1e-10)
46
+ [self.ay.scaled_round(eps), self.ax.scaled_round(eps)]
47
+ end
48
+
49
+ def a_leg(pix)
50
+ leg = (self.ay <=> pix.ay)
51
+ return leg if leg != 0
52
+ self.ax <=> pix.ax
53
+ end
54
+ end
55
+
56
+ class AaXy < Xy
57
+ attr_reader :ax, :ay
58
+
59
+ def self.a_yx(x, y, eps=1e-10)
60
+ [y.scaled_round(eps), x.scaled_round(eps)]
61
+ end
62
+
63
+ def initialize(ax, ay)
64
+ @ax = ax; @ay = ay
65
+ super(@ax.round, @ay.round)
66
+ end
67
+
68
+ def a_eql?(pix, eps=1e-10)
69
+ (@ay - pix.ay).abs < eps && (@ax - pix.ax).abs < eps
70
+ end
71
+
72
+ def hash
73
+ self.a_yx.hash
74
+ end
75
+
76
+ alias_method :eql?, :a_eql?
77
+
78
+ def to_s
79
+ "(#{@ax}, #{@ay})"
80
+ end
81
+
82
+ alias_method :coords_to_s, :to_s
83
+ end
84
+
85
+ class AaPix < AaXy
86
+ include MPixbufPix
87
+
88
+ def initialize(pixbuf, ax, ay)
89
+ @pixbuf = pixbuf
90
+ super(ax, ay)
91
+ end
92
+
93
+ def dup_aapix
94
+ AaPix.new(@pixbuf, self.ax, self.ay)
95
+ end
96
+ end
97
+
98
+ class AaXyCancelI < AaXy
99
+ attr_accessor :cancel, :semi_adj8_i, :semi_adj8_idxs
100
+
101
+ def initialize(ax, ay, cancel, semi_adj8_i, semi_adj8_idxs)
102
+ @cancel = cancel
103
+ @semi_adj8_i = semi_adj8_i
104
+ @semi_adj8_idxs = semi_adj8_idxs
105
+ super(ax, ay)
106
+ end
107
+ end
108
+
109
+ class AaXy
110
+ ADJ8_SEMI_ADJ8_SPEC = [
111
+ AaXyCancelI.new( 0,-0.5, [ 1,17,18], 3, [15,0, 1, 2, 3, 4, 5, 6, 7]),
112
+ AaXyCancelI.new( 0, -1, [], 3, [1, 2, 3, 4, 5]),
113
+ AaXyCancelI.new(-0.5, 0, [ 3,19,20], 7, [3, 4, 5, 6, 7, 8, 9,10,11]),
114
+ AaXyCancelI.new( -1, 0, [], 7, [5, 6, 7, 8, 9]),
115
+ AaXyCancelI.new( 0, 0.5, [ 5,21,22],11, [7, 8, 9,10,11,12,13,14,15]),
116
+ AaXyCancelI.new( 0, 1, [],11, [9,10,11,12,13]),
117
+ AaXyCancelI.new( 0.5, 0, [ 7,23,16],15, [11,12,13,14,15,0, 1, 2, 3]),
118
+ AaXyCancelI.new( 1, 0, [],15, [13,14,15,0, 1]),
119
+ AaXyCancelI.new( 0.5,-0.5, [ 9,16,17], 1, [15,0, 1, 2, 3]),
120
+ AaXyCancelI.new( 1, -1, [], 1, [0, 1, 2]),
121
+ AaXyCancelI.new(-0.5,-0.5, [11,18,19], 5, [3, 4, 5, 6, 7]),
122
+ AaXyCancelI.new( -1, -1, [], 5, [4, 5, 6]),
123
+ AaXyCancelI.new(-0.5, 0.5, [13,20,21], 9, [7, 8, 9,10,11]),
124
+ AaXyCancelI.new( -1, 1, [], 9, [8, 9,10]),
125
+ AaXyCancelI.new( 0.5, 0.5, [15,22,23],13, [11,12,13,14,15]),
126
+ AaXyCancelI.new( 1, 1, [],13, [12,13,14]),
127
+ AaXyCancelI.new( 1,-0.5, [], 0, [15,0, 1, 2]),
128
+ AaXyCancelI.new( 0.5, -1, [], 2, [0, 1, 2, 3]),
129
+ AaXyCancelI.new(-0.5, -1, [], 4, [3, 4, 5, 6]),
130
+ AaXyCancelI.new( -1,-0.5, [], 6, [4, 5, 6, 7]),
131
+ AaXyCancelI.new( -1, 0.5, [], 8, [7, 8, 9,10]),
132
+ AaXyCancelI.new(-0.5, 1, [],10, [8, 9,10,11]),
133
+ AaXyCancelI.new( 0.5, 1, [],12, [11,12,13,14]),
134
+ AaXyCancelI.new( 1, 0.5, [],14, [12,13,14,15]),
135
+ ]
136
+
137
+ tmp1 = []; 16.times { tmp1 << [] }
138
+ ADJ8_SEMI_ADJ8_SPEC.each { |a| tmp1[a.semi_adj8_i] << a }
139
+ tmp2 = []
140
+ tmp1.each { |m| tmp2 << m.first }; tmp1.each { |m| tmp2 << m.last }
141
+ SEMI_ADJ8 = tmp2
142
+
143
+ def self.semi_neighbs8_contig_arr_get_segs(arr)
144
+ #$PDbgLog.sig_call(self)
145
+ #$PDbgLog.print_msg "ngbs: #{(0...arr.length).find_all { |i|
146
+ # arr[i]}.join(" ")}: "
147
+ end_i = -1
148
+ while !arr[end_i]
149
+ end_i -= 1
150
+ if end_i < -15
151
+ #$PDbgLog.sig_return('Empty.')
152
+ return []
153
+ end
154
+ end
155
+ end_i += 17
156
+ #$PDbgLog.print_msg "end_i=#{end_i} "
157
+ start_p = 0
158
+ start_p += 1 while !arr[start_p]
159
+ #$PDbgLog.print_msg "start_p=#{start_p} "
160
+ if start_p >= end_i
161
+ #$PDbgLog.sig_return("[[#{start_p}, #{start_p+1}]]")
162
+ return [[start_p, start_p+1]]
163
+ end
164
+ res = []
165
+ i = start_p + 1
166
+ loop do
167
+ i += 1 while arr[i]
168
+ res << [start_p, i]
169
+ break if i >= end_i
170
+ i += 1 while !arr[i]
171
+ start_p = i
172
+ end
173
+ if res.length > 1 && res[0][0] % 16 == res.last[1] % 16
174
+ len = res.last[1] - res.last[0]
175
+ res[0][0] -= len
176
+ res.pop
177
+ end
178
+ #$PDbgLog.sig_return(res.inspect)
179
+ res
180
+ end
181
+
182
+ def self.semi_neighbs8_arr_get_segs(ngbs)
183
+ #$PDbgLog.sig_call(self)
184
+ #$PDbgLog.print_msg "ngbs: #{(0...ngbs.length).find_all { |i|
185
+ # ngbs[i]}.join(" ")}: "
186
+ end_p = start_p = -1
187
+ if ngbs[start_p]
188
+ while ngbs[end_p += 1] || end_p % 4 < 3
189
+ if end_p + 1 >= 16
190
+ #$PDbgLog.sig_return('whole circle.')
191
+ return [[0, 0]]
192
+ end
193
+ end
194
+ while ngbs[start_p-=1] || start_p % 4 < 3
195
+ end
196
+ end_i = 16 + start_p
197
+ start_p += 1
198
+ start_p += 1 while !ngbs[start_p]
199
+ end_p -= 1 while !ngbs[end_p-1]
200
+ res = [[start_p, end_p]]
201
+ else
202
+ res = []
203
+ end_i = 15
204
+ end
205
+ loop do
206
+ start_p = end_p + 1
207
+ while !ngbs[start_p]
208
+ start_p += 1
209
+ if start_p >= end_i
210
+ #$PDbgLog.sig_return(res.inspect)
211
+ return res
212
+ end
213
+ end
214
+ end_p = start_p + 1
215
+ end_p += 1 while (ngbs[end_p] || end_p % 4 < 3) &&
216
+ end_p < end_i
217
+ end_p -= 1 while !ngbs[end_p-1]
218
+ res << [start_p, end_p]
219
+ end
220
+ end
221
+
222
+ def self.semi_neighbs8_with_arr_get_segs(arr, ngbs)
223
+ $PDbgLog.sig_call(self)
224
+ $PDbgLog.print_msg "ngbs: #{(0...arr.length).find_all { |i|
225
+ arr[i]}.collect{|i|ngbs[arr[i]].coords_to_s+"[#{i}]"}.join(" "
226
+ )}: " #"
227
+ end_i = -1
228
+ while !arr[end_i]
229
+ end_i -= 1
230
+ if end_i < -15
231
+ $PDbgLog.sig_return('Empty.')
232
+ return []
233
+ end
234
+ end
235
+ end_i += 16
236
+ $PDbgLog.print_msg "end_i=#{end_i} "
237
+ start_p = 0
238
+ start_p += 1 while !arr[start_p]
239
+ $PDbgLog.print_msg "start_p=#{start_p} "
240
+ if start_p >= end_i
241
+ $PDbgLog.sig_return("[[#{start_p}, #{start_p+1}]]")
242
+ return [[start_p, start_p+1]]
243
+ end
244
+ last_pix = ngbs[arr[start_p]]
245
+ res = []
246
+ end_p = i = start_p
247
+ loop do
248
+ i += 1
249
+ i += 1 while !arr[i]
250
+ $PDbgLog.print_msg "i=#{i} "
251
+ if last_pix.a_neighb8?(ngbs[arr[i]])
252
+ if (end_p = i) >= end_i
253
+ if res.empty?
254
+ # if arr.compact.length > 2 && ngbs[arr[
255
+ # start_p]].a_neighb8?(ngbs[arr[i]])
256
+ # $PDbgLog.print_msg("Full circle ")
257
+ # res << [0, 0]
258
+ # else
259
+ res << [start_p, end_p+1]
260
+ # end
261
+ elsif ngbs[arr[res[0][0]]].a_neighb8?(
262
+ ngbs[arr[i]])
263
+ res[0][0] = start_p - 16
264
+ else
265
+ res << [start_p, end_p+1]
266
+ end
267
+ $PDbgLog.sig_return(res.inspect)
268
+ return res
269
+ end
270
+ else
271
+ $PDbgLog.puts_msg "seg[#{start_p},#{end_p+1})"
272
+ res << [start_p, end_p+1]
273
+ if i >= end_i
274
+ if ngbs[arr[res[0][0]]].neighb8?(ngbs[arr[i]])
275
+ res[0][0] = i - 16
276
+ else
277
+ res << [i, i+1]
278
+ end
279
+ $PDbgLog.sig_return(res.inspect)
280
+ return res
281
+ end
282
+ start_p = i
283
+ last_pix = ngbs[arr[start_p]]
284
+ end
285
+ last_pix = ngbs[arr[i]]
286
+ end
287
+ end
288
+ end
289
+
290
+ class Xy
291
+ def semi_neighbs8_arr(neighbs)
292
+ #$PDbgLog.sig_call(self)
293
+ #$PDbgLog.print_msg self.coords_to_s + ", neighbs: #{PixbufPix.
294
+ # path_to_s(neighbs)}: "
295
+ warn("#{self.class.name}.semi_neighbs8_arr: " +
296
+ "Non-neighbors given to #{self.coords_to_s}: #{PixbufPix.
297
+ path_to_s(neighbs)}") if neighbs.detect { |a|
298
+ !a.a_neighb8?(self) }
299
+ res = Array.new(16)
300
+ ranks = Array.new(16, 100)
301
+ neighbs.each_with_index { |ngb, ngb_i|
302
+ ax = (ngb.ax - self.ax).scaled_round(0.5)
303
+ ay = (ngb.ay - self.ay).scaled_round(0.5)
304
+ AaXy::ADJ8_SEMI_ADJ8_SPEC.each_with_index{|spec,rk|
305
+ if ay == spec.ay && ax == spec.ax
306
+ if ranks[spec.semi_adj8_i] > rk
307
+ res[spec.semi_adj8_i] = ngb_i
308
+ ranks[spec.semi_adj8_i] = rk
309
+ end
310
+ break
311
+ end
312
+ }
313
+ }
314
+ #$PDbgLog.sig_return(res.inspect)
315
+ res
316
+ end
317
+
318
+ def semi_neighbs8_contig_arr(neighbs)
319
+ #$PDbgLog.sig_call(self)
320
+ #$PDbgLog.print_msg self.coords_to_s + ", neighbs: #{Xy.
321
+ # path_to_s(neighbs)}: "
322
+ warn("#{self.class.name}.semi_neighbs8_contig_arr: " +
323
+ "Non-neighbors given to #{self.coords_to_s}: #{PixbufPix.
324
+ path_to_s(neighbs)}") if neighbs.detect { |a|
325
+ !a.semi_neighb8?(self) }
326
+ res = Array.new(16)
327
+ ranks = Array.new(16, 100)
328
+ neighbs.each_with_index { |ngb, ngb_i|
329
+ ax = (ngb.ax - self.ax).scaled_round(0.5)
330
+ ay = (ngb.ay - self.ay).scaled_round(0.5)
331
+ AaXy::ADJ8_SEMI_ADJ8_SPEC.each_with_index{|spec,rk|
332
+ if ay == spec.ay && ax == spec.ax
333
+ spec.semi_adj8_idxs.each { |semi_adj8_i|
334
+ if ranks[semi_adj8_i] > rk
335
+ res[semi_adj8_i] = ngb_i
336
+ ranks[semi_adj8_i] = rk
337
+ end
338
+ }
339
+ break
340
+ end
341
+ }
342
+ }
343
+ #$PDbgLog.sig_return(res.inspect)
344
+ res
345
+ end
346
+ end
347
+
348
+ module MPixbufPix
349
+ def adj8_semi_adj8_each
350
+ #$PDbgLog.sig_call(self)
351
+ pixbuf = self.pixbuf; ax = self.ax; ay = self.ay
352
+ #$PDbgLog.print_msg self.to_s + ",ax=#{ax},ay=#{ay}: "
353
+ cancelled = []
354
+ AaXy::ADJ8_SEMI_ADJ8_SPEC.each_with_index { |a, ai|
355
+ next if cancelled[ai]
356
+ if yield(AaPix.new(pixbuf, ax+a.ax, ay+a.ay))
357
+ a.cancel.each { |cnc| cancelled[cnc] = true }
358
+ end
359
+ }
360
+ #$PDbgLog.sig_return('done.')
361
+ end
362
+
363
+ def semi_adj8_incl_set_each(incl_set)
364
+ i = -1
365
+ self.adj8_semi_adj8_each { |ngb|
366
+ i += 1
367
+ if incl_set.include?(ngb)
368
+ yield(ngb, AaXy::ADJ8_SEMI_ADJ8_SPEC.at(i).
369
+ semi_adj8_i)
370
+ true
371
+ else
372
+ false
373
+ end
374
+ }
375
+ end
376
+ end
377
+
378
+ end