On Fri, Dec 11, 2009 at 9:58 AM, cullam Bruce-Lockhart <culla...@yahoo.com>wrote:
> Hey gang. > I've just started putting together some visual aids in understanding what > happens in a scenery build process. That's well and good, but I'm having an > issue with terrafit. I've recently discovered that my understanding of how > terrafit works is wrong. I'd always assumed it took a grid of elevations, > calculated "planes of best fit", using the max error threshold, then > adjusted all the heights in the grid. It turns out that it actually leaves > the heights unchanged, but deletes any that aren't deemed significant. I've > been reading through terrafit.cc, but I can't figure out anything about what > it does to determine significance. > > Could anyone explain to me how terragear uses the error threshold to > determine what the list of points to be included is? > It's actually pretty straightforward and a cool algorithm. I'll try to briefly explain it here. Imagine two piles of grid/elevation points. (1) The pile of points that are "available" to use in the final fit (but haven't been selected yet) and (2) the pile of points that we have used for the final fit. We start out with all the grid elevation points in the "available" pile and an empty "used" pile. Step 1 is to select the 4 corners and move them from the "available" pile to the "used" pile. Now we triangulate the "used" pile of points (which should be two triangles at the start because we have 4 points.) We then look at all the "available" points and find the point that is furthest away from these triangular "planes". This point gets moved from the "available" pile to the "used" pile. Next we triangulate the "used" pile of points again (now with 5 points which will yield 3 triangle surfaces.) We look at all the remaining "available" points and find the point that is furthest away from the new surface and add that to the "used" pile. Now we triangulate the "used" points again (6 points, 4 triangles) find the available point that is furthest from this surface, add it to the set of used points, and keep repeating. We repeat this process, incrementally improving our fitted surface, until one of two conditions is met. (A) we hit a maximum number of final points (to keep final scenery complexity under control) or (B) none of the remaining points are outside our error threshold (i.e. if our error threshold was 10m, then all the remaining "available" points are within 10m of the fitted surface.) Regards, Curt. -- Curtis Olson: http://baron.flightgear.org/~curt/
------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel