Opened 9 years ago

Closed 7 years ago

#257 closed defect (fixed)

Catch error if polygons are warped

Reported by: ole Owned by: 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)

polygon2.png (36.1 KB) - added by ole 9 years ago.
This is a polygon that causes a bad mesh

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by ole

This is a polygon that causes a bad mesh

comment:1 Changed 9 years ago by ole

  • 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 7 years ago by hudson

  • Owner changed from jane to hudson

This error could probably be caught while building the octree.

comment:3 Changed 7 years ago by hudson

  • Status changed from new to assigned

comment:4 Changed 7 years ago by hudson

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 7 years ago by hudson

  • Resolution set to fixed
  • Status changed from assigned to 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.

Note: See TracTickets for help on using tickets.