Programing Functions for the Computational Modelling

Written by Paul Keel
Last Update 02/05/01 T.N.

table of contents


make_random (min, max, target, tendency)
This function creates within a given range a random number. To allow for more control, the generated number can be influenced. The function is more likely to return a number that is close to a specified target value. The tendency value defines how likely this will be the case.




make_grid (grid_info_array, startpoint, angle, gridsize, direction)
This function sets the origin of the coordinate system to startpoint and draws a grid according to angle and direction of a given line. The fields of the grid are specified by gridsize (default 1000m). A second grid with a five times higher resolution is created on a different layer. The function returns an array that contains information about the grid. Each array field refers to a node on the grid and manly contains information about objects positioned on the grid.





make_hwy (grid_info_array, level)
There are three types of highways. The one on the top level switches the side and level every nine kilometer, the highway below every three kilometer and the one on the button each kilometer. All of the highway systems are drawn on a different layer. To allow for an organic growth of the city, each call of this function only draws one leg of nine kilometers. This function calls three subfunktions that contain the parameterized and three dimensional highway elements (make_street, make_curve, make_colum). Information about the street system is added to the grid_info_array.






make_street (point_1, point_2, hight_1, hight_2, width)
This function draws a three dimensional element with a standard thickness and given width starting at point 1 on hight 1 and ending at point 2 and hight 2.

make_curve (point_1, point_2, width_1, with_2)
Alike make_street this function draws a curve which endpoints can differ in width but not in height above ground.




make_colum (position)
This draws a column at a specific point on the center axis of a highway to make bridges look more realistic.


make_public_buildings (position)
This function is supposed to randomly generate public buildings within a defined area of three square kilometers. By using the make_random function the make_bublic_buildings function defines a point near the center of the specified area. From this point, it creates a radial line that is randomly divided into three or four segments. The random offset of the previously defined points defines the final spine. More spines are created in random directions until attempts to create new spines in-between existing ones become less successful. Every new spine is transformed into a tree dimensional object and tested against intersecting elements. Each object can independently change in object height and height above ground.




make_office_buildings (position)
This function operates on a generic basis. On a given grid consisting of 25 squares each, the function decides for one edge point to place the first building. From there, the function randomly chooses between one and four directions to build additional buildings. A new building is not built if a path points outside the building grid (X) or if the function decides not to consider this direction (D). This function operates recursively and therefore is best visualized in a tree structure (see below). The buildings are in most cases connected by horizontal building elements. The function randomly decides whether or not two vertical buildings are connected by horizontal ones and stores this information in an array (see below).




make_resident_buildings (position)
Resident buildings are placed between streets generated by the make_street function. Almost every decision is made randomly. The distance of a building from the street has a tendency of being close to the street and every new building created has a tendency to be either very close or very far to previously created buildings. Every function call creates buildings along one street.




make_street (position)
This function creates streets perpendicular to the main axis. Every new generation of streets is influenced by the previous generation. This avoids streets from having random length's but a smooth spine like outside boundary. This function also calls make_random and submits as the minimum and maximum values two offset values taken from the previous street length. An absolute minimum and maximum length is defined to avoid over length's.