Ticket #3129 (closed enhancement: fixed)
Contour orientation
| Reported by: | GregersP | Owned by: | chaitanya |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.7.0 |
| Component: | Algorithms | Version: | unspecified |
| Severity: | normal | Keywords: | contour |
| Cc: | warmerdam |
Description
Hi,
When building and using contours I find it nice to have a knowledge of the uphill and downhill directions, eg. when placing labels one can place them facing up-hill, or simply deciding the up-hill direction when looking at a contour direction locally.
Therefore I have made a little patch to my local version of contours.cpp, which I attach to this ticket. My solution beares evidence of the fact that I do most of my programming in other languages than C++, though - as far as I have been able to test - it should be correct.
The idea behind the patch is simple: register if it is the left or the right side, which is the high side, and use this information to make the right side the "high side" (meaning a clockwise contour around a top) when ejecting the contours.
As stated earlier I have not been able to produce errors in my tests of the code, though my patch has the assumption that a saddle would not be connected "left - top" + "bottom - right". It is stated in the comment explaining the algorithm that this might happen, though when reading through the code, I was not able to actually pinpoint the location of this type of connection.

