Opened 18 years ago
Closed 16 years ago
#257 closed defect (fixed)
Catch error if polygons are warped
| Reported by: | ole | Owned by: | James Hudson |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Functionality and features | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Petar Milevsky of Wollongong created a mesh with a warped polygon (see attached). A mesh was created, but excessive values for stage and momentum occurred. ANUGA should catch this condition and raise a meaningful exception.
See code in https://datamining.anu.edu.au/anuga/browser/anuga_work/debug
Turn it into a unit test and implement a proper exception.
Attachments (1)
Change History (6)
Changed 18 years ago by
| Attachment: | polygon2.png added |
|---|
comment:1 Changed 17 years ago by
| Owner: | changed from ole to jane |
|---|
A simple algorithm would check each segment against every other and use the newly developed intersection algorithm to detect crossings. The algorithmic complexity would be N2/2 if N is the number of segments, but given the expected size of polygons this seems like a good start.
comment:2 Changed 16 years ago by
| Owner: | changed from jane to James Hudson |
|---|
This error could probably be caught while building the octree.
comment:3 Changed 16 years ago by
| Status: | new → assigned |
|---|
An O(n log n) algorithm: http://www.lems.brown.edu/~wq/projects/cs252.html
comment:4 Changed 16 years ago by
NOTE: This is the same bug as #346. We need a fast algorithm to convert complex polygons to concave ones, or raise an exception on complex polygons with an algorithm such as this:
http://www.lems.brown.edu/~wq/projects/cs252.html
I've already implemeted a brute-force check that has found some pathological data in the unit tests.
comment:5 Changed 16 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Rev 7690 - exception is raised on a pathological poly. An O(n log n) algorithm is used.
Also, one of the files used for the unit tests, mainland_only.csv, had a bad poly, and this has been fixed by hand.

This is a polygon that causes a bad mesh