-
Notifications
You must be signed in to change notification settings - Fork 3
Road Generators
adhocmaster edited this page May 12, 2021
·
26 revisions
- Create some intersections
- Convert intersection to Direction Intersections by identifying incident roads in direction quadrants (top is North, left is West, bot is South, right is East)
- Create a grid and cells of it.
- Apply WFC to fill cells with Direction Intersections
- Get Direction Intersection positions based on the cell placement.
- Adjust the original intersections' positions based on their direction counterparts' positions.
- Connect incident roads based on their placement on the direction quadrant
A direction intersection is defined by four direction quadrants (top is North, left is West, bot is South, right is East). An incident road is placed in a direction quadrant based on the outgoing heading at the incident point. Headings are calculated counter-clockwise from East.
The conversion tool is based one invariant in the intersections: no two incident roads ever overlap.
The process is shown here:
So, the direction intersection has only 4 properties each saving a reference to one direction quadrant. Each direction quadrant has two properties to save the number of incoming and the number of outgoing lanes.
This is a sample grid of (500m X 500m) and each cell is (100m X 100m). Initially no cell has any element placed.