On Fri, Sep 9, 2011 at 2:49 PM, HB-GRAL wrote:
Hi Curt

>
> Thank you very much taking time for this.
>
> Now this is very interesting, a curved surface with a natural looking
> slope and correct hills. Can you point me to an example for this ? I
> guess my current examples like KSFO and EHAM etc. do only provide really
> flat areas. I did not see any small hills and valleys in FlightGear
> unless I saw the some "artificial shaders" from Frederic Bouvier
>

Hi Yves, every airport is an example of this, but maybe "hills and valleys"
is a bad description on my part. What it amounts to is that airports try to
be as flat as possible, but even flat areas aren't often as flat as we might
first think.  Go to any detailed airport chart and look at the runway
elevations for the ends of each runway.

Another way to think about this is that if you make all the airports
completely flat, you will have to deal with "cliffs" around the edges ...
either the airport is sunk down at some parts, and raised up in others
relative to the surrounding terrain.

Albuquerque, NM is one of the worst offenders I found.  You can't fit a
"flattened" airport into the surrounding terrain without the result looking
awful.

One solution would be to adjust the terrain to blend in with the airport and
that would be an ok thing to do. But the problem is that I like to torment
myself.  Here is approximately what I came up with.

1. Sample the raw terrain elevation across a regular grid that covers the
area of the airport.

2. I pick a 3d function that is sufficiently "curvy" so that it can flex
enough to reasonably match the terrain surface, but stiff enough so that it
doesn't have all kinds of crazy ups and downs.  Then I do a least squares
fit of this function to the data.  For example, let's say my function is z =
a*x^2 + b*y^2 + c*x*y + d*x + e*y + f.  Then the least squares fit would
pick the "best" coefficients: a, b, c, d, e, & f to fit this function
through the sampled terrain data.  Very much like a best fit of a line
through x, y data except extended to 3d with a bit more complicated
function.

3. Now that I have the coefficients for this function, I can use this
function to adjust the elevations of everything on the airport surface.

The cool thing is that now when you look at an airport built on crazy
terrain with maybe a valley falling away between two runways on one side,
the edges all around the airport match up reasonably well with the
surrounding terrain.

I won't say this is perfect in all areas ... some areas have stray data
points or noise in the terrain data that confuses things.  There's always a
chance of a mismatch between airport location terrain location so that we
are trying to put the airport on not quite the right underlying terrain.  My
thoughts for future extensions of this code would be to allow for creating
specific tuning parameters for airports that didn't behave well with the
default parameters.


> Hm, indeed, for the moment I was only looking to the two dimensional
> triangles and saw that genapts (or terragear) is calculating some small
> areas and probably "unnecessary" triangles like here at KSFO
> http://maptest.fgx.ch/screens/wired.png
>
> There are also a lot of duplicate items, or it looks like in the
> wire-frame view, but maybe this items are just very close to each other ...
>

Very likely this is a result of items very close to each other ...
especially if the airport designer placed or sized anything visually.

One huge problem you run into over and over and over and over again in
terragear/genapts work is numerical precision.  Things just get weird when
you get a gap between polygons that is about the size of one bit difference
between two double floating point values.  Logically correct polygon
manipulation code can blow up due to small numerical problems.  And when you
throw real world data (and the whole world) at your code, you *will* find
every possible way that numerical issues can blow up your code.

Anyway, how do you get the "natural" curved surface without height data
>

Well it's terragear so we have all the processed srtm heigh data already
available to just use.


> ? How are you interpolating between points ? I will try to understand
> this. Of course, I should not be that lazy and should have a look to the
> genapts or terragear code instead, right ;-)
>

Once we do the least squares fit of our function, then we can look up a z
value for any x, y point within our airport area.


> Generally I see that I miss some points here with airport generation and
> it is very different from generating shapes for a map.
>

Hope that helps clarify a bit.

Curt
-- 
Curtis Olson:
http://www.atiak.com - http://aem.umn.edu/~uav/
http://www.flightgear.org - http://gallinazo.flightgear.org
------------------------------------------------------------------------------
Malware Security Report: Protecting Your Business, Customers, and the 
Bottom Line. Protect your business and customers by understanding the 
threat from malware and how it can impact your online business. 
http://www.accelacomm.com/jaw/sfnl/114/51427462/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to