Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/hershey

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/hershey (Version 11.3.0) and /externals/g4tools/include/tools/hershey (Version 9.0.p2)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_hershey                             
  5 #define tools_hershey                             
  6                                                   
  7 //////////////////////////////////////////////    
  8 // drawn fonts comming from CERNLIB ! A long s    
  9 //////////////////////////////////////////////    
 10                                                   
 11 namespace tools {                                 
 12                                                   
 13 class hershey {                                   
 14 private:                                          
 15   enum {                                          
 16     H_ROMAN =   1,                                
 17     H_DIGIT =   2,                                
 18     H_MATH =    3,                                
 19     H_SPECIAL = 4,                                
 20     H_GREEK =   5,                                
 21     H_UPPER =   1,                                
 22     H_LOWER =   2,                                
 23     H_NBITMX = 30                                 
 24   };                                              
 25 public:                                           
 26                                                   
 27   static unsigned int max_poly() { return 8;}     
 28   static unsigned int max_point() {return 160;    
 29                                                   
 30   static void special_char_points(char a_char,    
 31                                          int&     
 32                                          float    
 33     // PAW special characters.                    
 34     extract(H_SPECIAL,H_UPPER,a_char,a_scale,a    
 35   }                                               
 36                                                   
 37   static void latin_char_points(char a_char,fl    
 38                                        int& a_    
 39                                        float*     
 40                                                   
 41     // Latin correspondance with HPLSOF           
 42     // ABCDEFGHIJKLMNOPQRSTUVWXYZ  done with H    
 43     // abcdefghijklmnopqrstuvwxyz  done with H    
 44     // 0123456789                  done with H    
 45     // .,/()-+=*                   done with H    
 46     // $!#>?:;<[]{}%&              done with H    
 47                                                   
 48     switch(a_char) {                              
 49     case 'A':extract(H_ROMAN,H_UPPER,'A',a_sca    
 50     case 'B':extract(H_ROMAN,H_UPPER,'B',a_sca    
 51     case 'C':extract(H_ROMAN,H_UPPER,'C',a_sca    
 52     case 'D':extract(H_ROMAN,H_UPPER,'D',a_sca    
 53     case 'E':extract(H_ROMAN,H_UPPER,'E',a_sca    
 54     case 'F':extract(H_ROMAN,H_UPPER,'F',a_sca    
 55     case 'G':extract(H_ROMAN,H_UPPER,'G',a_sca    
 56     case 'H':extract(H_ROMAN,H_UPPER,'H',a_sca    
 57     case 'I':extract(H_ROMAN,H_UPPER,'I',a_sca    
 58     case 'J':extract(H_ROMAN,H_UPPER,'J',a_sca    
 59     case 'K':extract(H_ROMAN,H_UPPER,'K',a_sca    
 60     case 'L':extract(H_ROMAN,H_UPPER,'L',a_sca    
 61     case 'M':extract(H_ROMAN,H_UPPER,'M',a_sca    
 62     case 'N':extract(H_ROMAN,H_UPPER,'N',a_sca    
 63     case 'O':extract(H_ROMAN,H_UPPER,'O',a_sca    
 64     case 'P':extract(H_ROMAN,H_UPPER,'P',a_sca    
 65     case 'Q':extract(H_ROMAN,H_UPPER,'Q',a_sca    
 66     case 'R':extract(H_ROMAN,H_UPPER,'R',a_sca    
 67     case 'S':extract(H_ROMAN,H_UPPER,'S',a_sca    
 68     case 'T':extract(H_ROMAN,H_UPPER,'T',a_sca    
 69     case 'U':extract(H_ROMAN,H_UPPER,'U',a_sca    
 70     case 'V':extract(H_ROMAN,H_UPPER,'V',a_sca    
 71     case 'W':extract(H_ROMAN,H_UPPER,'W',a_sca    
 72     case 'X':extract(H_ROMAN,H_UPPER,'X',a_sca    
 73     case 'Y':extract(H_ROMAN,H_UPPER,'Y',a_sca    
 74     case 'Z':extract(H_ROMAN,H_UPPER,'Z',a_sca    
 75                                                   
 76     case 'a':extract(H_ROMAN,H_LOWER,'A',a_sca    
 77     case 'b':extract(H_ROMAN,H_LOWER,'B',a_sca    
 78     case 'c':extract(H_ROMAN,H_LOWER,'C',a_sca    
 79     case 'd':extract(H_ROMAN,H_LOWER,'D',a_sca    
 80     case 'e':extract(H_ROMAN,H_LOWER,'E',a_sca    
 81     case 'f':extract(H_ROMAN,H_LOWER,'F',a_sca    
 82     case 'g':extract(H_ROMAN,H_LOWER,'G',a_sca    
 83     case 'h':extract(H_ROMAN,H_LOWER,'H',a_sca    
 84     case 'i':extract(H_ROMAN,H_LOWER,'I',a_sca    
 85     case 'j':extract(H_ROMAN,H_LOWER,'J',a_sca    
 86     case 'k':extract(H_ROMAN,H_LOWER,'K',a_sca    
 87     case 'l':extract(H_ROMAN,H_LOWER,'L',a_sca    
 88     case 'm':extract(H_ROMAN,H_LOWER,'M',a_sca    
 89     case 'n':extract(H_ROMAN,H_LOWER,'N',a_sca    
 90     case 'o':extract(H_ROMAN,H_LOWER,'O',a_sca    
 91     case 'p':extract(H_ROMAN,H_LOWER,'P',a_sca    
 92     case 'q':extract(H_ROMAN,H_LOWER,'Q',a_sca    
 93     case 'r':extract(H_ROMAN,H_LOWER,'R',a_sca    
 94     case 's':extract(H_ROMAN,H_LOWER,'S',a_sca    
 95     case 't':extract(H_ROMAN,H_LOWER,'T',a_sca    
 96     case 'u':extract(H_ROMAN,H_LOWER,'U',a_sca    
 97     case 'v':extract(H_ROMAN,H_LOWER,'V',a_sca    
 98     case 'w':extract(H_ROMAN,H_LOWER,'W',a_sca    
 99     case 'x':extract(H_ROMAN,H_LOWER,'X',a_sca    
100     case 'y':extract(H_ROMAN,H_LOWER,'Y',a_sca    
101     case 'z':extract(H_ROMAN,H_LOWER,'Z',a_sca    
102                                                   
103     case '0':extract(H_DIGIT,H_UPPER,'0',a_sca    
104     case '1':extract(H_DIGIT,H_UPPER,'1',a_sca    
105     case '2':extract(H_DIGIT,H_UPPER,'2',a_sca    
106     case '3':extract(H_DIGIT,H_UPPER,'3',a_sca    
107     case '4':extract(H_DIGIT,H_UPPER,'4',a_sca    
108     case '5':extract(H_DIGIT,H_UPPER,'5',a_sca    
109     case '6':extract(H_DIGIT,H_UPPER,'6',a_sca    
110     case '7':extract(H_DIGIT,H_UPPER,'7',a_sca    
111     case '8':extract(H_DIGIT,H_UPPER,'8',a_sca    
112     case '9':extract(H_DIGIT,H_UPPER,'9',a_sca    
113                                                   
114     case '.':extract(H_MATH,H_UPPER,'.',a_scal    
115     case ',':extract(H_MATH,H_UPPER,',',a_scal    
116     case '/':extract(H_MATH,H_UPPER,'/',a_scal    
117     case '(':extract(H_MATH,H_UPPER,'(',a_scal    
118     case ')':extract(H_MATH,H_UPPER,')',a_scal    
119     case '-':extract(H_MATH,H_UPPER,'-',a_scal    
120     case '+':extract(H_MATH,H_UPPER,'+',a_scal    
121     case '=':extract(H_MATH,H_UPPER,'=',a_scal    
122     case '*':extract(H_MATH,H_UPPER,'*',a_scal    
123                                                   
124     case '$':extract(H_SPECIAL,H_UPPER,'D',a_s    
125     case '!':extract(H_SPECIAL,H_UPPER,'E',a_s    
126     case '#':extract(H_SPECIAL,H_UPPER,'F',a_s    
127     case '>':extract(H_SPECIAL,H_UPPER,'G',a_s    
128     case '?':extract(H_SPECIAL,H_UPPER,'H',a_s    
129     case ':':extract(H_SPECIAL,H_UPPER,'J',a_s    
130     case ';':extract(H_SPECIAL,H_UPPER,'K',a_s    
131     case '<':extract(H_SPECIAL,H_UPPER,'L',a_s    
132     case '[':extract(H_SPECIAL,H_UPPER,'M',a_s    
133     case ']':extract(H_SPECIAL,H_UPPER,'N',a_s    
134     case '{':extract(H_SPECIAL,H_UPPER,'P',a_s    
135     case '}':extract(H_SPECIAL,H_UPPER,'Q',a_s    
136     case '%':extract(H_SPECIAL,H_UPPER,'Y',a_s    
137     case '&':extract(H_SPECIAL,H_UPPER,'W',a_s    
138                                                   
139     case '_':                                     
140       a_number = 1;                               
141       a_mx_point[0] = 2;                          
142       aX[0] = 0;                                  
143       aY[0] = 0;                                  
144       aX[1] = a_scale;                            
145       aY[1] = 0;                                  
146       a_width = a_scale;                          
147       break;                                      
148                                                   
149     case ' ':                                     
150       a_number = 0;                               
151       a_width = a_scale/2;                        
152       break;                                      
153                                                   
154     default :                                     
155       a_number = 0;                               
156       a_width = a_scale;                          
157       break;                                      
158     }                                             
159   }                                               
160                                                   
161   static void greek_char_points(char a_char,fl    
162                                        int& a_    
163                                        float*     
164     switch(a_char) {                              
165     case 'A':extract(H_GREEK,H_UPPER,'A',a_sca    
166     case 'B':extract(H_GREEK,H_UPPER,'B',a_sca    
167     case 'C':extract(H_GREEK,H_UPPER,'C',a_sca    
168     case 'D':extract(H_GREEK,H_UPPER,'D',a_sca    
169     case 'E':extract(H_GREEK,H_UPPER,'E',a_sca    
170     case 'F':extract(H_GREEK,H_UPPER,'F',a_sca    
171     case 'G':extract(H_GREEK,H_UPPER,'G',a_sca    
172     case 'H':extract(H_GREEK,H_UPPER,'H',a_sca    
173     case 'I':extract(H_GREEK,H_UPPER,'I',a_sca    
174     case 'J':extract(H_GREEK,H_UPPER,'J',a_sca    
175     case 'K':extract(H_GREEK,H_UPPER,'K',a_sca    
176     case 'L':extract(H_GREEK,H_UPPER,'L',a_sca    
177     case 'M':extract(H_GREEK,H_UPPER,'M',a_sca    
178     case 'N':extract(H_GREEK,H_UPPER,'N',a_sca    
179     case 'O':extract(H_GREEK,H_UPPER,'O',a_sca    
180     case 'P':extract(H_GREEK,H_UPPER,'P',a_sca    
181     case 'Q':extract(H_GREEK,H_UPPER,'Q',a_sca    
182     case 'R':extract(H_GREEK,H_UPPER,'R',a_sca    
183     case 'S':extract(H_GREEK,H_UPPER,'S',a_sca    
184     case 'T':extract(H_GREEK,H_UPPER,'T',a_sca    
185     case 'U':extract(H_GREEK,H_UPPER,'U',a_sca    
186     case 'V':extract(H_GREEK,H_UPPER,'V',a_sca    
187     case 'W':extract(H_GREEK,H_UPPER,'W',a_sca    
188     case 'X':extract(H_GREEK,H_UPPER,'X',a_sca    
189     case 'Y':extract(H_GREEK,H_UPPER,'Y',a_sca    
190     case 'Z':extract(H_GREEK,H_UPPER,'Z',a_sca    
191                                                   
192     case 'a':extract(H_GREEK,H_LOWER,'A',a_sca    
193     case 'b':extract(H_GREEK,H_LOWER,'B',a_sca    
194     case 'c':extract(H_GREEK,H_LOWER,'C',a_sca    
195     case 'd':extract(H_GREEK,H_LOWER,'D',a_sca    
196     case 'e':extract(H_GREEK,H_LOWER,'E',a_sca    
197     case 'f':extract(H_GREEK,H_LOWER,'F',a_sca    
198     case 'g':extract(H_GREEK,H_LOWER,'G',a_sca    
199     case 'h':extract(H_GREEK,H_LOWER,'H',a_sca    
200     case 'i':extract(H_GREEK,H_LOWER,'I',a_sca    
201     case 'j':extract(H_GREEK,H_LOWER,'J',a_sca    
202     case 'k':extract(H_GREEK,H_LOWER,'K',a_sca    
203     case 'l':extract(H_GREEK,H_LOWER,'L',a_sca    
204     case 'm':extract(H_GREEK,H_LOWER,'M',a_sca    
205     case 'n':extract(H_GREEK,H_LOWER,'N',a_sca    
206     case 'o':extract(H_GREEK,H_LOWER,'O',a_sca    
207     case 'p':extract(H_GREEK,H_LOWER,'P',a_sca    
208     case 'q':extract(H_GREEK,H_LOWER,'Q',a_sca    
209     case 'r':extract(H_GREEK,H_LOWER,'R',a_sca    
210     case 's':extract(H_GREEK,H_LOWER,'S',a_sca    
211     case 't':extract(H_GREEK,H_LOWER,'T',a_sca    
212     case 'u':extract(H_GREEK,H_LOWER,'U',a_sca    
213     case 'v':extract(H_GREEK,H_LOWER,'V',a_sca    
214     case 'w':extract(H_GREEK,H_LOWER,'W',a_sca    
215     case 'x':extract(H_GREEK,H_LOWER,'X',a_sca    
216     case 'y':extract(H_GREEK,H_LOWER,'Y',a_sca    
217     case 'z':extract(H_GREEK,H_LOWER,'Z',a_sca    
218                                                   
219     default : latin_char_points(a_char,a_scale    
220     }                                             
221   }                                               
222                                                   
223 private:                                          
224   static void extract(int aType,int aCase,char    
225                              int& aN,int* a_mx    
226                              float* aX,float*     
227     int   count;                                  
228     int   npoly,ichr,iw,idif,ibit,kx,ky,iy0,ix    
229     float scale,size;                             
230     float max_x;                                  
231                                                   
232     ichr = 1;                                     
233     if    (aType==H_DIGIT) {                      
234       switch(aC) {                                
235       case '0':ichr= 1;break;                     
236       case '1':ichr= 2;break;                     
237       case '2':ichr= 3;break;                     
238       case '3':ichr= 4;break;                     
239       case '4':ichr= 5;break;                     
240       case '5':ichr= 6;break;                     
241       case '6':ichr= 7;break;                     
242       case '7':ichr= 8;break;                     
243       case '8':ichr= 9;break;                     
244       case '9':ichr=10;break;                     
245       }                                           
246     } else if (aType==H_ROMAN) {                  
247       switch(aC) {                                
248       case 'A':ichr=11;break;                     
249       case 'B':ichr=12;break;                     
250       case 'C':ichr=13;break;                     
251       case 'D':ichr=14;break;                     
252       case 'E':ichr=15;break;                     
253       case 'F':ichr=16;break;                     
254       case 'G':ichr=17;break;                     
255       case 'H':ichr=18;break;                     
256       case 'I':ichr=19;break;                     
257       case 'J':ichr=20;break;                     
258       case 'K':ichr=21;break;                     
259       case 'L':ichr=22;break;                     
260       case 'M':ichr=23;break;                     
261       case 'N':ichr=24;break;                     
262       case 'O':ichr=25;break;                     
263       case 'P':ichr=26;break;                     
264       case 'Q':ichr=27;break;                     
265       case 'R':ichr=28;break;                     
266       case 'S':ichr=29;break;                     
267       case 'T':ichr=30;break;                     
268       case 'U':ichr=31;break;                     
269       case 'V':ichr=32;break;                     
270       case 'W':ichr=33;break;                     
271       case 'X':ichr=34;break;                     
272       case 'Y':ichr=35;break;                     
273       case 'Z':ichr=36;break;                     
274       }                                           
275     } else if (aType==H_GREEK) {                  
276       switch(aC) {                                
277       case 'A':ichr=1 ;break;                     
278       case 'B':ichr=2 ;break;                     
279       case 'C':ichr=7 ;break;                     
280       case 'D':ichr=4 ;break;                     
281       case 'E':ichr=5 ;break;                     
282       case 'F':ichr=21;break;                     
283       case 'G':ichr=3 ;break;                     
284       case 'H':ichr=22;break;                     
285       case 'I':ichr=9 ;break;                     
286       case 'J':ichr=9 ;break;                     
287       case 'K':ichr=10;break;                     
288       case 'L':ichr=11;break;                     
289       case 'M':ichr=12;break;                     
290       case 'N':ichr=13;break;                     
291       case 'O':ichr=15;break;                     
292       case 'P':ichr=16;break;                     
293       case 'Q':ichr=8 ;break;                     
294       case 'R':ichr=17;break;                     
295       case 'S':ichr=18;break;                     
296       case 'T':ichr=19;break;                     
297       case 'U':ichr=20;break;                     
298       case 'V':ichr=22;break;                     
299       case 'W':ichr=24;break;                     
300       case 'X':ichr=14;break;                     
301       case 'Y':ichr=23;break;                     
302       case 'Z':ichr=6 ;break;                     
303       }                                           
304       ichr += 36;                                 
305     } else if (aType==H_SPECIAL) {                
306       switch(aC) {                                
307       case 'A':ichr=61;break;                     
308       case 'B':ichr=62;break;                     
309       case 'C':ichr=63;break;                     
310       case 'D':ichr=64;break;                     
311       case 'E':ichr=65;break;                     
312       case 'F':ichr=66;break;                     
313       case 'G':ichr=67;break;                     
314       case 'H':ichr=68;break;                     
315       case 'I':ichr=69;break;                     
316       case 'J':ichr=70;break;                     
317       case 'K':ichr=71;break;                     
318       case 'L':ichr=72;break;                     
319       case 'M':ichr=73;break;                     
320       case 'N':ichr=74;break;                     
321       case 'O':ichr=75;break;                     
322       case 'P':ichr=76;break;                     
323       case 'Q':ichr=77;break;                     
324       case 'R':ichr=78;break;                     
325       case 'S':ichr=79;break;                     
326       case 'T':ichr=80;break;                     
327       case 'U':ichr=81;break;                     
328       case 'V':ichr=82;break;                     
329       case 'W':ichr=83;break;                     
330       case 'X':ichr=84;break;                     
331       case 'Y':ichr=85;break;                     
332       case 'Z':ichr=86;break;                     
333       case '0':ichr=87;break;                     
334       case '1':ichr=88;break;                     
335       case '2':ichr=89;break;                     
336       case '3':ichr=90;break;                     
337       case '4':ichr=91;break;                     
338       case '5':ichr=92;break;                     
339       case '6':ichr=93;break;                     
340       case '7':ichr=94;break;                     
341       case '8':ichr=95;break;                     
342       case '9':ichr=96;break;                     
343       }                                           
344     } else if (aType==H_MATH) {                   
345       switch(aC) {                                
346       case '.':ichr= 97;break;                    
347       case ',':ichr= 98;break;                    
348       case '/':ichr= 99;break;                    
349       case '(':ichr=100;break;                    
350       case ')':ichr=101;break;                    
351       case '-':ichr=102;break;                    
352       case '+':ichr=103;break;                    
353       case '=':ichr=104;break;                    
354       case '*':ichr=105;break;                    
355       }                                           
356     }                                             
357                                                   
358     if (aCase==H_LOWER) ichr  += 105;             
359                                                   
360     // scale :                                    
361     size = a_scale;                               
362     if(size<0.001) size = 0.25F;                  
363     iy0   = 9;                                    
364     dky   = 21;                                   
365     if (aType==H_SPECIAL) rescale(ichr,iy0,dky    
366     scale = size/dky;                             
367                                                   
368     iw    = hs(ichr-1) - 1;                       
369     kx    = (hx(iw) % 64 ) - 32;                  
370     ky    = (hy(iw) % 64 ) - 32;                  
371     ibit  = 1;                                    
372     idif  = 1;                                    
373     ix0   = kx;                                   
374     // a character may be composed of many pol    
375     npoly  = 0;                                   
376     ipoint = 0;                                   
377     max_x  = 0;                                   
378     while(1) {                                    
379       count = 0;                                  
380       while(1) {                                  
381         ibit += 6;                                
382         idif *= 64;                               
383         if(ibit>=H_NBITMX) {                      
384           ibit  = 1;                              
385           idif  = 1;                              
386           iw    ++;                               
387         }                                         
388         kx    = ((hx(iw)/idif) % 64 ) - 32;       
389         ky    = ((hy(iw)/idif) % 64 ) - 32;       
390         if(kx==31) break;                         
391         aX[ipoint] = scale * (kx - ix0);          
392         aY[ipoint] = scale * (iy0 - ky);          
393         if (aX[ipoint] > max_x) max_x = aX[ipo    
394         ipoint ++;                                
395         count  ++;                                
396       }                                           
397       // got one polyline :                       
398       a_mx_point[npoly] = count;                  
399       npoly ++;                                   
400       if(ky==31) break;                           
401     }                                             
402     aN = npoly;                                   
403     a_width = max_x;                              
404   }                                               
405                                                   
406   static void rescale(int aIchr,int& aIy0,int&    
407     int iw,ibit,idif,kx,ky,kymin,kymax;           
408                                                   
409     iw    = hs(aIchr-1) - 1;                      
410     kymin = 100;                                  
411     kymax = -100;                                 
412     ibit  = 1;                                    
413     idif  = 1;                                    
414     while(1) {                                    
415       while(1) {                                  
416         ibit += 6;                                
417         idif *= 64;                               
418         if(ibit>=H_NBITMX)        {               
419           ibit  = 1;                              
420           idif  = 1;                              
421           iw    ++;                               
422         }                                         
423         kx    = ((hx(iw)/idif) % 64 ) - 32;       
424         ky    = ((hy(iw)/idif) % 64 ) - 32;       
425         if(kx==31) break;                         
426         if(ky>kymax) kymax = ky;                  
427         if(ky<kymin) kymin = ky;                  
428       }                                           
429       if(ky==31) break;                           
430     }                                             
431     //output :                                    
432     aIy0 = kymax;                                 
433     aDky = 21;                                    
434     if(kymin<kymax)  {                            
435       aDky = kymax-kymin;                         
436     }                                             
437   }                                               
438                                                   
439 private: //data                                   
440   static int hx(unsigned int a_index) {           
441      static const int s_hx[751] =                 
442     {0x1969C7D6,0x217DC699,0x269E79A4,0x00FDF8    
443      0x1C6DA696,0x2696489E,0x27663966,0x000000    
444      0x1A6DE864,0x00000FD9,0x3FA198D6,0x0003F8    
445      0x1E8649A7,0x00FD969B,0x208A5996,0x1B69A6    
446      0x3F69B760,0x19FDD9D6,0x00000FE7,0x1A69B7    
447      0x1965A6DE,0x258DF71A,0x1E8A59A6,0x000000    
448      0x2381F71A,0x239669A5,0x3F69B7A0,0x20FD88    
449      0x279E6962,0x19FE2966,0x279E6962,0x3F6629    
450      0x1F75B699,0x3FA27963,0x19FD9655,0x279A58    
451      0x1AFDA696,0x3F89AFE7,0x0003F9DA,0x1AFDA6    
452      0x1969B75F,0x1F75B699,0x28A27963,0x00FE88    
453      0x00FE081C,0x228E4918,0x1A6DC7A0,0x00000F    
454      0x1AFDA696,0x00000FE6,0x18FD8614,0x3F828F    
455      0x3F9E7FE7,0x1969C795,0x1C699618,0x279A48    
456      0x19FD9655,0x279E6962,0x3F662966,0x1969C7    
457      0x249A7A28,0x2787F7A2,0x0000003F,0x19FD96    
458      0x0003F9E0,0x1E8A59D6,0x1B69965B,0x279A58    
459      0x19FE0818,0x00000FE7,0x1C699655,0x279A48    
460      0x00000FE0,0x20FDB594,0x3F960FDB,0x0003F9    
461      0x3F820617,0x0003F828,0x19FD99D6,0x3F9D9F    
462      0x19FD9655,0x279E6962,0x19FE2966,0x279E69    
463      0x00000FE6,0x20FD8817,0x3FA18FE8,0x1AFDA6    
464      0x19FD99D6,0x3F9D9FE7,0x27FD9655,0x3F9D9F    
465      0x279A489E,0x249A7A28,0x2377F7A2,0x000000    
466      0x3F9DEFD9,0x20FD8817,0x00000FE8,0x18FD86    
467      0x19FD9655,0x3F9E7FE7,0x1DFE7657,0x3F9D9F    
468      0x279A489E,0x249A7A28,0x0003F7A2,0x27FD96    
469      0x279E6962,0x3F662966,0x3F660657,0x2767F9    
470      0x00000FE7,0x1B699657,0x2081F79D,0x259A79    
471      0x1A65969B,0x2696279B,0x229669E7,0x00000F    
472      0x17FE0815,0x1C6DA658,0x2696485F,0x00FE9A    
473      0x269E79A4,0x0003F9E3,0x18FE0814,0x3FA18F    
474      0x268A279E,0x3F7A28A6,0x22FDE796,0x26966F    
475      0x3F9E58DD,0x258DD6D9,0x229679E6,0x1A6596    
476      0x3F82181F,0x27FDA856,0x3FA1AFE0,0x0003F9    
477      0x2696489E,0x20824966,0x2181F83F,0x00000F    
478      0x1D7A0862,0x228E4FDC,0x1B75E7E0,0x175965    
479      0x207E0FE0,0x0003F821,0x2181F81B,0x1F821F    
480      0x3FA18A14,0x1EFDD759,0x3F91DFDE,0x0003F9    
481      0x0003F8DC,0x3F6E56D8,0x256FF95B,0x000000    
482      0x1F7E0FDF,0x218A2860,0x218A285D,0x3F81F7    
483      0x0000003F,0x22860799,0x1F7E0862,0x21860F    
484      0x3F821860,0x2181F7E1,0x1E8218A2,0x000000    
485      0x0000003F,0x1865C814,0x1F75B658,0x27920F    
486      0x22860FDE,0x00FE27BF,0x1C79F814,0x196186    
487      0x249A7A28,0x00000FE0,0x1769E814,0x299A28    
488      0x0000003F,0x26922814,0x26A29A68,0x2387F8    
489      0x1869C7FF,0x1C6985D7,0x1F83F81E,0x22860F    
490      0x208A49A7,0x165D869E,0x207D85D6,0x1C7A08    
491      0x0000003F,0x27FE7655,0x00000FD9,0x1DFDA9    
492      0x228A3FE6,0x259A6963,0x00000FE3,0x258E28    
493      0x196DD7A2,0x16555597,0x1E75B657,0x00000F    
494      0x3F7E18E4,0x1E7BF75D,0x20FDF7FF,0x3F861F    
495      0x2491C71C,0x3F75DFDC,0x1F7FF79E,0x21FE08    
496      0x2095B81B,0x20FDD83F,0x3F7E0FE3,0x0003F8    
497      0x3F860FDD,0x0003F7E0,0x1A99C81A,0x2083F8    
498      0x0003F9A0,0x3F9A9993,0x17FE3A23,0x00000F    
499      0x00000FE0,0x3F697693,0x18FDD61D,0x00000F    
500      0x00000FE0,0x2181F81B,0x00FDF821,0x2181F8    
501      0x3F7E0861,0x00FD7A55,0x1E822919,0x2281E7    
502      0x1E8228E3,0x00000FDC,0x00FE95D3,0x17FE08    
503      0x00000FE9,0x1BFE0818,0x3F6E5FE5,0x1D75E8    
504      0x3F82079B,0x2385F75B,0x3F8DD8A3,0x2385F7    
505      0x0000003F,0x21FE185B,0x0003F91C,0x207DD7    
506      0x1D7A089B,0x238A079D,0x3F75E822,0x1DFDF8    
507      0x1F8638E1,0x1F75D7FF,0x3F8638E1,0x1E8228    
508      0x26FE6997,0x1B75F8A4,0x1F75B69A,0x00FE69    
509      0x218E59A6,0x00FDA71E,0x1F8A4997,0x1B69A6    
510      0x26FE6997,0x1B75F8A4,0x1F75B69A,0x00FE69    
511      0x1F75B69A,0x00FE6922,0x2086395B,0x3F91DF    
512      0x1B75F8A4,0x1F75B69A,0x00FE6922,0x1BFDB6    
513      0x208607DC,0x3F820FDF,0x218A181B,0x20861F    
514      0x3F99FFDB,0x00FE081C,0x15FD5551,0x207DD6    
515      0x1BFDB6D7,0x2696381E,0x00000FE6,0x1A6DD7    
516      0x00FDF8A4,0x1AFDA696,0x258E179C,0x218E59    
517      0x1B75F8A4,0x1F75B69A,0x00FE6922,0x1DFDD7    
518      0x2379C6DC,0x229669A5,0x00FDB71F,0x238608    
519      0x26FE68E1,0x00000FE6,0x26FE0698,0x00000F    
520      0x0003F928,0x26FE66D8,0x00000FDB,0x26FE06    
521      0x1BFDB998,0x3F99BFE6,0x1A6DD7D6,0x1E71A6    
522      0x3FA279A5,0x1D7E18D7,0x3F65A6DC,0x269E79    
523      0x1C75F863,0x00000FDB,0x1D71A617,0x208618    
524      0x1B75F897,0x1E71B69A,0x259648A0,0x1F7E08    
525      0x3F85E75D,0x1C6DB761,0x3F96385E,0x1F7E08    
526      0x228A179C,0x00FDE7E1,0x1C6985D6,0x3F69C7    
527      0x1B657595,0x1C6DB71C,0x248E17DD,0x239669    
528      0x1D75E81A,0x3F8E281E,0x27FD9757,0x1D7E39    
529      0x1E75B658,0x3F6A0FE6,0x1CFD7756,0x217DD6    
530      0x00000FEA,0x1B71D697,0x259A7FDA,0x3F69D8    
531      0x1F75D7A0,0x1E8BF922,0x2175B6DC,0x3F7A08    
532      0x259A6963,0x00FE08A4,0x23FDA795,0x17FE69    
533      0x2696385F,0x208A4966,0x3F5DB71E,0x1B75FA    
534      0x00FE18E4,0x18FDE856,0x00FE875A,0x1C6985    
535      0x00000FE7,0x1865B755,0x1F71A658,0x28A279    
536      0x2375B657,0x27A3F9E5,0x3F6196E5,0x15FDC9    
537      0x29A26922,0x0000003F,0x1761A714,0x1D6D96    
538      0x00FE69E8,0x1BFE0818,0x3F95BFE5,0x00FE08    
539      0x0000003F,0x22FDF7D9,0x24925FE2,0x1C7A39    
540      0x1C75F8A4,0x3F71D75C,0x21FE081E,0x21820F    
541      0x3F91DFE1,0x0003F91D,0x3F6E56D8,0x238607    
542      0x0003F821,0x279E6997,0x20862926,0x23FDD7    
543      0x00000FDA,0x2186081E,0x21820FE0,0x0003F8    
544      0x00FE0861,0x3F95B958,0x1FFDE79B,0x3F8DEF    
545      0x3F89DFE2,0x0003F89D,0x3F95B958,0x256FF9    
546      0x1E7FF860,0x1EFE087F,0x1E82185F,0x1E7E18    
547      0x00FE17DE,0x228A17DB,0x2287F7E0,0x22FE07    
548      0x22FDF83F,0x2281FFE1,0x00FDF862,0x3F81A5    
549      0x217DE795,0x1657F8A2,0x1B69A658,0x269A58    
550      0x3F86285F,0x20FE0818,0x3F860FDF,0x1F83F8    
551      0x20FE487F,0x1EFD869C,0x2483F61A,0x268BFA    
552      0x238E283F,0x3F8E283F,0x20FE0818,0x3F820F    
553      0x2183F79F,0x2281EFE2,0x1B71E83F,0x259228    
554      0x3F69965A,0x279A48A0,0x1E73F9A7,0x20FE48    
555      0x279A58E2,0x1BFE6A28,0x3F96381D,0x20FDF8    
556      0x27A27967,0x218E48E5,0x1B75C75F,0x196D96    
557      0x218A391A,0x1D71C760,0x1E821860,0x2385F7    
558      0x00000FDD,0x29AABAD7,0x1A761926,0x1A6175    
559      0x24967A16,0x1C79F862,0x1961865B,0x217DE7    
560      0x1969C7D9,0x217DC699,0x269E79A4,0x00FDF8    
561      0x209D9819,0x0000003F,0x2681A81A,0x00000F    
562      0x0003F822,0x239A3897,0x23963FE2,0x00FE56    
563      0x00FE281E,0x1D69D797,0x1D6DDFDE,0x00FE66    
564      0x00FE281E,0x2182085E,0x0003F821,0x218608    
565      0x0003F821,0x00FDC91B,0x1F7E089D,0x0003F8    
566      0x00FE471A,0x1CFE081A,0x00000FE4,0x1CFE47    
567      0x3F763FE3};                                 
568      return s_hx[a_index];                        
569   }                                               
570                                                   
571   static int hy(unsigned int a_index) {           
572      static const int s_hy[751] =                 
573     {0x1D61552A,0x29A68960,0x18760968,0x00FD45    
574      0x1559866A,0x18595514,0x29A5F71A,0x000000    
575      0x27A29A68,0x00000FE5,0x208A252A,0x0003FA    
576      0x29A689A3,0x00FE59E8,0x145155EA,0x2689D6    
577      0x3F89F75C,0x1482952A,0x00000FD4,0x195D55    
578      0x22967A29,0x1B71D7A0,0x145155D9,0x000000    
579      0x15514557,0x289606D7,0x3F9A8A69,0x148295    
580      0x1A616554,0x1E81E75C,0x258A07DE,0x3FA69A    
581      0x29A26921,0x3F926A29,0x1482952A,0x1C6575    
582      0x14829529,0x2079E814,0x0003FA69,0x148295    
583      0x1C657554,0x29A26921,0x21926A29,0x00FE18    
584      0x00FE9524,0x289E4528,0x249E8A69,0x00000F    
585      0x29829527,0x00000FE9,0x1482952C,0x20A548    
586      0x3FA54829,0x195D552B,0x289A485C,0x249A8A    
587      0x1482952A,0x1B616554,0x3F7DF79D,0x195D55    
588      0x155D9721,0x2B960514,0x0000003F,0x148295    
589      0x0003FA5E,0x145155EA,0x1C6D95D5,0x238607    
590      0x14829528,0x00000FD4,0x289A352B,0x239A8A    
591      0x00000FE9,0x1482952C,0x20A54829,0x0003FA    
592      0x20A5E529,0x0003F794,0x1482952A,0x3FA698    
593      0x1482952A,0x1A616554,0x1E81E75C,0x258A07    
594      0x00000FD4,0x14829529,0x3FA69829,0x148295    
595      0x1482952A,0x3FA69814,0x1482952B,0x3F79E8    
596      0x249A8A69,0x155D9721,0x1E7A0514,0x000000    
597      0x3FA5D822,0x14829529,0x00000FE9,0x148295    
598      0x1482952B,0x3FA54829,0x1E814529,0x3FA698    
599      0x249A8A69,0x155D9721,0x0003F514,0x148295    
600      0x1B616554,0x3F7DF79D,0x20A5E529,0x29A605    
601      0x00000FD4,0x14557669,0x296D7554,0x145576    
602      0x2281D6DA,0x228E4923,0x1969B760,0x00000F    
603      0x1A82952B,0x2285F6DA,0x1F8628E3,0x00FDA6    
604      0x2279A5D5,0x0003FA69,0x2082962C,0x3FA698    
605      0x228A69A2,0x3F69A79E,0x1082D42A,0x196178    
606      0x208A07DD,0x1F79C6D9,0x29A268A0,0x24966A    
607      0x3F9E8A68,0x1083042B,0x2075D830,0x0003F8    
608      0x18595514,0x227DD71A,0x28A689E0,0x00000F    
609      0x2CA1C615,0x1851282E,0x2FB6BA24,0x2DBAFC    
610      0x29A2781B,0x0003F9E8,0x1C75C6E5,0x28A688    
611      0x3FA605EC,0x10830427,0x20410830,0x0003FC    
612      0x0003FC30,0x2085D668,0x269A08A2,0x000000    
613      0x154D181F,0x1E71A617,0x289A48A0,0x20BEDA    
614      0x0000003F,0x14491427,0x1D6D9616,0x154D18    
615      0x20BEDAE9,0x289E58E1,0x30BEEB2A,0x000000    
616      0x0000003F,0x2179A5AC,0x259A6963,0x1E6968    
617      0x2A9E382A,0x00FEAAA0,0x165D972C,0x207595    
618      0x258A0759,0x00000FEA,0x2075856C,0x207585    
619      0x0000003F,0x269A58AC,0x1E7E18E5,0x1D7E07    
620      0x1F79E7E0,0x269A58E1,0x278A08A5,0x2A9E28    
621      0x289A379C,0x259E8A69,0x1B720863,0x155155    
622      0x0000003F,0x1982766B,0x00000FE7,0x198266    
623      0x258E2819,0x228E59A6,0x00000FE2,0x259238    
624      0x259648DD,0x1D7E18E4,0x1D71B6DC,0x00000F    
625      0x2071C75F,0x227A085F,0x1D823760,0x208DD8    
626      0x1C924724,0x208DD81C,0x237608DD,0x1D8237    
627      0x1A8E36A5,0x1D822760,0x208A0822,0x0003F8    
628      0x207A081E,0x0003F7A0,0x1E7A56A6,0x1A8206    
629      0x0003F7A0,0x208A07AD,0x2082581B,0x00000F    
630      0x00000FE9,0x208A07AD,0x2082581B,0x00000F    
631      0x00000FE8,0x155155A5,0x00FDA657,0x28A689    
632      0x3FB6CAA8,0x00FF042B,0x19552427,0x2EAE78    
633      0x2EAE789E,0x00000FF0,0x00FE082D,0x208295    
634      0x00000FE3,0x1D8266A8,0x3F8DD823,0x2179C6    
635      0x3F91B765,0x1C6DB725,0x3F92481E,0x1C6DB7    
636      0x0000003F,0x1B8246E5,0x0003F861,0x1E79F6    
637      0x1E71B6E5,0x218E48E1,0x3F85F79F,0x1B8246    
638      0x1B6DC79F,0x248E07E0,0x3F7E08E4,0x208607    
639      0x1E8296EA,0x1E71B6DC,0x29A268E1,0x00FE6A    
640      0x29A268E1,0x00FE6A29,0x1B6DC7A9,0x268E17    
641      0x1E82952A,0x1E71B6DC,0x29A268E1,0x00FE6A    
642      0x29A268E1,0x00FE6A29,0x18554527,0x3F6DB8    
643      0x1E71B6DC,0x29A268E1,0x00FE6A29,0x1F8295    
644      0x13515524,0x3FA5B814,0x13515525,0x2FB1B8    
645      0x3FA61825,0x00FE9524,0x1F8296EF,0x1F71B6    
646      0x1F8296EA,0x1F71B6DC,0x00000FE9,0x2179C6    
647      0x00FDB6DC,0x1E8306E9,0x1E71B6DC,0x29A268    
648      0x1E71B6DC,0x29A268E1,0x00FE6A29,0x218296    
649      0x2286079C,0x29A26963,0x00FE6A29,0x29A255    
650      0x1B825A29,0x00000FE9,0x1B8296E8,0x00000F    
651      0x0003FA5B,0x1B8296E9,0x00000FE9,0x1B8296    
652      0x1B8296E9,0x3FA6981B,0x2079C6EB,0x29A689    
653      0x3FA69A26,0x1B5D552A,0x20C2889E,0x1B6565    
654      0x27A29A68,0x00000FE4,0x1B6DC7AA,0x299207    
655      0x1E71B6E9,0x29A27921,0x208E6A29,0x155D96    
656      0x2086079C,0x289A48A1,0x3F9A8A69,0x175955    
657      0x2FB6BA67,0x00FEEC30,0x1B6DD7EA,0x20A627    
658      0x1B6DD7EA,0x289A379C,0x23968A69,0x145586    
659      0x289A26E5,0x3F967A69,0x1C8296E9,0x2181C6    
660      0x16554528,0x3FA5B829,0x1F8306EB,0x28A699    
661      0x00000FE5,0x2685B6E9,0x2079B829,0x3FA689    
662      0x217DD6DA,0x238A08A2,0x2CAA89A4,0x3FC30B    
663      0x1D8239A8,0x00FDB6DC,0x1B8296EB,0x1E8299    
664      0x239A8A69,0x1B6DC760,0x3FC2179C,0x1E71B6    
665      0x00FDB71D,0x1E8296EA,0x00FDB6DC,0x1B6DD7    
666      0x00000FDB,0x227DD72B,0x29A689E5,0x1D8239    
667      0x2E75B6E9,0x1D6E0C30,0x3FC2EAE0,0x1F8305    
668      0x1B7A39A8,0x0000003F,0x227DC6EB,0x28A69A    
669      0x00FDB71F,0x208266E8,0x3F9A6820,0x00FE56    
670      0x0000003F,0x1682A5A8,0x1B69A82A,0x1A6596    
671      0x249669A5,0x3F9248E3,0x1B8206E3,0x249238    
672      0x2079E825,0x0003F861,0x3F9A06A8,0x1C6DB7    
673      0x0003F8E3,0x176185E9,0x1D698596,0x178299    
674      0x00000FE9,0x1E7DF7A3,0x2492381E,0x0003F8    
675      0x00FE7963,0x3F9A06A8,0x1682A5A5,0x205968    
676      0x2059682A,0x0003FAAA,0x2085D668,0x269A08    
677      0x1A5E079C,0x1881F720,0x207DE71A,0x289A48    
678      0x00FEAA68,0x1A6175A6,0x1A5E079C,0x1881F7    
679      0x26824860,0x26922829,0x00FEAA68,0x2095D7    
680      0x145155EB,0x26A205D5,0x1865E8A4,0x1E6585    
681      0x3FA29AAA,0x218216E8,0x20AA182A,0x186E0A    
682      0x1B815620,0x1A81B659,0x196E06DA,0x1A6A06    
683      0x2075C6E0,0x3F81D6E0,0x1C8195E8,0x208E18    
684      0x17560617,0x185D8818,0x1C75C660,0x1C75C6    
685      0x208A1822,0x208A285E,0x228A08A1,0x238228    
686      0x27A289E6,0x288289E5,0x3FA289E8,0x2782A9    
687      0x1B7608A2,0x155986DA,0x1A6D8595,0x228A07    
688      0x23860826,0x20863924,0x1B6DC79F,0x248E17    
689      0x00000FE3,0x218E6A2B,0x1D71C75E,0x238A17    
690      0x238E282A,0x1C75E862,0x2281F75C,0x1E8628    
691      0x1F71A667,0x279E6921,0x1C7E1926,0x00FD96    
692      0x18924627,0x0000003F,0x20AA05A6,0x00000F    
693      0x0003F5DD,0x2281E769,0x2281E823,0x00FE08    
694      0x00FDD6DD,0x2281E769,0x2281E823,0x00FE08    
695      0x00FE3963,0x1B6DC723,0x0003F7DD,0x239248    
696      0x0003F9E5,0x00FE56A5,0x2179C6A4,0x0003F9    
697      0x00FE0826,0x20824726,0x00000FE0,0x2281E7    
698      0x3F89E822};                                 
699     return s_hy[a_index];                         
700   }                                               
701   static int hs(unsigned int a_index) {           
702      static const int s_hs[210] =                 
703     {  1,  5,  7, 11, 15, 17, 21, 26, 28, 35,     
704       58, 60, 65, 67, 68, 71, 73, 75, 78, 80,     
705      105,108,110,113,115,117,119,121,126,128,1    
706      144,146,148,151,153,155,160,162,165,168,1    
707      189,191,192,195,204,206,209,210,215,222,2    
708      239,248,257,260,267,273,278,288,296,298,3    
709      333,338,341,344,347,350,352,354,356,357,3    
710      370,373,374,376,380,382,385,388,390,394,3    
711      417,419,424,427,429,432,434,435,439,442,4    
712      462,465,467,470,472,475,477,482,489,493,4    
713      519,523,525,530,533,539,543,546,550,554,5    
714      578,580,581,584,591,594,597,598,602,608,6    
715      624,632,640,643,650,663,682,691,696,698,7    
716      719,722,725,728,731,734,736,738,740,741,7    
717     return s_hs[a_index];                         
718   }                                               
719                                                   
720                                                   
721                                                   
722 };                                                
723                                                   
724                                                   
725 }                                                 
726                                                   
727 #endif