ekumenlabs / terminus

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

Missing connection when road ends in arc #234

Closed basicNew closed 7 years ago

basicNew commented 7 years ago

Sample below:

        """
        When using smooth geometries, the original intersection point (0,0) does
        not exist anymore as a place for the roads to intersect (it should be
        replaced by an arc or similar). Since s2 dies on (0,0) the road geometry
        has to be extended to touch the new s1 geometry.

                             __--- (50,30)
        (-50,0) ------- + ---
                        |
                        |
                      (0,-50)
        """
        city = City("Maybe missing intersection")

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

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

        city.add_intersection_at(Point(0, 0))

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

        return city

Generates the following road:

screenshot from 2017-04-10 19 01 40

Missing the connection. Also the following is shown in the console:

Couldn't find intersection between geometries
ROAD NODE: RoadIntersectionNode @ Point(0, 0, 0)
SOURCE: Path geometry
LineSegment(Point(-50, 0, 0), Point(-5.0, 0.0, 0))
Arc(Point(-5.0, 0.0, 0), 0.0, 18.0515864914, 30.9637565321)
LineSegment(Point(4.28746462856, 2.57247877714, 0), Point(50, 30, 0))
TARGET: Path geometry
LineSegment(Point(0, -50, 0), Point(0, 0, 0))
Couldn't find intersection between geometries
ROAD NODE: RoadIntersectionNode @ Point(0, 0, 0)
SOURCE: Path geometry
LineSegment(Point(0, -50, 0), Point(0, 0, 0))
TARGET: Path geometry
LineSegment(Point(-50, 0, 0), Point(-5.0, 0.0, 0))
Arc(Point(-5.0, 0.0, 0), 0.0, 18.0515864914, 30.9637565321)
LineSegment(Point(4.28746462856, 2.57247877714, 0), Point(50, 30, 0))