"Blue Sky" once represented China, especially in the hard times of the anti-Japanese war. At that time, the Reds into the national revolutionary, wearing blue Sky cap badge, the National People unite in the "Blue Sky Everywhere Red" banner, singing "volunteer March", struggling against Japan, defeated Japanese imperialism. "Blue Sky" symbolizes the sufferings and struggles of the Chinese people, together with the "volunteer March", encouraging the Chinese to unite to win and condense the feelings of the Chinese people.
Cyan represents the light purity, the nation and the freedom; white stands for frankness, civil rights and equality; The 12 rays of the day represent 12 months a year, 12 hours a week, a symbol of the lifeblood of the country, the life of the world as time goes on, and encourage the people to keep up with the times and strive for self-improvement. Blue Sky, take like the United States, the Republic of China for the Far East, the Sunrise East is the most, and blue sky, showing the light is according to the meaning of freedom and equality. The code is as follows:
1 classCpixelblueskywhitesun: Publicipixelequation2 {3 Public:4 Cpixelblueskywhitesun ()5 {6M_width =1680;7M_height =1120;8 9 for(inti =0; I < A; i++)Ten { OneM_list_sin[i] = Sinf (i*pi/6); AM_list_cos[i] = COSF (i*pi/6); - } - } the - Const Char* GetName ()Const - { - return "Blue Sky White Sun"; + } - +UnsignedintCalculatepixel (unsignedintX, unsignedinty); A at Private: - floatm_list_sin[ A]; - floatm_list_cos[ A]; -};
Cpp
1UnsignedintCpixelblueskywhitesun::calculatepixel (unsignedintX, unsignedinty)2 {3UnsignedintRed =0xffff0000;4UnsignedintWhite =0xFFFFFFFF;5UnsignedintBlue =0xff0000ff;6 7 floatW = m_width*0.5f;8 floatH = m_height*0.5f;9 Ten if((float) x > W | | (float) y >h) One { A returnRed; - } - the floatCX = w*0.5f; - floatCY = h*0.5f; - floatRadius = cy*0.5f; -VEC2 Tri0 (0.0f,-radius*1.65f); +VEC2 Tri1 (-radius*0.2f,-radius*1.05f); -VEC2 Tri2 (radius*0.2f,-radius*1.05f); + Vec2 P; A at floati = x-CX; - floatj = y-CY; - - floatdis = sqrtf (i*i + j*j); - - if(Dis <radius) in { - returnWhite ; to } + Else if(Dis > radius*1.65f) - { the returnBlue; * } $ Panax Notoginseng for(intm =0; M < A; m++) - { thep.x = i*m_list_cos[m]-j*M_list_sin[m]; +P.Y = i*m_list_sin[m] + j*M_list_cos[m]; A the if(Ispointintriangle (Tri0, Tri1, Tri2, P)) + { - returnWhite ; $ } $ } - - returnBlue; the}
The code for base class ipixelequation see: Why Mathematical image Generation tool
On the definition of structural VEC2 and its related functions see: The optimal algorithm for judging points in a triangle on two-dimensional plane
The code is not too elegant between the proportions of the graph, and the actual will be slightly inconsistent. The resulting image is as follows:
corresponding software:
Why Math image Generation tool
Related articles:
algorithm Generation Flag
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 blue sky everywhere red flag