Andrew Que Sites list Photos
Projects Contact

July 25, 2018

A way of rounding corners

   At work I have a project with a simple LCD display.  It includes a simple interface that includes rounded corners on the main menu.  While it doesn't effect what I am doing I was curious what algorithm they used to round the corners.  Most people use a variant the midpoint circle algorithm, including Bill Atkinson who made the rounded rectangles used on the original Macintosh computer.  This approach was a little different.  To round a corner, lines would be drawn between two points, starting with a vertical line, and then advancing finishing x point by one, and the decrementing the starting y point by one.  This is an old trick I remember seeing sometime in middle school.  You can do it on graph paper.  By drawing only straight lines you end up with a curve.  By moving only a single pixel, there are no unfilled areas and you end up with a rounded corner.
   While this algorithm works, it's really inefficient.  Each new line only contributes a couple of pixels and the rest simply overlap.  Still, it does function.  Interesting way of solving this problem though.
   A prairie dog.  While Wingnut and I saw several prairie dogs on our trip they were not interested in having a look at us.  In years past when I have encountered prairie dogs I have found them to be very inquisitive.  Simply sitting down and being patient was enough for them to come out and wonder around.  Several times I had prairie dogs approach me, get close enough to sniff me a couple of times, and then go about their business.  This trip they won't let us get anywhere near them.  They would disappear into their holes and leave a couple up top in the distance to chirp at us.