JasonLautzenheiser / trizbort

Trizbort, the Interactive Fiction Mapper
http://www.trizbort.com
Other
129 stars 35 forks source link

Trizbort rewrites long one-way connectors it doesn't need to #260

Open andrewschultz opened 8 years ago

andrewschultz commented 8 years ago

In my compound-walkthrough.trizbort at

https://raw.githubusercontent.com/andrewschultz/the-problems-compound/master/compound-walkthrough.trizbort

If you click on the one-way passage between "Destroy Thoughts Idol" and "Airy Station" and hit V a few times, you'll notice that the Jerks/Bad Guy one-way passage flips, too.

Short version: check for bounding box intersections. If they don't, skip re-drawing.

Long version: It's a very complex problem to figure whether two segments intersect, especially with Trizbort's bendy stalks.

http://martin-thoma.com/how-to-check-if-two-line-segments-intersect/ has the full details of an algorithm to find intersections, but for our purposes a bounding box would be nice.

If we wanted to get a bit more rigorous later, we could check to see if all 4 points of one bounding box are on the same side of the diagonal of another bounding box, but I think this gets tricky.

The main question is if we should take the stalks into account for odd cases such as

  1. room a is NW of room B in Trizbort
  2. there is a passage from the NW port of room A to the SE port of room B.

In this case the bounding rectangle expands a bit.

github-actions[bot] commented 4 years ago

Stale issue message