# Re: [Flightgear-devel] GenAirports logic/process

`Paul Surgeon wrote:`

I can't find any documentation on the general logic/process that GenAirports uses to generate an airport. The readme's only explain how to use the apps.

Please don't tell me that the source code is self explanatory - not everyone has an IQ of 150 to understand what Curt coded or the patience to step through the code with a debugger.
Heck, even I battle to understand my code when I see it a few months down the line. ;-)

- Does it build a fixed size grid that the runways and taxiways get "strapped down" onto or is it an iregular grid system like the rest of the terrain?
- How is the terrain averaging done?

I'm interested in how the ploygons are built and layered on top of each other.

`Hi Paul,`

There is no polygon layering with the airports right now ... a vertical vector placed anywhere over the airport surface will only intersect one polygon.

The airport itself is built out of an "irregular" triangle network, although there is a distinct pattern used to build the individual runways and lay down the different marking textures.

`Airport surfaces ... I'm tired, but I'll take a shot at explaining it.`

`1. Find the horizontal bounding box of the airport.`

2. Divide this bounding box up into a "regular grid" ... something like one point every 500 or 700 meters (I forget the actual number.) A finer grid gives you more variations, a courser grid gives you a smoother surface.

3. For each point in the course grid, sample a much larger number of points from the raw terrain data, then average them to come up with the elevation for that point. I seem to recall doing something brilliant relating to just sampling points on or near a runway so odd terrain between runways doesn't throw off the whole process.

4. Add some contraints to the course grid ... limit the overall amount of elevation change across the grid, also limit the maximum slope between adjacent grid points.

5. Fit a nurbs surface to the adjusted raw grid. The nurbs surface typically provides nice and relatively natural slopes and hills and dips. Doing this over a course grid filters out all the fine grained noise. Some of the other checks and balances help keep things sane if there is weird terrain data thrown into the mix.

`6.  Generate the airport in 2d, then drape it over this nurbs surface.`

`Regards,`

`Curt.`

--
Curtis Olson http://www.flightgear.org/~curt HumanFIRST Program http://www.humanfirst.umn.edu/
FlightGear Project http://www.flightgear.org
Unique text: 2f585eeea02e2c79d7b1d8c4963bae2d

```_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d
```