devNote 12-27-2016 Compute Shader – Dualism

—————————————————————————————-

#pragma kernel CSMain

// Thread group size 
#define thread_group_size_x 32
#define thread_group_size_y 1
#define thread_group_size_z 1

struct Particle 
{
    float3      position;  
    float3      velocity; 
    float       speed;
};

int app_mode;

float  time;
float  pi;

float deltaTime;
float damping;									
float3 base;										// HANDLE.
float3 orbit;										// BOB
float targetStrength;								// POWER MAG
float orbit_weighting;                              // POWER RATIO BETWEEN HANDLE AND BOB
float radius_of_action;                             // RADIUS OF TROUGH / MOTE :) around ATTRACTOR
float zero_mirror_radius;

int attractor_Count;
float3 att_0;										
float3 att_1;
float3 att_2;										
float3 att_3;

float3 att_4;										
float3 att_5;
float3 att_6;										
float3 att_7;

float3 att_8;										
float3 att_9;
float3 att_10;										
float3 att_11;

float3 att_12;										
float3 att_13;
float3 att_14;										
float3 att_15;

float3 att_16;										
float3 att_17;
float3 att_18;										
float3 att_19;
	
float constVel;                                     

RWStructuredBuffer <Particle> particles;

[numthreads(thread_group_size_x, thread_group_size_y, thread_group_size_z )]

