Ok, this is a general algorithm question, not necessarily perl related. This isn't the actual problem I have but this is a simple analog. Basically, I need to place labels in a nice way on a circle. Suppose you have a round clockface. You want to label the clock with words instead of numbers.

So, 3 o'clock is easy. The label "three" placed with the 't' maybe just a bit to the right of the circle directly at pi/4 radians. Similarily, nine o'clock is placed at its spot but with the 'e' on the circle and the first 'n' offset to the left a bit.

Those are the easy ones though. How would one, position the "eleven"? My first thought is to consider the labels as boxes. If I define a line tangent to the circle that part of that line could define one end of the box, the other end is a line parallel to it and the sides two perpendiculars. But this seems maybe overly complicated. Then again, it would allow for the label to be any size...just adjust the dimensions of the box.

This seems like the sort of thing that there must be a well known algorithm for. Is there? Google seems a bit useless but maybe I don't know the right keyword to use here.

Any advice?


In reply to algorithm help -- how to label a clock by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.