In front of the algorithm to generate the Taoist Taiji gossip map, this section sends a Buddhist-related swastika map. Swastika Sanskrit Svastika, Wu Zetian tuning for million words; the free translation for auspicious sea cloud, auspicious XI-yun, one of the Buddha 32 phase, is also one of 80 kinds of good, this is manifested in Buddha and 10 of the Buddha caps and other places of the German Long and a large book of the Scriptures, the great Nicho, said the scrolls six, the Great wisdom Scrolls 381 and so on are recorded Buddha chest, foot, waist and other places have the swastika word. This Indian Amos Ravana (Ama-ravati) unearthed Buddha foot stone, also engraved with a number of swastika characters. Nazi Germany's Nazi Party logo for Hitler borrowed the Peugeot, but the direction of the Nazi Party logo is oblique and black, while the traditional belief in the symbol of auspicious good swastika than characters is bright color.
Buddhism into the Chinese land, the swastika and 卐 also spread to China, and the swastika and 卐 also into the Chinese culture, since then there is a 卐 in Chinese characters in the swastika. In fact, this 卐 swastika is a word "million" and is symmetrical, 卐 is right-handed (representing the chest cross to his right hand rotation), the swastika is left (representing the chest of the cross to its own hand rotation).
the algorithm for generating swastika is much easier than gossip, and the whole idea is to create a large rectangle, and then use four small rectangles to snap it out of place where it is not needed. The code is as follows:
1 structRect2 {3 floatLeft ;4 floatRight ;5 floattop;6 floatBottom;7 };8 9InlineBOOLIsinrect (Constrect& Rect,floatXfloaty)Ten { One return(x >= rect.left && x <= rect.right && y >= rect.top && y <=rect.bottom); A } - -UnsignedintCpixelsvastikaleft::calculatepixel (unsignedintX, unsignedinty) the { - floatSize = m_params[0]; - floatwidth = m_params[1]; - floatAngle = m_params[2]*pi/ the; + -UnsignedintBlack =0xff000000; +UnsignedintGray =0xff808080; A at floati = x-512.0f; - floatj = y-512.0f; - -Rect rect = {-size, size,-size, size}; -Rect Rtleft = {-size,-width*0.5f,-size + width,-width*0.5f}; -Rect rttop = {width*0.5f, Size-width,-size,-width*0.5f}; inRect rtright = {width*0.5f, size, width*0.5f, Size-width}; -Rect Rtdown = {-size + width,-width*0.5f, width*0.5f, size}; to + float_s =sinf (angle); - float_c =COSF (angle); the floatti, TJ; * $TI = i*_c-j*_s;Panax NotoginsengTJ = i*_s + j*_c; - the if(!isinrect (Rect, TI, TJ)) + { A returnGray; the } + Else if(Isinrect (Rtleft, TI, TJ) | | -Isinrect (Rttop, TI, TJ) | | $Isinrect (Rtright, TI, TJ) | | $ isinrect (Rtdown, TI, TJ)) - { - returnGray; the } - Wuyi returnBlack; the}
The 卐 word in the other direction only needs to make the following changes to the above code:
Rect Rtleft = {-size,-width*0.5f, width*0.5f, size- width}; Rect rttop = {-size + width,-width*0.5f,-size,-width*0.5f}; = {width*0.5f, size,-size + width,-width*0.5f}; Rect Rtdown = {width*0.5f, Size-width, width*0.5f, size};
Software: Why mathematical image Generation tool, in the software can adjust the width and rotation of the swastika, as shown in:
Algorithms generate 卐 and swastika plots