# [TowerTalk] terrain profile algorithm

Sat Jun 16 10:18:25 PDT 2012

```On 6/16/12 9:55 AM, Ian White GM3SEK wrote:
> Jim Lux wrote:
>> I'm looking for an algorithm for my "generate all profiles for HFTA" app..
>> I've taken a couple trivial shots at this, but I'm pretty sure someone
>> out there knows of a "better way".
>>
>> here's what I want..
>>
>> I have an array of heights vs distance at fairly close post spacings (on
>> the order of 10 meters) maybe 1000 points or so, representing the
>> profile along a particular radial.  What I want to do is "compress" that
>> into about 100 or so segments that are connected (e.g. HFTA input).
>> That is, I want to convert that to a series of x,y coordinates connected
>> by straight lines that "adequately" represents the terrain.
>>
>> I started with a simple "if the adjacent point is within X meters in
>> altitude, then collapse the two into one", but that produces profiles
>> that somehow don't look right (and I can't say much about their HFTA
>> fidelity).  If the underlying terrain were a ziggurat or mesas with
>> valleys, it would probably work, but it turns a gentle slope into a
>> staircase.
>>
>> This is a classic problem in cartographic generalization, and, as it
>> happens, this kind of profile is well represented by a fractal, but not
>> that this helps me much.  I was hoping that someone out there knew of a
>> clever way to do it.
>>
>> Preferably in Python, since that's what I've written everything else in,
>> but I can convert anything.. so if you have one written in COBOL, that's
>> fine.
>> _______________________________________________
>
> If may be easier than you think, because HFTA already makes a linear
> extrapolation between data points, regardless of horizontal separation.

Does it?  or does it treat each segment as a flat plate a'la the paper
by Breakall, et al.

If it were doing a raytracing physical optics approach, then yes, you'd
cast the ray to the point of intersection with the surface, figure out
the angle, determine the reflection, and move on.

But I seem to recall that HFTA does something more like GTD.
```