These variables hold the indices of the two points of that edge and the location of them as a Vector2D.
Currently iterated item of possibleEdges that is either used as a mountainrange or removed from the possibleEdges.
Highest number of mountainranges that can meet in one point (maximum degree of each vertex).
Minimum geometric distance between two mountains that don't end in one place (disjoint edges).
These parameters paint the mountainranges after their location was determined.
Each possible edge is an array containing two vertex indices. The algorithm adds possible edges consecutively and removes subsequently invalid edges.
Number of mountainranges starting or ending at the given point.
Array of Vector2D locations where a mountainrange can start or end.
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.
This is the only function meant to be publicly accessible.
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.
Remove all edges that are too close to the current mountainrange or intersect.