in reply to Re^2: Closed geometry: a train track problem
in thread Closed geometry: a train track problem

"an exercise for the reader"... :)

Okay, how about this: calculate some intermediate points, and store them in an x-y array. If a new piece tries to add points that are too close to an old point, it's a collision.

Actually, I like Dr. Mu's concept of transforming successful closed layouts, although I wouldn't necessarily do it as a 'parsing problem' because that gets trickier as pieces become more varied in length, angle and radius. Either the programmer or the program need to figure out what transformations work geometrically, and I'd much rather it be the program. Heesh's right to focus on successful layouts rather than random ones, because that will give you more solutions more quickly. Won't be as entertaining to watch, though! :D

Don Wilde
"There's more than one level to any answer."
  • Comment on Re^3: Closed geometry: a train track problem

Replies are listed 'Best First'.
Re^4: Closed geometry: a train track problem
by pajout (Curate) on Jan 04, 2006 at 14:09 UTC
    Yes, Dr. Mu's concept is exact, but it need to solve collisions, too - generally, problems related with real dimensions of pieces.
    Ad intermediate points - imho, my concept of occupied squares is better (but not exhausting collision problems), of course, when it is possible to split every piece into set of square-unit.
      We're pretty much saying the same thing, but I think my points-along solution will serve better when we get to bridge clearances and things like that. For instance, let's say we have a bridge that crosses at a non-right angle. With my version, it's very easy to get a pretty accurate location and angle of the crossing so that we can ensure that the bridge abutments are far enough away from the center of the bottom track to clear. This requires that we know things like the length of the bridge and the width of the bridge as well, but it seems like it would be extremely difficult to figure any of this out without knowing the location and angle of the crossing.

      With mine, the allowable distance is the same in every direction, set by one constant. With yours, it's different for side-by-side sqaures from corner-to-corner ones. Since calculating sqrt(delx**2+dely**2) < limit is what computers are supposed to be good at, I rest my case. :D

      Don Wilde
      "There's more than one level to any answer."