Algorithm generates N-Mount star

Source: Internet
Author: User

The first two image generation algorithms are: Taoist Taiji gossip and Buddhist 卐 and swastika charts. This section of the entire foreign flavor Image: Mount star. I hope I don't summon any horrible taboos. Usually see fantasy novels, often read about the six Mans star, seven Mans star, nine mans star technique. The Mans star is a two-dimensional figure composed of several complete isosceles triangle (sometimes positive triangles) and a regular polygon. The number of isosceles triangle is equal to the number of sides of regular polygon. The graph consists of five isosceles triangle and positive Pentagon called "pentagram" (commonly known as star). A graph of six isosceles triangle and positive hexagons is called the "six Mans Star" ... And so on The Mans star has great use in aesthetics, history and divination.

Mount Star in life and we are closely related, we often say that "pentagram" is also a kind of awn star. The five vertices of the pentagram represent different elements, namely, the fifth element of the land, water, fire, wind and the symbol of the human spirit, and the pentagram is a symbol often used in magic, because its entirety is like a person's body, the top point is the head, the rest is the limbs. In the Bible, man is the creator, and the pentagram also contains the meaning of creation, which corresponds to the four elements and the human body. When the vertex points to the day, it represents the holy power.

Tantrism that the six-pointed star-shaped triangle is the symbol of Cally Mar "female yin" symbol, in addition to the inverted triangle, it is also expressed as fish, both ends of the sharp oval, horseshoe, egg and other graphics. Thus the inverted triangle is called "the image of the female Yin", "Yoni Yantra", where "Yantra" is the "image of meditation" that the Tantrism faction considers to be the image of the eye, and "the image that applies to the ear"-"mantra" (mantra-Mandala, Symbol for the eight leaf rosettes flowers) each other as a table. Inverted triangles represent the source of all things-the mother of the universe, a vessel that fills the body of the universe with bodily fluids (power).

In the West, 7 is considered to be a magical number. The more complex of the mans, the more powerful the pattern of the power. Information about the seven-awn star: 1. Seven the awn is difficult to draw accurately, because the Seven Mans star is an "uneven but stable one" 2. Seven mans star is divided into "positive seven Mans star" and "Inverse Seven Awn star" 3. There are also various opinions about the "seven-Star Magic array" 4. Seven the powers of the Magic array of the stars are not recorded much, only that they can be used to summon power. So no magician or warlock dared to use it, so the seven-mans star became taboo. The legend of a stroke of the perfect seven stars of the people said to see the blazing Archangel Michael, some said to see the hell of the Devil's Road West Law, some people said to see the heaven of the Tree of life, and even some people said to see the end.

The eight-awn star and the 卐 character symbol are the cultural symbols which are scattered in many nationalities in our country. Some scholars believe that the mysterious 卐 character is actually a simplified variant of the octagonal star pattern, which all represent the sun's apparent cycle movement in a year of regression, that is, the cycle of the seasons. The star is reminiscent of a compass, a six-point instrument, and a rudder, like a sword towards the octagon. The eight angles of the octagonal star represent eight directions, meaning the absolute chaos or eight forms of chaotic energy (the earth and Water Volcano Ze).

This article provides two sets of algorithms to generate the awn, first look at the first one:

voidCpixelnstar::resetn () {m_n= (unsignedint) m_params[0]; if(M_n <5) {M_n=5; }    Else if(M_n > +) {M_n= +; }        floatRadius =400.0f;  for(unsignedinti =0; i < m_n; i++) {m_listpoints[i].x= Radius*sinf ((I-0.5f)*2*pi/m_n); M_listpoints[i].y= RADIUS*COSF ((I-0.5f)*2*pi/m_n); }}unsignedintCpixelnstar::calculatepixel (unsignedintX, unsignedinty) {unsignedintRed =0xffff0000; unsignedintYellow =0xffffc000; unsignedintGray =0xff808080; VEC2 P (x-512.0f, Y-512.0f); BOOLBcenter =true;  for(unsignedinti =0; i < m_n; i++) {Vec2& v =M_listpoints[i]; VEC2& vL1 = m_listpoints[(i + m_n-1)%M_n]; VEC2& vL2 = m_listpoints[(i + m_n-2)%M_n]; VEC2& vR1 = m_listpoints[(i +1)%M_n]; VEC2& vR2 = m_listpoints[(i +2)%M_n]; if(!Ispointinangle (vL2, V, vR2, P)) {Bcenter=false; }        Else if(Issameside (vL1, vR1, V, P)) {returnRed; }    }      returnBcenter?Yellow:gray;}

The resulting images are:

Five Mans star

Six Awn star

Seven Mans star

The eight-awn star

Nine Mans star

Ten Mans Star

11 Mt Star

12 Mt Star

13 Mt Star

23 Mt Star

On the definition of structural body Vec2 See : the optimal algorithm for judging points in a triangle on two-dimensional plane

The second algorithm is:

voidCpixelnlightstar::resetn () {m_n= (unsignedint) m_params[0]; if(M_n <3) {M_n=3; }    Else if(M_n > +) {M_n= +; }         for(unsignedinti =0; i < m_n; i++) {M_list_sin[i]= Sinf ((I-0.5f)*2*pi/m_n); M_list_cos[i]= COSF ((I-0.5f)*2*pi/m_n); }}unsignedintCpixelnlightstar::calculatepixel (unsignedintX, unsignedinty) {    floatRadius = m_params[1]; floatH = radius*m_params[2]; unsignedintRed =0xffff0000; unsignedintYellow =0xffffc000; unsignedintGray =0xff808080; floati = x-512.0f; floatj = y-512.0f; floatdis = sqrtf (i*i + j*j); if(Dis < RADIUS*COSF (pi/m_n)) {        returnRed; }    Else if(Dis > Radius +h) {returnGray; } Vec2 Tri0 (0.0f, Radius +h); VEC2 Tri1 (Radius*m_list_sin[0], radius*m_list_cos[0]); VEC2 Tri2 (Radius*m_list_sin[1], radius*m_list_cos[1]);    VEC2 P; BOOLBcenter =true;  for(unsignedintm =0; M < m_n; m++) {p.x= I*m_list_cos[m]-j*M_list_sin[m]; P.Y= I*m_list_sin[m] + j*M_list_cos[m]; if(Ispointintriangle (Tri0, Tri1, Tri2, P)) {returnYellow; }    }    if(Dis <radius) {        returnRed; }      returnGray;}

The algorithm can be used to set the height of the radius length and angle of the awn to produce a more diverse mount star:

corresponding software:

Why Math image Generation tool

I have previously written a pictorial representation of the Awn star:

Math Graphics (1.30) stars

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 N-Mount star

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.