ekumenlabs / terminus

Library to create cities and terrains
Apache License 2.0
56 stars 29 forks source link

Wrong monolane for an intersection between an arc and a segment #229

Closed basicNew closed 7 years ago

basicNew commented 7 years ago

Test to reproduce:

    def broken_intersection_on_one_lane_city(self):
        """
                      (0,50)
                        |
                        |    __--- (50,20)
        (-50,0) ------- + ---
                        |
                        |
                      (0,-50)
        """
        city = City("Broken intersection - One lane")

        s1 = Street.from_control_points([Point(-50, 0), Point(0, 0), Point(50, 20)])
        s1.name = "s1"

        s2 = Street.from_control_points([Point(0, -50), Point(0, 0), Point(0, 50)])
        s2.name = "s2"

        city.add_intersection_at(Point(0, 0))

        city.add_road(s1)
        city.add_road(s2)

        return city

Generated monolane

connectionmismatch

The problem is most likely due to the fact we compute the arcs endpoints based on the length from the intersection points to some given offset over the lanes. However it is not the same to consider the length in a straight live vs the length over an arc (as is the case on an intersection that includes non-collinear segments).