The previous article is an algorithm to generate a piece of Taiji figure, saying goes: The induction of Tai Chi, Tai Chi Sheng Two, two Miriam born four elephant, four elephant gossip. Then this section creates a gossip chart for Tai Chi. Although I have no research on this convoluted philosophy of the I Ching, but at least Gossip can be seen as the originator of the binary. May tai Chi Gossip bless our program there is no bug, never modify.
According to the provisions of the binary number: there, with 1, no, 0 means. We can draw the gossip of the two numbers of the Yang Yao and Yin Yao. Below we write the gossip of the two numbers of the Yang Yao (that is, the Yang Yao is 1, no Yang Yao is 0):
Kun: Black black black, gua Yin Yin Yin, binary number is 000
Burgundy: Black black and white, Gua Yin Yin Yang, binary number is 001
Hom: Black and white, Gua Yin and Yang Yin, binary number is 010
Sunda: Black black and white, Gua Yin Yang, binary number is 011
Shock: white black black, gua Fu Yang Yin Yin, binary number is 100
From: white black and white, gua Fu Yang Yin and yang, binary number is 101
Against: white black, Gua Fuyangyang Yin, the binary number is 110
Dry: White in vain, gua Yangyangyang, binary number is 111.
In the same way, we can write the binary number of the eight (i.e., the Yin Yao 1, no Yin Yao 0):
Kun: Black black black, gua Yin Yin Yin, binary number is 111
Burgundy: Black black and white, Gua Yin Yin Yang, binary number is 110
Hom: Black and white, Gua Yin and Yang Yin, binary number is 101
Sunda: Black black and white, Gua Yin Yang, binary number is 100
Shock: white black black, gua Fu Yang Yin Yin, binary number is 011
From: white black and white, gua Fu Yang Yin and yang, binary number is 010
Against: white black, Gua Fuyangyang Yin, the binary number is 001
Dry: White in vain, gua Yangyangyang, binary number is 000
OK, or the post code is actually some:
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 } - -UnsignedintCpixeltaijieight::calculatepixel (unsignedintX, unsignedinty) the { - floatRadius1 =360.0f; - floatRadius2 =60.0f; - floatHeight =18.0f; + - floatRR = radius1*Radius1; + AUnsignedintBlack =0xff000000; atUnsignedintWhite =0xFFFFFFFF; -UnsignedintGray =0xff404040; -UnsignedintDise =0xffc0c0c0; - - floati = x-512.0f; - floatj = y-512.0f; in - Const floatSqrt2 = Sqrtf (2.0f)*0.5f; to + if((I*i + j*j) >RR) - { the //Gossip map *Rect Rt1 = {-radius1*0.4f, radius1*0.4f,-radius1-height*7,-radius1-height*6}; $Rect Rt2 = {-radius1*0.4f, radius1*0.4f,-radius1-height*5,-radius1-height*4};Panax NotoginsengRect RT3 = {-radius1*0.4f, radius1*0.4f,-radius1-height*3,-radius1-height*2}; - theRect RTC1 = {-radius1*0.06f, radius1*0.06f,-radius1-height*7,-radius1-height*6}; +Rect rtc2 = {-radius1*0.06f, radius1*0.06f,-radius1-height*5,-radius1-height*4}; ARect RTC3 = {-radius1*0.06f, radius1*0.06f,-radius1-height*3,-radius1-height*2}; the + floatlist_sin[8] = {0.0f, Sqrt2,1.0f, Sqrt2,0.0f,-sqrt2,-1.0f, -Sqrt2}; - floatlist_cos[8] = {1.0f, Sqrt2,0.0f,-sqrt2,-1.0f,-sqrt2,0.0f, sqrt2}; $ intlist_eight[8] = {0,1,2,3,7,6,5,4}; $ - floatti, TJ; - for(intm =0; M <8; m++) the { -TI = i*list_cos[m]-j*List_sin[m];WuyiTJ = I*list_sin[m] + j*List_cos[m]; the - if(Isinrect (Rt1, TI, TJ)) Wu { - if(List_eight[m] &0x1) About { $ if(Isinrect (Rtc1, TI, TJ)) - { - returndise; - } A } + the returnGray; - } $ the if(Isinrect (Rt2, TI, TJ)) the { the if(List_eight[m] &0x2) the { - if(Isinrect (Rtc2, TI, TJ)) in { the returndise; the } About } the the returnGray; the } + - if(Isinrect (Rt3, TI, TJ)) the {Bayi if(List_eight[m] &0x4) the { the if(Isinrect (Rtc3, TI, TJ)) - { - returndise; the } the } the the returnGray; - } the } the the returndise;94 } the Else the { the //Taiji Yin-Yang diagram98 About floatT = j + radius1*0.5f; - floattt = t*t + i*i;101 if(TT < radius2*radius2)102 {103 returnWhite ;104 } the Else if(TT < rr*0.25f)106 {107 returnBlack;108 }109 thet = j-radius1*0.5f;111tt = t*t + i*i; the if(TT < radius2*radius2)113 { the returnBlack; the } the Else if(TT < rr*0.25f)117 {118 returnWhite ;119 } - 121 if(I <0.0f)122 {123 returnWhite ;124 } the Else126 {127 returnBlack; - }129 } the 131}
The resulting image is as follows:
Finally may this gossip chart bless us to write the program absolutely no bug, never modified, agreed to the point of recommendation.
Related articles:
The beauty of the algorithm---100 images generated by the program, there is always a piece that makes you feel amazing [top]
The beauty of the algorithm---100 images generated by the program, there is always a piece that makes you feel amazing [next]
Algorithm generates Taiji gossip chart