I was inspired to create this video by the Penrose Tile and fifth-order symmetry =)
int vertexes = 5;
PointF center = new PointF(300.0f, 300.0f);
float radius = 100;
float angle = (float)Math.PI * 2 / 5;
private void draw_polygon(float _center_X, float _center_Y, float k_x, float k_y, Pen silverPen4, float radius, double angle_k)
{
using (var g = Graphics.FromImage(bmp))
{
PointF[] p = new PointF[vertexes];
PointF center = new PointF(_center_X + radius * k_x, _center_Y + radius * k_y);
for (int i = 0; i < vertexes; i++)
{
p[i] = new PointF(center.X + (float)Math.Sin(i * angle + angle_k) * radius, center.Y + (float)Math.Cos(i * angle + angle_k) * radius);
}
for (int i = 0; i < vertexes; i++)
{
g.DrawPolygon(silverPen4, p);
}
}
}
in accordance with the dependent coordinates of the center
in the proportions of magnification by means of coefficients
Here is a straight and inverted pentagon:
private void draw_polygons(PointF _center, Pen silverPen4, float radius)
{
float a1 = 2 * (float)Math.Cos(Math.PI / 5);
float a2 = a1 * (float)Math.Cos(Math.PI / 10);
float a3 = a1 * (float)Math.Cos(4 * Math.PI / 5 - Math.PI / 2);
float a4 = a1 * (float)Math.Sin(4 * Math.PI / 5 - Math.PI / 2);
draw_polygon(_center.X, _center.Y, 0.0f, 0.0f, silverPen4, radius, -Math.PI / 5);
draw_polygon(_center.X, _center.Y, a3, -a4, silverPen4, radius, 0.0);
draw_polygon(_center.X, _center.Y, -a3, -a4, silverPen4, radius, 0.0);
draw_polygon(_center.X, _center.Y, -a2, 0.5f, silverPen4, radius, 0.0);
draw_polygon(_center.X, _center.Y, a2, 0.5f, silverPen4, radius, 0.0);
draw_polygon(_center.X, _center.Y, 0.0f, a1, silverPen4, radius, 0.0);
}
private void draw_polygons_i(PointF _center, Pen silverPen4, float radius)
{
float a1 = 2 * (float)Math.Cos(Math.PI / 5);
float a2 = a1 * (float)Math.Cos(Math.PI / 10);
float a3 = a1 * (float)Math.Cos(4 * Math.PI / 5 - Math.PI / 2);
float a4 = a1 * (float)Math.Sin(4 * Math.PI / 5 - Math.PI / 2);
draw_polygon(_center.X, _center.Y, 0.0f, 0.0f, silverPen4, radius, 0.0);
draw_polygon(_center.X, _center.Y, 0.0f, -a1, silverPen4, radius, -Math.PI / 5);
draw_polygon(_center.X, _center.Y, a2, -0.5f, silverPen4, radius, -Math.PI / 5);
draw_polygon(_center.X, _center.Y, -a2, -0.5f, silverPen4, radius, -Math.PI / 5);
draw_polygon(_center.X, _center.Y, a3, a4, silverPen4, radius, -Math.PI / 5);
draw_polygon(_center.X, _center.Y, -a3, a4, silverPen4, radius, -Math.PI / 5);
}
Continuation of further calculation of new center coordinates with new coefficients
and the compilation of even larger pentagons:
an example of new coefficients:
float a01 = radius * (2 * a1 + 1) * (float)Math.Cos(Math.PI / 10);
float a02 = radius * (2 * a1 + 1) * (float)Math.Sin(Math.PI / 10);
float a03 = radius * (2 * a1 + 1) * (float)Math.Sin(Math.PI / 5);
float a04 = radius * (2 * a1 + 1) * (float)Math.Cos(Math.PI / 5);
float a05 = 0.0f;
float a06 = radius * (2 * a1 + 1);
You can continue by calculating the coefficients according to the Fibonacci sequence
or in a similar way:
int s = 0; int n = 1; int p = 1;
for (int i = 0; i < 4; i++)
{
s = n + p;
float a_1_ = radius * (s * a1 + p) * (float)Math.Cos(Math.PI / 5);
float a_2_ = radius * (s * a1 + p) * (float)Math.Sin(Math.PI / 5);
float a_5_ = radius * (s * a1 + p);
float a_3_ = radius * (s * a1 + p) * (float)Math.Cos(Math.PI / 10);
float a_4_ = radius * (s * a1 + p) * (float)Math.Sin(Math.PI / 10);
float a_6_ = 0.0f;
n = p;
p = s;
}
By changing the coordinate coefficients of the centers
and the radiuses of the pentagons over time,
i got this video (above)