I think I'd treat this as a grammar/parsing problem. First, determine what the simplest closed circuit is. With the set you describe, it would be four quarter circles arranged to form a circle:
LLLL
where L is a quarter circle that "turns left". This assumes that counter-clockwise is the canonical direction of travel. R could then be a quarter circle that turns right. (But RRRR would not be a valid circuit, since it violates the canonical direction of travel.)

Next figure out what transformations you can make to any valid closed circuit to yield another valid closed circuit. For example, in pseudo-regexp terms:

LL => SLLS
i.e. Add straight segments to the ends of any left-turning semi-circle. So LLLL could become LSLLSL, a short oval. Likewise,
RR => SRRS
would also be a valid operation.

Also, some general rules may prove helpful. For instance:

^xy$ => yx
i.e. commutativity, where x and y are any two sequences which, together, comprise an entire valid closed path. This just says that a valid closed path is valid, regardless of where you start. This means that LSLLSL from the example above can become SLLSLL, perhaps, in preparation for applying another rule.

After you've defined your "transformational grammar", you can design an algorithm to parse potential layouts with it, so you can determine whether a given track arrangement is valid. Parsing with transformational grammars is, in general, not for the faint of heart. But simple Euclidean geometry may come to your rescue, in place of a fancy parsing algorithm. Nonetheless, you may have more fun just applying a random number generator to your transformation rules to see what kinds of layouts you come up with.

Have fun!


In reply to Re: Closed geometry: a train track problem by Dr. Mu
in thread Closed geometry: a train track problem by SamCG

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.