
O.K. So, for whatever it's worth. I managed to get the pentagon drawing code working - that is to say, without having to make any calls to any trig functions in the actual pentagon drawing code.

Yeah, it's pretty wild. Based on the fact that the cosine of 36 degrees is equal to (1+sqrt(5))/4, I decided to perform the construction as if using a compass and straight edge, so that I could calculate the diagonal of a suitable rectangle (1.0 wide by 0.5 high), and then add the value of the height of the rectangle, to obtain a (1+sqrt(5))/2 line segment. from which I can construct a suitable bisector/midpoint value, which then gets used as the needed cosine part. Additional work, Euclidian style, gets all of the points of a pentagon, such as by constructing a 36-degree angle, then bisecting THAT to obtain an 18-degree angle - to which 90 degrees can be added by making use of its perpendicular! Various reflections and intersections later, all that is needed to be done has been done - and the pentagon can be plotted. With no conditional statements needed either, other than in some code that is used to decide how much debugging information to print out or plot. Oh, what fun!
Next, I need to consider the importance of drawing the hexagon and methods for combining the techniques so as to perhaps plot five rotated hexagons according to the points of the pentagon, for example, which upon further bisections should give both the hour and minute marks of a clock face, without needing loops, branches, or trigonometric functions, perhaps? Well, maybe.
All in due time.
glgorman
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.