Closing Gaps and Overlaps
The Close Gaps and Overlaps tool can be used to close the gaps (or overlaps) between a selection of polygon and/or polyline objects.
This functionality is of particular use for cleaning up polygons and polylines prior to Creating 2D Meshes, as it can be used to remove small gaps and overlaps that would otherwise cause many small triangles to be generated in the mesh.
To close gaps between objects:
- Select the objects to be cleaned. (Gaps between selected and unselected objects will not be closed. Special rules apply to cross section lines and bank lines, as described in Methodology below).
- Choose Geometry | Close gaps from the Model menu. The Close Gaps and Overlaps Dialog will be displayed.
- Specify the maximum size of any gap or overlap that is to be closed in the Where gap or overlap is smaller than field.
- Click Select to select all polygons and lines in the current selection that have gaps or overlaps that meet the maximum size specified. The number of gaps or overlaps found is reported. The current selection of objects is updated to include only those objects that meet the specified parameters.
- Click Close to close gaps and overlaps. The number closed is reported and may be different reported in the previous step, as the action of closing one gap may create another, which is also closed.
The tool attempts to close all gaps and overlaps in a single pass. Sometimes this is not possible. To check, press Select again. If more gaps are reported, press Close to close them. Repeat as necessary.
Methodology
The method for identifying and closing gaps and overlaps is as follows:
A gap or overlap is measured from a vertex on one polygon or line to the nearest point on the nearest line segment on any other selected polygon or line. If this is less than the specified maximum gap, then:
- If the nearest vertex on the line segment is also within the maximum gap distance, the first vertex is moved (snapped) to that location (unless an adjacent vertex on the same polygon or line is already snapped to that location, in which case the first vertex is simply removed)
- Otherwise, a new vertex is created on the line segment of the other polygon at the nearest point, and the first vertex is snapped to that location.
Special rules apply to cross-section lines and bank lines, as these lines have elevation and other data associated with each vertex and so in general it is not appropriate to create, move or delete vertices on these lines. The rules are:
- Only the end-vertices of a cross-section or bank line will be moved to snap them to another line or polygon. Internal vertices are never moved and vertices are never deleted.
- Vertices in other lines and polygons can snap only to the end-vertices of a cross-section or bank line. New vertices are never created.
The process of closing gaps is repeated along the boundary of a given polygon or line, in each direction, until none remain, whereupon the process moves on to the next selected object.
Because closing a gap between two objects has the potential to create a gap with a third object, the process does not necessarily result in zero gaps for the complete set of selected objects. This is the reason why the user may need to repeat the process, as described above.
Limitations
The Close Gaps and Overlaps tool cannot be used for river reaches and bridges due to their complex geometry. Instead, it is possible to apply the tool to the cross-section and bank lines, prior to building the river reaches and bridges, subject to the special rules for these lines noted above.
If a line or polygon boundary is extremely convoluted (for instance, if a loop is thin enough to bend back and re-enter a gap) then it is possible for the snapping process to cause the line or boundary to meet or cross itself. If suspected, this problem can be checked and sometimes corrected using the Simplify Object Geometry tool.
Multi-part polygons (i.e. polygons containing internal holes and/or islands) may not be handled correctly. Gaps should close correctly if the outer polygon is convex. If the outer polygon is concave, or there are overlaps, it is possible there will be incorrect snapping to holes or to the (hidden) line-segments that link the holes and outer polygon together.