Hopefully, we can start another clc06 test with this fix
- add lots of debug, in case more clipper issues uncovered
added --debug-areas= allows turning on debug for an area
can dump the accumulator when using it.
- fixed the swirlies round 2 workaround on tile output, rather than
stopping the load of polygons at arbitrary threshold.
(hopefully, we'll have a fix for this in simgear soon)
- modified ogr-decode (when using --texture-lines) to insert triangles
instead of self-intersecting trapezoids when the turn angle between
segments is too steep (hit this issue when experimenting with cgal-clipping)
we were adding a lot of self intersecting polys on line data
- needed to add gdal library to all executables that link against Polygon
TODO - combne Geometry and Polygon libs - they are completely joined, now.
- genapt850 : some airports (LSMM) have multiple airport boundaries.
This caused a lot of the airport to not get a smoothed base (so some landclass polys were not clipped against the airport). Changed boundary from a single ClosedPolygon to a list. Seems to work.
Some misc warnings cleanup in scheduler, and parser
- Clipper using accumulator results in a significant speed boots - enable clipper and the accumulator by default.
- ogr-decode - most of the crashes I'm getting are due to non-continuous roads. Within a line string, I create adjacent polys that snap correctly. On the ends, I generate 90 degree angles. Some linestrings should be consecutive. As a workaround, I am now extending every start and end poly of linestrings by 0.1 meters. It makes it better, but I need to do a better job of creating continuous roads. This will require some preprocessing of the entire shapefile. (Perhaps all line data shapefiles, to handle correct overpass / underpass logic)
- Increase epsilon when looking for intermediate nodes
(setup method for calling function to specify the bounding box and error
epsilon in case this had adverse effects on genapts)
This fixes many of the small vertical gaps (T-Junctions)
- Fix an issue with merge slivers. The clip mask optimization broke
merge slivers. WHen merging the slivers with a poly segment, it also
needs to be merged with the clip mask, so when the segments are
seperated from the mask, they include the sliver.
- Added to the shapefile debug.
--debug_shape=tileid:all generates shapefiles for every polygon in the tile
This is usefull to setup individual debug polys on subsequent passes.
Also added load, clip, and with_slivers and clean layers for debugging
--debug-dir=pathname points to the debug root directory. each tile will create a sub directory in this existing directory. (default is '.')
--debug-shapes=tileid:shape1,shape2,etc.. lists the shapes to debug within a tile
example: if the tesselator crashes in shape id '123', you can rerun with --debug-shapes=2678440:337
implemented the same bounding box optimization from tesselate in FixTJunctions. Also fixed a bounding box issue that could cause some
elevation points to be missed.
brought in the latest version of clipper - and moved the #define to the construct header
some debug cleanup (especially in polygon loading)
- generates an intermediate file for the whole linestring, but as seperate poly/texcoord pairs
- construct generates the union ofthe polys for the main clip routine
- intersection ot the original segment with the clipped mask gives the clipped segment
This cuts ~75% of clipping time for really complex tiles. 8 tiles for Madeira went from
4:45:00 to 1:04:00
- fix really bad facelist generation.
- add a face area list in superpoly - each triangle area was calculated twice
- cleanup contruct_bucket - calls a function for each step.
TODO : move groups of operations into their own files
i.e. load, clip, elevation, shared edges, and output
- some small optimizations made by storing triangle nodes in addition to triangle coordinates in TGSuperpoly. More can be done, here.
- Brute force methos of generating alist of faces for each nodes that the face has is completely brute force. Looking at original method, I think I can make it work, which should be a significant speedup.
- fixed exception in find_point_inside.
NOTE: second fix can cause some gaps, as the polygon cleaning can result in a smaller poly than the original. Need to clean polys after diff, before adding the result to the union.
I'm now able to build all of
adeira - and tile matchine looks good. Some gaps visible when roads are cleaned incorrectly.
- fixed tile matching using add_intermediate_nodes
- source code rearrangement phase 1 - remove a lot of libraries that are not used by other apps
- move some of the Buildtiles libraries that are used by other apps (and libs) into terragear lib directory
- debug message overhal - to show some progress.
TODO - not implemented yet
- caculate face nodes and save in superpoly (where the faces are stored)
- calculate node normals, and store in tg_nodes (where the nodes are stored)
TODO - bugs
- find_intermediate_nodes isn't working for a lot of roads - still many t-juntions making visible gaps
- flatten ocean nosed is also creating gaps
- there's a grey poly on madeira - need to investigate
- fix launch
- fix taxiway debug uninitialized variable
- fixed issue when child crashes, not timed out - detect the error
when we get notified that the socket has data, but no line is received
the resultant poly was huge, and I could run out of memory.
For closed polys, remove_dups() after snapping.
Also cleaned up the dump_xxx debug command line switches.
- now 1 based, not 0.
- debug_cp directory is the datasource name, so the directory need
not exist before running genapt850.
and after intermediate nodes are added.
If we snap before intermediate nodes are added, we generate extra slivers, as
the proximity for node insertion may fail when the extra node is snapped away
from the line we are checking
- remove gen_overrun, and the 'generic' gen_tex functions.
- removed rwy_common.cxx
NOTE: now, helipads don't share the same generate function as runway sections.
Maybe later they can be remerged...
which should make it easier to understand the code. If there are parts that can be generalized, I'll
pull these out. gen_runway_marking was only called from one place however...
Instead of cleaning polys after clipping, to get good triangulation, try to
clean them before clipping, snap the verticies to 1 1cm x 1cm grid, and
merge any resultant slivers back into adjacent polys.
This is very similar to how fgfs-construct worked.
Although the previous methos only failed on 3 airports, the results weren't
very good. There were lots of cracks, and mmissing triangles, as the polys were
cleaned.
New methos freezes on two airports during base triangulation, and crashes on four.
I think the quality of the generated airports overcomes the slight regression.
I also added some debug switches so I don't have to keep rebuilding from source
to debug crashes. --dump-rwy=xxx --dump-pvmt=xxx, --dump-feat=xxx and --dum-base=1
can be used to create shapefiles to debug the particular polys before clipping.
Currently, there needs to be a cp_debug directory to place the shapefiles into.
Probably need better debug infrastructure going forward...
NOTE: I turned off runway shoulder generation in this build. Polygon snapping for runways,
helipads, and shoulders not implemented yet. This may help on the failing airports.
This is next on my todo list.
Just three airports crashed, and no hangs. One of the crashes is still NZSP
I don't know if I'll fix this soon. It's the south pole problem with stuff
crossing the IDL.
- Added dome debug support for generating shapefiles from TGPolygon.
This allows directly creating shapefiles instead of chopping a poly, then
having to run poly2ogr on it. The API is flexible, allowing multiple
datafiles, and layers open simutaneously, and the features in the shapefiles
have a description field that can be set.
- Added a restart-id= which allows a bash script to check the exit value of genapts,
and automatically restart on the airport after the one that crashed.
I've included an example script I have used.
- Stability fixes:
1) actually, this is both stability, and graphical fix. Some airport linear
features and polygon contours were using bezier nodes for straight lines.
When the control point lies just outside the line, the parser would attempt to
draw a 'hook' unfortunately, some of my calcs return NAN, and sometimes you just
get crazy looking polys to attempt to clip - not good.
Fix is to check cubic and quadratic nodes to see if they should really be linear.
Substitute linear segments where apropriate.
2) Along the same line as 1, There are some really short bezier segments, that were
getting subdivided into the hard coded 8 segments. Now, if the approximately linear
distance of the curve is less than 4 meters, the curve is broken into 1/2 meter segments.
Likewise, if the curve is greater than 800 meters, the curve is broken into 100 meter
segments.
3) Sometimes, during clipping, degenerate ontours are created. Although these are cleaned
before triangulation, there were still issues with generating the accumulation poly with
the union operator, causing a crash. I now simplify, and reduce degeneracy on all polys
before clipping against the accumulator.
- Extra special bonus - successful completeion of an airport is printed in green :)
- ran through the last commit, and only 10 airports crashed / locked up.
- EICL, SSPK, and LFBT fix was to simplify the base polygon during cleaning
reduce_degeneracy() could also be used to fix the issue
2 polygons clipped against each other shared a vertex. This causes the
resulting contour to have a duplicate point with different line segments.
Luckily, clipper's polygon simplification cleans this up by adding a
hole contour. In the above airports, triangulation suceeded, but I'm
not 100% convinced it will work for all cases. reduce_degeneracy() will,
at the expense of modified geometry (very noticible)
- EGLW and SWCH (I think - can't read my own writing) were fixed by expanding
the user defined boundary by 2 meters for the base, and 5 meters for the
clearing. These 2 airports had the user defined boundary touching the exact
airport layout. When the base was diffed with the accumulation buffer, the
resulting polygon was NIL.
Starting a whole new stability test from the beginning to check for
regressions. Down to 5 airports with isses left.
- created a new function that will take the higher elevated dup
(as most are ar -9999.0 at initialization. Use the one with real elevation data)
Fixes UMNB
- found a bug in the polygon library: remove_small_cycles.
If the cycle wrapped around the end of the point list, it went undetected.
I created a new detection method, that is slower, but handles this case
FIXES DNAK
- Added a new polygon cleaner function remove_spikes
triangulation library doesn't like when segments for close to 0 degree
angles. When such an angle is seen (<.1 degree), the point is removed
FIXES LFKJ (linear features) and YBAF (pavements and base polys)
- I also modified the runway shoulder code to use 11+ meter width.
I was having problens with polys very close to this leaving a gap.
The code needs revisiting, since I now see z-fighting betwen the shoulder
and grass border.
From this point on, all my checkins need to get past the previous checkins
airport. I am now parsing past LFSB
- When adding intermediate nodes, keep linear feature nodes list seperate from the rest, as they are
seperate accumulation buffers.
- Revert expand poly by 5cm. It broke more airports than it fixed :(
- Going back to GPC as well.
Feature Fixes
- finally got around to the last segment in closed linear features.
I think I am feature complete now.
Remaining issues.
- I still see terrain holes between the base and clearing polys when an airport traverses a tile
boundary. I'm not sure where to start here, as genapt doesn't really know about the tile boundary.
(Is the clearing part of the tile construction? - need to look into this)
)
- used to expand pavement polygons so they overlap slightly (5cm)
This prevents slivers being formed between pavements when designers
add their own taxiway shoulders, and try to line them up instead of
placing the boundary 'under' the taxiway.
- also useed to create the default airport base. This allows the base
to follow the taxiways better - allowing concave boundaries, instead
of the previous convex hull.
Memory leaks squashed. Fixed several memory leaks reported by valgrind.
- GenApt850 can now run forever (or at least until it segfaults)
Very long linear segments in linear features are now broken up to
avoid triangulation errors
Added back some clipper boolean operations (diff and union). These can
be used instead of the GPC functions by using tgPolyGonDiffClipper and
tgPolygonUnionClipper. GPC had crashed in a few airports when clipping
linear features. Using the clipper routines don't crash. More investigation
is needed. It may be something about the polygons being clipped more that
the clipping action itself. In these problem airports, there are some
linear features extending far from the airport.
( I had thought those issues were fixed :( )
More warning cleanups.
success / failure. I have some local changes to the lib to support it, but
they aren't verified. Checking in the support, that always returns success.
- allow clipper and GPC libraries to be included together.
I need clipper for expanding polys, but I'm still using GPC for clipping.
- break up and expand shoulder polys, so they overlap runways.
This keeps cracks from forming between the shoulder and runway
do to roundoff error
- Add verbose option to polygon_tesselate functions to aid in debugging
can set at runtime to produce triangulation output for just 1 poly.
- add remove_small_cycles to poly cleanup routines before triangulation
- more warnings cleanup in ClosePoly.cxx
- add more output in normal execution path, as some airports can go for
hours without printing any status. Hard to tell if it's locked up
- use ogr-decode with new option --texture-lines to generate polygons
with texture info
- possible fix for triangulation errors when triangulating each poly by
itself.
(It's worked for me, but more testing needed)
- Still using GPC for clipping. CLIPPER adds time, and looks to have
more errors. More testing needed here as well.
Simply edit the #define in polygon.h to choose clipping library.
Major TODOs:
1) There is 1 tile (with the most heavy OSM data) that blows up, and I get huge
road textured polys all over the place. Must be an overrun somewhere.
2) Lake / Ocean smoothing. The current algorithm handles all nodes at once. I'm
going to need to modify for the new structure
3) neighbor tile matching. This actually doesn't look so bad without it implemented.
The old method would add points in the triangulator. If a point was added on the
tile boundary, a t-junction would be created. Points are no longer added in triangulation,
so the polygon splitting in ogr-decode should make the points equal on each side of
the tile boundary. (I haven't seen any t-junctions, at least)
4) cleanup - this is a bit of a mess. I really want to refactor to make the code more understandable.
- moved poly_extra from genapts to polygon library (add intermediate nodes)
- change TGPolyList to arrays of superpolys and texparams in preperation for
generating tex coordinates for line data