void CSMain ( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex )        
{
    int index = DTid.x;

    float3 velDeref;

    float3 vUp;
    vUp.y = 1;
    vUp.x = 0;
    vUp.z = 0;

    float3 att_Dir;
    float3 att_Perp;
    float3 att_A;
    float3 att_B; 
    float3 att_A_Dir;
    float3 att_B_Dir; 
    float  att_Dist;  
    
    float3 constVelz;
    constVelz.z = constVel;
    constVelz.x = 0;
    constVelz.y = 0;

    if(app_mode == 0) //Platonics Mode  MONAD
    {
        velDeref = particles[index].velocity;
           
        att_Dir  = normalize((att_0 - particles[index].position));

        att_Perp = normalize(cross(att_Dir, vUp));
        att_A = att_0 + 1.5*att_Perp;//add adjuster
        att_B = att_0 - 1.5*att_Perp;

        att_A_Dir = normalize(att_A - particles[index].position);
        att_B_Dir = normalize(att_B - particles[index].position);
        att_Dist  = distance(att_A, particles[index].position);

        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;
              
        if(attractor_Count != 1) //DIAD
        {
            att_Dir  = normalize((att_1 - particles[index].position));

            att_Perp = normalize(cross(att_Dir, vUp));
            att_A = att_1 + 1.5*att_Perp;
            att_B = att_1 - 1.5*att_Perp;

            att_A_Dir = normalize(att_A - particles[index].position);
            att_B_Dir = normalize(att_B - particles[index].position);
            att_Dist  = distance(att_A, particles[index].position);

            velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
            velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

            if(attractor_Count != 2) //TRIAD
            {
                att_Dir  = normalize((att_2 - particles[index].position));

                att_Perp = normalize(cross(att_Dir, vUp));
                att_A = att_2 + 1.5*att_Perp;
                att_B = att_2 - 1.5*att_Perp;

                att_A_Dir = normalize(att_A - particles[index].position);
                att_B_Dir = normalize(att_B - particles[index].position);
                att_Dist  = distance(att_A, particles[index].position);

                velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;
                
                if(attractor_Count != 3)  //TETRA
                {
                    att_Dir  = normalize((att_3 - particles[index].position));

                    att_Perp = normalize(cross(att_Dir, vUp));
                    att_A = att_3 + 1.5*att_Perp;
                    att_B = att_3 - 1.5*att_Perp;

                    att_A_Dir = normalize(att_A - particles[index].position);
                    att_B_Dir = normalize(att_B - particles[index].position);
                    att_Dist  = distance(att_A, particles[index].position);

                    velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                    velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                    if(attractor_Count != 4)  //OCTAHEDRON
                    {
                        att_Dir  = normalize((att_4 - particles[index].position));

                        att_Perp = normalize(cross(att_Dir, vUp));
                        att_A = att_4 + 1.5*att_Perp;
                        att_B = att_4 - 1.5*att_Perp;

                        att_A_Dir = normalize(att_A - particles[index].position);
                        att_B_Dir = normalize(att_B - particles[index].position);
                        att_Dist  = distance(att_A, particles[index].position);

                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                        //////////////////////////////////////////////////////////////////
                        att_Dir  = normalize((att_5 - particles[index].position));

                        att_Perp = normalize(cross(att_Dir, vUp));
                        att_A = att_5 + 1.5*att_Perp;
                        att_B = att_5 - 1.5*att_Perp;

                        att_A_Dir = normalize(att_A - particles[index].position);
                        att_B_Dir = normalize(att_B - particles[index].position);
                        att_Dist  = distance(att_A, particles[index].position);

                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                        if(attractor_Count != 6)//CUBE - HEXAHEDRON - MERKABA
                        {
                            att_Dir  = normalize((att_6 - particles[index].position));

                            att_Perp = normalize(cross(att_Dir, vUp));
                            att_A = att_6 + 1.5*att_Perp;
                            att_B = att_6 - 1.5*att_Perp;

                            att_A_Dir = normalize(att_A - particles[index].position);
                            att_B_Dir = normalize(att_B - particles[index].position);
                            att_Dist  = distance(att_A, particles[index].position);

                            velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                            velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                            //////////////////////////////////////////////////////////////////
                            att_Dir  = normalize((att_7 - particles[index].position));

                            att_Perp = normalize(cross(att_Dir, vUp));
                            att_A = att_7 + 1.5*att_Perp;
                            att_B = att_7 - 1.5*att_Perp;

                            att_A_Dir = normalize(att_A - particles[index].position);
                            att_B_Dir = normalize(att_B - particles[index].position);
                            att_Dist   = distance(att_A, particles[index].position);

                            velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                            velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;
                        
                            if(attractor_Count != 8)//ICOSAHEDRON
                            {
                                att_Dir  = normalize((att_8 - particles[index].position));

                                att_Perp = normalize(cross(att_Dir, vUp));
                                att_A = att_8 + 1.5*att_Perp;
                                att_B = att_8 - 1.5*att_Perp;

                                att_A_Dir = normalize(att_A - particles[index].position);
                                att_B_Dir = normalize(att_B - particles[index].position);
                                att_Dist  = distance(att_A, particles[index].position);

                                velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                //////////////////////////////////////////////////////////////////
                                att_Dir  = normalize((att_9 - particles[index].position));

                                att_Perp = normalize(cross(att_Dir, vUp));
                                att_A = att_9 + 1.5*att_Perp;
                                att_B = att_9 - 1.5*att_Perp;

                                att_A_Dir = normalize(att_A - particles[index].position);
                                att_B_Dir = normalize(att_B - particles[index].position);
                                att_Dist   = distance(att_A, particles[index].position);

                                velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                ///////////////////////////////////////////////////////
                                att_Dir  = normalize((att_10 - particles[index].position));

                                att_Perp = normalize(cross(att_Dir, vUp));
                                att_A = att_10 + 1.5*att_Perp;
                                att_B = att_10 - 1.5*att_Perp;

                                att_A_Dir = normalize(att_A - particles[index].position);
                                att_B_Dir = normalize(att_B - particles[index].position);
                                att_Dist  = distance(att_A, particles[index].position);

                                velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                //////////////////////////////////////////////////////////////////
                                att_Dir  = normalize((att_11 - particles[index].position));

                                att_Perp = normalize(cross(att_Dir, vUp));
                                att_A = att_11 + 1.5*att_Perp;
                                att_B = att_11 - 1.5*att_Perp;

                                att_A_Dir = normalize(att_A - particles[index].position);
                                att_B_Dir = normalize(att_B - particles[index].position);
                                att_Dist   = distance(att_A, particles[index].position);

                                velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                if(attractor_Count != 12)//CUBEOCTAHEDRON
                                {
                                    att_Dir  = normalize((att_12 - particles[index].position));

                                    att_Perp = normalize(cross(att_Dir, vUp));
                                    att_A = att_12 + 1.5*att_Perp;
                                    att_B = att_12 - 1.5*att_Perp;

                                    att_A_Dir = normalize(att_A - particles[index].position);
                                    att_B_Dir = normalize(att_B - particles[index].position);
                                    att_Dist   = distance(att_A, particles[index].position);

                                    velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                    velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                    if(attractor_Count != 13)
                                    {
                                        att_Dir  = normalize((att_13 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_13 + 1.5*att_Perp;
                                        att_B = att_13 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist  = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                        //////////////////////////////////////////////////////////////////
                                        att_Dir  = normalize((att_14 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_14 + 1.5*att_Perp;
                                        att_B = att_14 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist   = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                        ///////////////////////////////////////////////////////
                                        att_Dir  = normalize((att_15 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_15 + 1.5*att_Perp;
                                        att_B = att_15 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist  = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                        //////////////////////////////////////////////////////////////////
                                        att_Dir  = normalize((att_16 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_16 + 1.5*att_Perp;
                                        att_B = att_16 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist   = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                        ////////////////////////////////////////////////////
                                        att_Dir  = normalize((att_17 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_17 + 1.5*att_Perp;
                                        att_B = att_17 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist  = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                        //////////////////////////////////////////////////////////////////
                                        att_Dir  = normalize((att_18 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_18 + 1.5*att_Perp;
                                        att_B = att_18 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist   = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;

                                        ///////////////////////////////////////////////////////
                                        att_Dir  = normalize((att_19 - particles[index].position));

                                        att_Perp = normalize(cross(att_Dir, vUp));
                                        att_A = att_19 + 1.5*att_Perp;
                                        att_B = att_19 - 1.5*att_Perp;

                                        att_A_Dir = normalize(att_A - particles[index].position);
                                        att_B_Dir = normalize(att_B - particles[index].position);
                                        att_Dist  = distance(att_A, particles[index].position);

                                        velDeref += 0.5*targetStrength * att_A_Dir * deltaTime / att_Dist; 
                                        velDeref += 0.5*targetStrength * att_B_Dir * deltaTime / att_Dist;
                                    }
                                }
                            }
                        }
                    }
                } 
           }
       }
        particles[index].velocity = velDeref;
        particles[index].position += particles[index].velocity * deltaTime * damping + constVelz*deltaTime;
        if(particles[index].position.z > 1500) particles[index].position.z = -1500;
        if(particles[index].position.z < -1501) particles[index].position.z = 1499;
        particles[index].speed = length(particles[index].velocity);   
    }            
    else //HANDLE OTHER MODES HERE - OR SWITCH OUT COMPUTE SHADER
    {
        //if(attractor_Count == 0)
        //{
            // Direction and distance to target.
	        float3 basedir1 = normalize((base - particles[index].position));
	        float3 orbitdir2 = normalize((orbit - particles[index].position));

	        float basedist1 = distance(base, particles[index].position);
            float orbitdist2 = distance(orbit, particles[index].position);
    
            float mult1 = orbit_weighting;
            float mult2 = (1 - orbit_weighting);

            float3 vConstVel; 
            vConstVel.x = 0;
            vConstVel.y = 0;
            vConstVel.z = constVel; 

            float len = length(particles[index].position);

            //particles[index].position
            if(particles[index].position.z > 1500)
            {
                particles[index].position.z = -1500;
            }
   
            if(basedist1 > radius_of_action)
            {
                particles[index].velocity += mult1 * targetStrength * basedir1 * deltaTime / basedist1;
            }
            else
            {
                //particles[index].velocity -= mult1 * targetStrength * basedir1 * deltaTime / basedist1;
            }

            if(orbitdist2 > radius_of_action)
            {
                particles[index].velocity += mult2 * targetStrength * orbitdir2 * deltaTime / orbitdist2;
            }
            else
            {
                //particles[index].velocity -= mult2 * targetStrength * orbitdir2 * deltaTime / orbitdist2;
            }

            particles[index].velocity = particles[index].velocity * damping;
	        particles[index].position += particles[index].velocity * deltaTime + vConstVel* deltaTime;
            particles[index].speed = length(particles[index].velocity);
        //}
    }
}

 

Golden Ratio in Geometry

The Golden Ratio (Golden Mean, Golden Section) is defined as ϕ=(5+1)/2. The classical shape based on \phi is the golden rectangle where ϕ appears alongside the perfect (unit) square:

The golden rectangle has dimensions 1×ϕ such that removing the unit square one is left with the rectangle (ϕ1)×1 similar to the original rectangle. Indeed, the most fundamental property of the golden ratio is

(1)

ϕ:1=1:(ϕ1).

To see this, we reduce (1) to

(2)

ϕ2ϕ1=0,

with two solutions (1±5)/2 of which one is positive and the other negative. The positive one is exactly ϕ while the negative is 1/ϕ. The reciprocal ϕ=1/ϕ is sometimes also termed the golden ratio, but more often is referred to as its conjugate. Of course also

(3)

ϕ=1+ϕ.

All these equations (and an extra one) can be summarized in the following diagram [Olsen, p. 54]:

The golden rectangle is easily constructed from a square as shown in the diagram below:

Changing the order of operations, the problem of inscribing a square into a semicircle has a golden rectangle as a biproduct. (The problem is easily solved using homothety, the same way as inscribing a square into a triangle.)

Tran Quang Hung has prepared a graphical illustration below where the ratio of the blue to a red segment is Golden.

golden ratio in a circle and a 1x2 rectangle

The Golden Ratio and its inverse are roots of quadratic equations. Perhaps surprisingly, the roots of all other quadratic equations also relate to the Golden ratio (N. Lord, Golden Bounds for the Roots of Quadratic Equations, The Math Gazette, v 91, n 522, Nov. 2007, p. 549.) Indeed, let r be a root of the quadratic equation ax2+bx+c=0. Then the quadratic formula gives

r=b±b24ac−−−−−−−√2a,

from which

|r|(|b|+|b|2+4|a||c|−−−−−−−−−−−√)/2|a|(1+1+4−−−−√)/2max{|a|,|b|,|c|}/|a|=ϕmax{|a|,|b|,|c|}/|a|.

The equality is of course achieved for the Golden Ratio.

The golden ratio pops up in several geometric configurations, sometimes quite unexpectedly. It makes a stellar appearance in the pentagonal star:

(For a more descriptive treatment check S. Brodie’s construction of the pentagon and the derivation of cos(36)=(1+5)/4.) In passing, the isosceles 723672 and 3610836 triangles are known as the golden triangles because, as you see in the diagram, the bisector of a base angle in the acute one cuts off a smaller 723672 triangle leaving a 3610836 one. A trisector of the apex angle of the latter divides it again into two golden triangles. In both triangles, the ratio of a big side to a small one is of course ϕ, what else? But this is not the only occurence of the golden ratio in regular pentagon.

A regular pentagon can be formed by folding and tightening a narrow band of paper:

trefoil knot - out of flattened and tightened piece of paper

(This is the basis for my logo.)

As we shall see below, the golden ratio crops up in various circumstances, often quite unexpectedly. The greatest surprise for me was to learn that a pentagon need not necessarily be regular to house all the occurrences of the golden ratio as if it were.

For the details check another page.

The golden ratio is related to the ubiquitous 345 triangle [Huntley, pp. 43-44].

Let ABC be such a triangle with BC=3, AC=4 and AB=5. Let O be the foot of the angle bisector at B.Draw a circle with center O and radius CO. Extend BO to meet the circle at Q and let P be the other point of intersection of BO with the circle. Then PQ/BP=ϕ. For a proof, see Golden Ratio And the Egyptian Triangle.

Another way of linking the 345 triangle to the golden ratio has been discovered by Gabries Bosia while pondering over the knight’s move in chess. The latter is naturally associated with a 1:2:5 triangle. Both appear in the following diagram:

José Antônio Fabiano Mendes from Rio de Janeiro, Brazil, has observed additional appearances of the 1:2:5triangle. The inradius of the 345 triangle is 1 and the distance between the incenter and the circumcenter is 5/2:

1-2-sqrt(5) triangle in the 3-4-5 triangle

An intriguing showing of ϕ in an equilateral triangle was observed by George Odom, a resident of the Hudson River Psychiatric Center, in the early 1980s [Roberts, p. 10]. Upon hearing it from Odom, the late H. M. S. Coxeter submitted it as a problem to the American Mathematical Monthly (Problem E3007, 1983). The problem has also been reproduced by J. F. Rigby in [Pritchard, p. 294] and mentioned by K. Hofstetter in a recent article.

Let L and M be the midpoints of the sides AB and AC of an equilateral triangle ABC. Let X, Y be the intersections of LM extended with the circumcircle of ΔABC. Then LM/MY=ϕ.

Indeed, if 2a is the side length of ΔABC, then AM=MC=LM=a and XL=MY=b. By the Intersecting Chords Theorem,

MXMY=AMMC.

In other words,

(a+b)b=aa.

Denoting a/b=x, we see that

1+x=x2,

which is (2), so that indeed x=ϕ. A derivation based on the presence of similar triangles was posted by Jan van de Craats as a solution to Coxeter’s problem and included by R. Nelsen in his collection Proofs Without Words II.

(Linda Fahlberg-Stojanovska made a camcast that follows Odom’s construction by paper folding a circle. The resulting pentagon is very nearly regular, but not quite.)

In the above mentioned article, K. Hofstetter, offered another elegant way of obtaining the Golden Ratio.

It will be convenient to denote S(R) the circle with center S through point R. For the construction, let A and B be two points. Circles A(B) and B(A) intersect in C and D and cross the line AB in points E and F. Circles B(E)and A(F) intersect in X and Y, as in the diagram. Because of the symmetry, points X, D, C, Y are collinear. The fact is CX/CD=ϕ. (The proof has been placed on a separate page.)

In a subsequent paper, Hofstetter gave a 5-step algorithm for dividing a segment in golden ratio:

5-step construction of the golden ratio, #2

Draw A(B) and B(A) and let C and D be their points of intersection. Draw C(A) and let it intersect A(B) in Eand CD in F. Draw E(F). This intersects the line AB in points G and G such that AB:AG=ϕ and AG:AB=ϕ.

For a proof, suppose AB has unit length. Then CD=3 and EG=EF=2. Let H be the orthogonal projection of E on the line AB. Since HA=1/2, and HG2=EG2EH2=23/4=5/4, we have AG=HGHA=(51)/2. This shows that G divides AB in the golden section.

In the third paper in the series, Hofstetter mentions having been alerted to the fact that the above proof had been discovered previously by E. Lemoine (1902) and L. Reusch (1904). The essence of the third paper is an additional 5-step division of a segment into the golden section.

5-step construction of the golden ratio, #3

The construction is this. For a given segment AB of length 1, form circles A(B) and B(A). Let C and D be the intersections of A(B) and B(A). Extend AB beyond A to the intersection E with A(B). Draw E(B) and let F be the intersection of E(B) and B(A) farther from D. DF intersects AB in G. AG:BG=ϕ.

The diagram contains several additional occurrences of the Golden Ratio. The details have been placed in a separate page.

In a 2005 paper, Hofstetter offers a similar construction with a rusty compass whose opening can be set only once.

5-step construction of the golden ratio, #4, rusty compass

Draw A(B) and B(A) and find C and D at their intersection. Let M be the midpoint of AB found at the intersection of AB and CD. Construct C(M,AB), a circle with center M and radius AB. Let it intersect B(A) in F and another point, F being the farthest from D. Define G as the intersection of AB and DG. G then is the sought point. (For details of the proof check a separate page

The golden ratio has been sighted in a trapezoid [Tong]. In the diagram, the bottom base PQ has length b and the top base RS=a<b. The line MN parallel to the bases is of length (a2+b2)/2−−−−−−−−−√. This quantity that is known as the quadratic mean (or the root-mean-square) fits between a and b as any other mean would.

From the similarity of triangles MSV and PSW,

SMSP=MVPW=a2+b22−−−−√aba

if b=3a. The construction of the golden ratio based on this is depicted below

In the construction, BC=3AD, CE=AD, CEBC, BF=EF=FH, FHBE, BI=BH, IJAB, and GJBC. AG/BG=ϕ.

The golden ratio helps resolve Curry’s paradox [Gazalé, p. 133]:

In order for the pieces to fit the rectangle tightly, from the similarity of two upper triangles we should have the proportion

(1+ϕ):1=(1+2ϕ):ϕ,

which is equivalent to (2). If we change units from 1 to 5, we get the dissection below:

Assume the graph of a 4th degree polynomial has inflection points with abscissas a and b, a<b. The straight line through the inflection points meets the graph in two other points with abscissas xL and xR say: xL<a<b<xR.

Then

xL=a1+52+b152xR=b1+52+a152.

One solution to the problem of bisecting the Yin-Yang symbol by straightedge and compass is shown in the diagram below:

The dashed line is formed by two semicircles of diameter ϕ and two semicircles of diameter ϕ1.

three equal circles in a semicircle

As can be easily verified, when three equal circles touch each other in sequence, and a larger semicircle, the ratio of the radius of the latter to the diameter of the small circles is ϕ.

The only time the sides of a right triangle are in geometric progression is when the triangle is similar to the one with sides 1,\sqrt{\phi },\phi$ [Charming Proofs, p. 74]. These triangles are often referred to as Kepler’s triangles.

In general, if the sides of a triangle are in geometric progression, the factor of the progression necessarily falls into the range (1/ϕ,ϕ).

The area of annulus defined by the radii, a and b<a is equal to the area of an ellipse with major and minor axis equal to a and b, respectively, is when a/b=ϕ [Charming Proofs, p. 37].

The relation between the radii of three pairwise tangent circles that are also tangent to a line is well known

1R−−√=1R1−−−√+1R2−−−√.

Giovanni Lucca has recently observed that the relation is actually the one that defines the Fibonacci sequence, if applied to a chain of circles standing on a straight line and tangent to their immediate members. (In the diagram below, R1=a and R2=b.)

golden ratio in the chain of tangent circles

He then showed that the coordinates xn of the centers of the circles on the line converge to a limit x that satisfies

xx1:x2x=ϕa:b.

Jerzy Kocik (Math Magazine, 83 (2010) 384-390) enjoys a window in his house with an abundance of Golden Ratio and its powers. Start with two small central circles of unit diameter. The radius R of the two circles on their left and right, given that a pair of congruent circles (dotted) is simultaneously tangent to all the other circles, is exactly ϕ:

golden ratio from two equal circles - a wonderful window

(The diagram also sports multiple appearances of the golden rectangle and Kepler’s triangle.)

In a 2011 article, M. Bataille, offered an elegant way of constructing the Golden Ratio via an equlateral triangle and a square.

Given an equilateral triangle ABC, erect a square BCDE externally on the side BC. Construct the circle, center C, passing through E, to intersect the line AB at F. Then, B divides AF in the golden ratio. (For a proof check a separate page.)

Also, in a 2011 article, Jo Niemeyer, offered a beautiful way of constructing the Golden Ratio with three equal segments, their midpoints and a pair of perpendicular lines.

Three equal segments A1B1, A2B2, A3B3 are positioned in such a way that the endpoints B2, B3 are the midpoints of A1B1, A2B2 respectively, while the endpoints A1, A2, A3 are on a line perpendicular to A1B1.

In this arrangement, A2 divides A1A3 in the golden ratio, namely, A1A3/A1A2=ϕ.

(For a proof check a separate page.)

Following D. MacHale (The Mathematical Gazette, v. 92, n. 525, Nov 2008, 536-537), let θ be an acute angle that solves

cosθ=tanθ.

(Such an angle certainly exists because graphs of the functions y=cos(x) and y=tan(x) intersect in the interval [0,π/2). The equation is equivalent to cos2θ=sinθ, or

x2+x1=0,

with x=sinθ. Since |sinθ|1, we have a unique solution x=(51)/2=1/ϕ. It follows there is a right triangle with hypotenuse ϕ, one leg 1 and the other ϕ. If θ is the angle opposite the leg 1, then cosθ=ϕ/ϕ,while tanθ=1/ϕ, which are the same.

Quang Tuan Bui came up with a construction based on that of George Odom: ABC and AMN are two equilateral triangles where M is midpoint of side BC. Arc 60 centered at B passing through A, C intersects side MN by golden ratio.

For a proof, check a separate page.

Here’s another neusis construction with a proof on a separate page:

The base of the rectangle equals 1/ϕ.

John Molokach came up with a construction of the golden ratio by first constructing a golden rhombus, that is, a rhombus in which the ratio of the diagonals (long to short) equals ϕ.

Golden ratio via the golden rhombus

In one sweep, John additionally obtains 1/ϕ, 1/ϕ2, and ϕ2. I placed the derivation on a separate page.

Bùi Quang Tuån found a simple construction: if OMCM=3, then MNNO=ϕ.

Golden ratio by Bui Quang Tuan

I placed a proof in a separate file.

And here’s one more construction from Bùi Quang Tuån. if CM=BC2 then CNNO=ϕ.

Golden ratio by Bui Quang Tuan, #2 - construction

I placed a proof in a separate file. Bùi also came up with a simple unified approach that underlies several at first sight independent construction of the Golden Ratio.

Bùi Quang Tuån has turned in another construction that is made transparent by the following disgram. OEEM=ϕ.

golden ratio by Bùi Quang Tuån, construction

I placed a proof in a separate file.

Tran Quang Hung has contributed eight constructions of the Golden Ratio.

In a square ABCD, with M,N,P,Q the midpoints of the sides, circle on AP as diameter cuts FN in Golden Ratio.

golden ratio by Tran Quang Hung, construction #1

Details can be found in a separate file.

Tran’s second discovery takes place in equlateral triangle.

golden ratio by Tran Quang Hung, construction #2

If the circumcricle (FGH) of equilateral ΔFGH serves as the incircle of equilateral ΔABC such that F is on AH, G on CF, and H on BG, then F,G,H divide the corresponding segments AH,CF,BG in Golden Ratio. Details can be found in a separate file.

Tran’s third discovery relates to a hexagon:

golden ratio by Tran Quang Hung, construction #3

Details can be found in a separate file.

Tran’s fourth construction builds on two squares ABCD and MNPC, with M on the diagonal BD (which causes N to lie on AB.) Let Q be the intersection of CD and MP, extended.

golden ratio by Tran Quang Hung, construction #4

If 2DQ=CD then AN/BN=ϕ. Details can be found in a separate file.

His fifth construction starts with two equilateral triangles ABC and ABC. Let M be the midpoint of BC, N the midpoint of AB; P the intersection of MN with the circumcircle (ABC); AP crosses BC in D.

golden ratio by Tran Quang Hung, construction #5

Then CD/BD=ϕ, the Golden Section. Details can be found in a separate file.

Here’s Tran’s sixth construction. Square MNPQ is inscribed into square ABCD so that the lines joining their vertices intersect the sides of MNPQ at the midpoints X,Y,Z,W, as shown:

golden ratio by Tran Quang Hung, construction #6, statement

Then the vertices of MNPQ divide the sides of ABCD in the Golden Ratio, e.g. BMAM=ϕ. Details can be found in a separate file.

Tran’s seventh construction: Equilateral ΔDEF is inscribed into equilateral ΔABC so that its extended midlines MN,NP,MP pass through the vertices of ΔABC, as shown:$

golden ratio by Tran Quang Hung, construction #7

Then, say, the vertices of the inner triangle divide the sides of the outer triangle in the Golden Ratio, e.g., BFAF=ϕ.Details can be found in a separate file.

Tran’s construction #8: ABCD is a rhombus with 2AC=BD; (O) the inscribed circle; E and F the points of intersection of (O) with BD.

golden ratio by Tran Quang Hung, construction #8

Then F divides DE in the golden ratio. Details can be found in a separate file.

Not to be overdone, Quang Tuan Bui devised a 5-step construction of the golden ratio:

golden ratio by Quang Tuan Bui, 5-step construction

In the diagram MPNP=ϕ. Details can be found in a separate file.

He also noticed an appearance of the golden ratio at the intersection of a cross and a square inscribed in the same circle:

golden ratio by Quang Tuan Bui, between a cross and a square

Not every cross will do but the one that consists of five equal squares. For details check a separate file

Quang Tuan Bui came up with a wonderful configuration with severa instances of the Golden Ratio:

four golden circles by Quang Tuan Bui

In the diagram, the sides and the diagonals of the parallelogram are in Golden Ratio; the sides are divided by the centers of the circle in Golden Ratio – but that’s not all. For details check a separate file.

I’ve stopped getting surprised. Tran Quang Hung has found the Golden Ratio among mixtilinear circles in equilateral triangle.

golden ratio in mixtilinear circles by Tran Quang Hung

Details can be found in a separate file.

In 2015 Tran Quang Hung has found once more the Golden Ratio in a combination of a semicircle, a square, and a right isosceles triangle:

Tran Quang Hung (2015) - Golden Ratio construction, construction

Details can be found in a separate file.

Here is an invention of Elliot McGucken.

Golden Ratio With Two Equal Circles And a Line

Details can be found in a separate file.

Elliot came up with another construction:

Golden Ratio With three polygons, source

Details can be found in a separate file.

Following in Elliot’s footsteps, Tran Quang Hung offered a different construction:

Golden Ratio With Two Unequal Circles And a Line

Details can be found in a separate file.

Tran Quang Hung and Elliot McGucken have independently came up with the following construction:

Golden Ratio In a 3x3 Square

Details can be found in a separate file.

Tran Quang Hung then found another occurence of the Golden Ratio in a 3×3 square

Golden Ratio In a 3x3 Square II

Details can be found in a separate file.

Tran Quang Hung found the Golden Ratio in three tangent circles:

Golden Ratio In Three Tangent Circles

Here’s beautiful self-explanatory diagram by John Aioni:

Golden Ratio Poster

The above suggests another construction:

Golden Ratio Next to Poster

Tran Quang Hung has devised another configuration of a 1×3 rectangle and a circle that produce The Golden Ratio. Check the ratio of the blue segement to a red one:

Gloden ratio with a circlee and a 1x3 rectangle

There is a not immedately obvious relation between the case of 1×2 and 1×3 rectangles.

Nguyen Thanh Dung has devised the most straightforward construction of the Golden Ratio:

Golden Ratio In a 2x2 Square: Without And Within, diagram 1

This led first to an equivalent representation formed around a 2×2 square:

Golden Ratio In a 2x2 Square: Without And Within, diagram 2

And, upon some deliberation, to the following one:

Golden Ratio In a 2x2 Square: Without And Within, diagram 3

Nguyen Thanh Dung has also come up with two related constructions:

Golden Ratio With Two Unequal Circles And a Line II, Construction 1

and

Golden Ratio With Two Unequal Circles And a Line II, Construction 2

The latter may be confused with that of George Odom but is quite distinct.

The following construction of the Golden Ratio has been posted by Tran Quang Hung at the CutTheKnotMath facebook page.

Golden Ratio in Equilateral and Right Isosceles Triangles, Construction 1

Golden Ratio has popped up in the Odom-like constructions involving a square and a regular hexagon:

Golden Ratio in Equilateral triangle, square and regular hexagon

For details visit trigonography.com.

Dũng Thanh Nguyên has posted the following diagram at the CutTheKnotMath facebook page:

Golden Ratio Astride Equilateral Triangle

As there’s more to it, the proof and further exploration have been placed on a separate page.

Tran Quang Hung came up with an overlooked occurence of the Golden Ratio in a regular pentagon:

Another Golden Ratio in Regular Pentagon

Then, ONQN=PRQR=φ. The details are in a separate page.

Tran Quang Hung has found the Golden Ratio in a configuration of a regular pentagon and a regular hexagon:

Golden Ratio 5-gon & 6-gon

Then, CQBQ=DRER=φ, the Golden Ratio. The details are in a separate page.

It did not take Tran Quang Hung long to find the Golden Ratio in an isosceles trapezoid with a 60 degrees angle:

Golden Ratio in an Isosceles Trapezoid with a 60° Angle

Then XBXA=YCYB=TATD=MCMA=φ, the Golden Ratio. The details are in a separate page.

Just in time for the festive 2016 season Tran Quang Hung found another instance of the Golden Ratio:

Golden Ratio in Pentagon And Two Squares

The details are in a separate page.

References

  1. C. Alsina, R. B. Nelsen, Charming Proofs, MAA, 2010
  2. M. Bataille, Another Simple Construction of the Golden Section, Forum Geometricorum,Volume 11 (2011) 55
  3. M. J. Gazalé, Gnomon: From Pharaohs to Fractals, Princeton University Press, 1999
  4. K. Hofstetter, A Simple Construction of the Golden Section, Forum Geometricorum, v 2 (2002), pp. 65-66
  5. K. Hofstetter, A 5-step Division of a Segment in the Golden Section, Forum Geometricorum, v 3 (2003), pp. 205-206
  6. K. Hofstetter, Another 5-step Division of a Segment in the Golden Section, Forum Geometricorum, v 4 (2004), pp. 21-22
  7. K. Hofstetter, Division of a Segment in the Golden Section with Ruler and Rusty Compass, Forum Geometricorum, v 5 (2005), pp. 135-136
  8. H. E. Huntley, The Divine Proportion, Dover, 1970
  9. R. B. Nelsen, Proofs Without Words II, MAA, 2000
  10. Jo Niemeyer, A Simple Construction of the Golden Section, Forum Geometricorum, Volume 11 (2011) 53
  11. S. Olsen, The Golden Section: Nature’s Greatest Secret, Walker & Company, 2006
  12. C. Pritchard (ed.), The Changing Shape of Geometry, Cambridge University Press, 2003
  13. S. Roberts, King of Infinite Space, Walker & Company, 2006
  14. J. Tong and S. Kung, A Simple Construction of the Golden Ratio, Forum Geometricorum, Volume 7 (2007) 31-32

Golden Ratio

    1. Golden Ratio in Geometry
    2. Golden Ratio in Regular Pentagon
    3. Golden Ratio in an Irregular Pentagon
    4. Golden Ratio in a Irregular Pentagon II
    5. Inflection Points of Fourth Degree Polynomials
    6. Wythoff’s Nim
    7. Inscribing a regular pentagon in a circle – and proving it
    8. Cosine of 36 degrees
    9. Continued Fractions
    10. Golden Window
    11. Golden Ratio and the Egyptian Triangle
    12. Golden Ratio by Compass Only
    13. Golden Ratio with a Rusty Compass
    14. From Equilateral Triangle and Square to Golden Ratio
    15. Golden Ratio and Midpoints
    16. Golden Section in Two Equilateral Triangles
    17. Golden Section in Two Equilateral Triangles, II
    18. Golden Ratio is Irrational
    19. Triangles with Sides in Geometric Progression
    20. Golden Ratio in Hexagon
    21. Golden Ratio in Equilateral Triangles
    22. Golden Ratio in Square
    23. Golden Ratio via van Obel’s Theorem
    24. Golden Ratio in Circle – in Droves
    25. From 3 to Golden Ratio in Semicircle
    26. Another Golden Ratio in Semicircle
    27. Golden Ratio in Two Squares
    28. Golden Ratio in Two Equilateral Triangles
    29. Golden Ratio As a Mathematical Morsel
    30. Golden Ratio in Inscribed Equilateral Triangles
    31. Golden Ratio in a Rhombus
    32. Golden Ratio in Five Steps
    33. Between a Cross and a Square
    34. Four Golden Circles
    35. Golden Ratio in Mixtilinear Circles
    36. Golden Ratio With Two Equal Circles And a Line
    37. Golden Ratio in a Chain of Polygons, So to Speak
    38. Golden Ratio With Two Unequal Circles And a Line
    39. Golden Ratio In a 3×3 Square
    40. Golden Ratio In a 3×3 Square II
    41. Golden Ratio In Three Tangent Circles
    42. Golden Ratio In Right Isosceles Triangle
    43. Golden Ratio Poster
    44. Golden Ratio Next to the Poster
    45. Golden Ratio In Rectangles
    46. Golden Ratio In a 2×2 Square: Without And Within
    47. Golden Ratio With Two Unequal Circles And a Line II
    48. Golden Ratio in Equilateral and Right Isosceles Triangles
    49. Golden Ratio in a Butterfly Astride an Equilateral Triangle
    50. The Golden Pentacross
    51. 5-Step Construction of the Golden Ratio, One of Many
    52. Golden Ratio in 5-gon and 6-gon
    53. Golden Ratio in an Isosceles Trapezoid with a 60 degrees Angle

Golden Ratio in Pentagon And Two Squares

sdfdfdfdfdfd


#pragma kernel CSMain

// Thread group size 
#define thread_group_size_x 32
#define thread_group_size_y 1
#define thread_group_size_z 1

struct Particle 
{
    float3      position;  
    float3      velocity; 
    float       speed;
};

int app_mode;

float  time;
float  pi;

float deltaTime;
float damping;									
float3 base;										// HANDLE.
float3 orbit;										// BOB
float targetStrength;								// POWER MAG
float orbit_weighting;                              // POWER RATIO BETWEEN HANDLE AND BOB
float radius_of_action;                             // RADIUS OF TROUGH / MOTE :) around ATTRACTOR
float zero_mirror_radius;

int attractor_Count;
float3 att_0;										
float3 att_1;
float3 att_2;										
float3 att_3;

float3 att_4;										
float3 att_5;
float3 att_6;										
float3 att_7;

float3 att_8;										
float3 att_9;
float3 att_10;										
float3 att_11;

float3 att_12;										
float3 att_13;
float3 att_14;										
float3 att_15;

float3 att_16;										
float3 att_17;
float3 att_18;										
float3 att_19;
	
float constVel;                                     

RWStructuredBuffer <Particle> particles;

[numthreads(thread_group_size_x, thread_group_size_y, thread_group_size_z )]

void CSMain ( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex )        
{
    int index = DTid.x;
    //int index = DTid.x + DTid.y * thread_group_size_x * 32;

    float3 constVelz;
    constVelz.z = constVel;
    constVelz.x = 0;
    constVelz.y = 0;
   
    if(app_mode == 0) //Platonics Mode
    {
        float3 velTemp = particles[index].velocity;

        float3 vZero;
        vZero.x = 0;
        vZero.y = 0;
        vZero.z = 0;
    
        float3 deltVel;
        float dV_Len;
        float dV_Last_Len;   
           
        if(attractor_Count == 1 || attractor_Count == 2 || attractor_Count == 3 )
        {
            float3 att_0_Dir  = normalize((att_0 - particles[index].position));
            float3 att_0_const;
            att_0_const.x = 0;
            att_0_const.y = 1;
            att_0_const.z = 0;

            float3 att_0_perp = normalize(cross(att_0_Dir,att_0_const));
            float3 att_0_a = att_0 + 1.5*att_0_perp;
            float3 att_0_b = att_0 - 1.5*att_0_perp;

            float3 att_0_a_Dir = normalize((att_0_a - particles[index].position));
            float3 att_0_b_Dir = normalize((att_0_b - particles[index].position));
            float  att_0_a_dist = distance(att_0_a, particles[index].position);
            float  att_0_b_dist = distance(att_0_b, particles[index].position);

            deltVel = 0.5*targetStrength * att_0_a_Dir * deltaTime / att_0_a_dist; 
            velTemp += deltVel;
            deltVel = 0.5*targetStrength * att_0_b_Dir * deltaTime / att_0_b_dist; 
            velTemp += deltVel;

 

sdfdfdfd