Ranges and expressions 4
Spreadsheet programming
Last updated
Spreadsheet programming
Last updated
Regular polygons have all their sides and angles equal. To generate such shapes we can modify the table such that the “x” and “y” coordinates are now using the cosine and sine columns, respectively. Then we resize the sequence to contain a number of rows equal to the order of the regular polygon we want to create; plus one for closing the shape by having the first and last points coincide.
In the figure above we construct a regular triangular polygon, also known as the equilateral triangle. With four unique points we can construct a square, with five a pentagon, six a hexagon etc. Had we the ability to create infinite points, we would have constructed a unit circle. This is because the equation used is:
where “t” is a real number, the angle, in [0, 2π] and “p” or [ x, y, 0 ] is a point, or a vector from the origin, in the XY-plane.
The next task is to introduce a sense of generalization such that we can define the circle’s radius and origin. In other words, describe every possible circle in the the XY-plane. The way to archive this is by scaling the sine and cosine values by the radius “r” and adding a constant pair of “xo” and “yo” coordinates for translating by the center of the circle, for each point.
or
Below, we create a radius, x-offset, y-offset columns, constant for all rows. Then using the standard mechanism of composing complex expressions and expanding, we apply the formula for the point coordinates:
The objective of this was to show how we can conceptually approach geometric transformations via arithmetic operations. Scaling directly maps to multiplication whereas translation maps to addition. Also if you noticed, the rules of scalar number addition and multiplication, apply verbatim to 3D points and vectors.
Practice
Update the table above such that for each regular polygon of unit radius, instead of always starting from [1, 0, 0], the polygon is oriented such that its bottom-most edge is horizontal.
Experiment with creating polygons that beyond control of scale (radius) and translation (centre point) we can also rotate them by an arbitrary angle.
Convert the above table such that instead of defining a polygon by the radius of its circumscribed circle, aka circumradius, we will define it by its side-length.
Compute the length of each polygon side, from its point coordinates, using the Pythagorean Theorem i.e. the Euclidean distance, and then sum them all together. What is the number approaching as we increase the number of polygon sides i.e. expanding all rows down?
So far we kept the radius constant. Assign it from the “time” column to produce a spiral. Apply other transformations to the radius to produce different types of spirals e.g. arithmetic, geometric, Archimedean, Fibonacci etc.
An ellipse is very similar geometrically to a circle. It is defined using two radii, one for the X-axis and one for the Y-axis. We call those major and minor radius. In fact a circle is a special case of an ellipse with equal major and minor radii. Modify the table to produce ellipses instead of circles.
This is known as the “parametric form” of the circle. Quite interestingly it captures better the notion of a point traversing or rotating about a fixed point and it has a computational flavour, you input one angle and output one point. Compare this to the “implicit form” of the circle , a relationship which requires the sums of squares of a pair of numbers i.e. the coordinates of point, to be constant i.e. to a distance squared i.e. the radius of the circle.
The circumscribed circle for a regular polygon [] passes through its vertices []. Compute the points of the inscribed circle of the same regular polygon; the circle that passes pass through the middle of each edge.