procedural_city_generation.roadmap package

Submodules

procedural_city_generation.roadmap.Vertex module

class procedural_city_generation.roadmap.Vertex.Vertex(coords)

Bases: object

Vertex (name after mathematical graph-theory) object used in roadmap submodule. Has the following attributes: - coords : numpy.ndarray(2, )

XY-Coordinates of this Vertex
  • neighbours : list<procedural_city_generation.roadmap.Vertex>

    List of all Vertices that this Vertex is currectly connected to (has a road to)

  • minor_road : boolean

    Describes whether this road is a minor road

  • seed : boolean

    Describes whether this (major) road is a seed

connection(other)

Manages connections so that no Vertex has two connections to the same other Vertex. Also responsible for plotting this Vertex in matplotlib if the “plot” parameter in /inputs/roadmap.conf is set to True.

other : procedural_city_generation.roadmap.Vertex object
The vertex that this vertex is goint to be connected to.
procedural_city_generation.roadmap.Vertex.set_plotbool(singletonbool)

procedural_city_generation.roadmap.check module

procedural_city_generation.roadmap.check.check(suggested_vertex, neighbour, newfront)

Performs the following checks on a suggestes vertex and the suggested connection between this vertex and his last neighbour:

  1. Is the vertex out of bounds

    If yes, dont add this Vertex

  2. Is the vertex too close to an existing vertex

    If yes, change the vector that is checked in 4 and 5 from [neighbor-suggested_vertex] to [neighbor-closest_existing_point]

  3. Does the the vector intersect an existing connection (road)

    If yes, only create the connection up until that intersection. Add that intersection to the Global_lists and fix the neighbor attribute of the existing connection that was “intersected”.

  4. Does the vector stop shortly before an existing connection

    If yes, extend the connection up until that intersection. Add that intersection to the Global_lists and fix the neighbor attribute of the existing connection that was “intersected”.

If none of the above, simply add this vertex to the global_lists and the new front and return the newfront. This is the only place aftert config, where Vertices get added to the Global Lists. Every Time A vertex is added, the cKDTree used to find the closest vertices has to be updated.

suggested_vertex : Vertex object neighbour : Vertex object newfront : list<Vertex>

newfront : list<Vertex>

procedural_city_generation.roadmap.check.get_intersection(a, ab, c, cd)

Gets the intersection coordinates between two lines. If it does not exist (lines are parrallel), returns np.array([np.inf, np.inf])

a : np.ndarray(2, 1)
Starting point of first vector
ab : np.ndarray(2, 1)
First vector (b-a)
c : np.ndarray(2, 1)
Starting point of second vector
cd : np.ndarray(2, 1)
Second vector (d-c)

intersection : np.ndarray(2, 1)

procedural_city_generation.roadmap.config module

class procedural_city_generation.roadmap.config.Global_Lists
procedural_city_generation.roadmap.config.config()

Starts the program up with all necessary things. Reads the inputs, creates the Singleton objects properly, sets up the heightmap for later, makes sure all Vertices in the axiom have the correct neighbor. Could need a rework in which the Singletons are unified and not broken as they are now.

variables : Variables object
Singleton with all numeric values which are not to be changed at runtime
singleton.global_lists : singleton.global_lists object
Singleton with the Global Lists which will be altered at runtime

procedural_city_generation.roadmap.getRule module

procedural_city_generation.roadmap.getRule.getRule(vertex)

Gets the correct growth_rule for a Vertex, depending on that objects’ xy coordinates and the growth_rule_image

vertex : Vertex object

tuple(int, np.ndarray(3, ) , float)
(int) for choosing the correct growth rule, (np.ndarray) for center in case that the radial rule is chosen, (float) for population_density

procedural_city_generation.roadmap.getSuggestion module

procedural_city_generation.roadmap.getSuggestion.getSuggestion(vertex)

Calls each of the actual growth rules, and returns a list of suggested vertices

vertex : Vertex object

list<Vertex>

procedural_city_generation.roadmap.iteration module

procedural_city_generation.roadmap.iteration.iteration(front)

Gets Called in the mainloop. Manages the front and newfront and the queue

front : list<Vertex>

newfront : list<Vertex>

procedural_city_generation.roadmap.main module

procedural_city_generation.roadmap.main.main()

procedural_city_generation.roadmap.roadmap_params module

Module which contains all input parameters for this submodule, along with: - The default (recommmended) value from the developers - A short description of what the parameter changes - All values that the parameter accepts without causing this program to break.

This information can also be viewed when calling the GUI and clicking the “options” button for that specific module.

Module contents