Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

By cheating with a Python script to move the mouse, I managed to get 99.9%. Seems difficult to get higher than that, perhaps due to the mouse position having integer coordinates.


I literray came here to see who is going to proclaim automation first (and in what way) :) Unsurprinsingly, it was the first comment.

100% perfect circle is a pure math thing and can't be achieved with drawing in any way.


In a similar vein, people claim it's impossible to draw a heptagon with a straight edge and ruler.

Sure, but good luck pulling of a perfect octagon either, given the limitations of pen and paper.

And there's a perfectly good approximation that'll very quickly produce a theoretical heptagon with error margins less than the thickness of a pencil.

1/7 ~= 1/8 + 1/64 + 1/512 + 1/4096

(1/n = sum(1...infinity) of 1/((n + 1) ^ i)

(A perfect heptagon requires infinitely many steps.)


    %!PS-Adobe-3.0 EPSF-3.0 
    %%DocumentMedia: a4 595 842 80 () ()
    newpath
    300 500 moveto
    /poly {
            /side exch def
            /angle  360 side div def
           side {
           angle rotate
           720 side div  0 rlineto
            } repeat
            stroke
            closepath 
    } def
    7 poly
    showpage

Save it as figure.ps. Also, you can try "8 poly", or "1000 poly" above "showpage".


Octagons are great fun to draw on graph paper. They're just a truncated square.


Sure, but if you want an octagon of a specific edge length then that won't help you.

Or if you want the largest octagon that fits in a given circle (octagon of a given radius).


If you draw the diagonal sides as the diagonals of squares, they will have the square root of two times the length of the vertical or horizontal sides.


Fair enough. But you can get pretty close if you draw a 10x10 with 4 squares on the sides parallel to the graph. Or 5x5 with 3 on each side. The former is 6% over and the latter 6% under. And if you go juust a hair outside of the lines you're dead on. Such as a pencil tip's width off of the ruler.

I just worked that out with a calculator, but I'm fairly sure I worked that out empirically while bored in math class one year. My very wise teacher put me and the other bored kid way to the opposite side of the classroom from where his chalkboard was and looked the other way when we played 'squares' in class, safely out of the peripheral vision of any of the other kids. Probably the only time I ever dared 'pass notes' in class.


They are! But the octagons you draw that way aren’t regular (basically because sqrt(2) is irrational)


You can get pretty close with a pencil and a ruler though, if you have the right diameter of mechanical pencil. If you place the ruler dead on the corners of the squares and draw the line offset that tiny little bit, the error is barely perceptible without magnification.


Throw a compass into the mix and you'll get close enough.

But you like, fall off the grid man.


Are you trying to square a circle? We don't tolerate that witchcraft around these parts. Now git.


No - you can't square the circle, but you can get the square-root of 2.

Choose a corner and truncate, measure the edge length using a compass, and use that to draw the rest of the owl.

You can do it, but you end up with horizontal and vertical edges that are misaligned with the grid.

And I saw the opportunity to make a bad joke.


https://news.ycombinator.com/item?id=34284790

This bookmarklet also "only" gets 99.9%


A mac or windows app controlling the mouse I presume?


I used the pyautogui library on Linux. Then just a simple loop with an incrementing angle, with some overshoot in the end in order for the webpage to recognize that the circle was complete. First time using the library, worked pretty well, except I had to figure out that I had to use pyautogui.PAUSE = 0 to make it not pause between mouse movements.


Did you film it by any chance? This would be a good throw-away Twitter or blog post


Arduino controlling a robotic arm holding a mouse, written in C.


powered by a large language model




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: