pioneerspacesim/pioneer — pull request #1503 by Ae-2222 (2012-09-11 13:31:50+00:00)
Title: Fix landing pads being buried on asteroids (better starport placement)

A quick extension of the code that relocates starports if they are underwater.
* 6 points around the starport center are checked to see if variation in height from the center exceeds a maximum limit.
* If conditions are not met a 100 random locations are tried. The best fit is used for the new starport.
* Does not guarantee a match will be found, and if planets are very spikey it might be impossible.
* Does not check other buildings are buried, though it increases the likely hood the city is an a smooth area.

This sidesteps/mitigates the landing pads being buried mentioned in issue %7.

***

Question, To Do:
To configure the limits on height variation it helps to know:
* what the distance from the center of the starport model to the outer edges of the landing pad are.
* what the height of the landing pads are relative to the starport center.

**Modellers?**

As it is points at 20m distance are checked for height variation of 2m, and this solves the issue for Enki Catena.

Debug log:
````
Enki Catena: try no: 0, Match found: 0, best variation in previous results 10000000000.000000, variationMax this try: 7.653321, maxHeightVariation: 4.000000
Enki Catena: try no: 1, Match found: 0, best variation in previous results 7.653321, variationMax this try: 6.459278, maxHeightVariation: 4.000000
Enki Catena: try no: 2, Match found: 0, best variation in previous results 6.459278, variationMax this try: 5.423658, maxHeightVariation: 4.000000
Enki Catena: try no: 3, Match found: 0, best variation in previous results 5.423658, variationMax this try: 6.084463, maxHeightVariation: 4.000000
Enki Catena: try no: 4, Match found: 1, best variation in previous results 5.423658, variationMax this try: 1.145718, maxHeightVariation: 4.000000
````

***Screenshots:***
Enki catena relocated:
![](http://i.imgur.com/SlCge.png)