Members
currentEdge
These variables hold the indices of the two points of that edge and the location of them as a Vector2D.
- Source:
index
Currently iterated item of possibleEdges that is either used as a mountainrange or removed from the possibleEdges.
- Source:
maxDegree
Highest number of mountainranges that can meet in one point (maximum degree of each vertex).
- Source:
minDistance
Minimum geometric distance between two mountains that don't end in one place (disjoint edges).
- Source:
pathplacer
These parameters paint the mountainranges after their location was determined.
- Source:
possibleEdges
Each possible edge is an array containing two vertex indices.
The algorithm adds possible edges consecutively and removes subsequently invalid edges.
- Source:
vertexDegree
Number of mountainranges starting or ending at the given point.
- Source:
vertices
Array of Vector2D locations where a mountainrange can start or end.
- Source:
verticesConnectable
A two-dimensional array of booleans that are true if the two corresponding vertices may be connected by a new edge (mountainrange).
It is initialized with some points that should never be connected and updated with every placed edge.
The purpose is to rule out any cycles in the graph, i.e. prevent any territory enclosed by mountainranges.
- Source:
Methods
CreateMountainRanges()
This is the only function meant to be publicly accessible.
- Source:
HasCycles()
Tests using depth-first-search if the graph according to pointsConnectable contains a cycle,
i.e. if adding the currentEdge would result in an area enclosed by mountainranges.
- Source:
RemoveInvalidEdges()
Remove all edges that are too close to the current mountainrange or intersect.
- Source: