Boost logo

Geometry :

Subject: [geometry] single-point polygons
From: Volker Schöch (vschoech_at_[hidden])
Date: 2014-10-13 10:08:29


It is now my understanding that WKT demands closing points for polygons. The following should be a well-formed polygon:

POLYGON((2079 1968,2301 1968,2079 1968))

Calling remove_spikes on the resulting polygon, and outputting it as WKT, results in the following (boost 1.56.0):

POLYGON((2079 1968))

My questions:

- Is this expected (no closing point)?

- I presume that for some algorithms (which?) the position of the single point makes a difference while for others, like difference, any empty polygon should create the same result. Is this correct?

- A year ago I made a note in my code that some algorithms cannot deal with input polygons that contain spikes (Boost.Geometry Overlay invalid input exception results). Therefore I established an invariant for my own polygons, that requires all polygons to be free of spikes. Is this still necessary?

- How is a single-point polygon different from a spike?

- If spikes are not allowed, how should single-point polygons be dealt with? Should they be considered empty, and have their last remaining point removed before passing them to, e.g., the difference algorithm? Or is some wrapper code required that avoids calling certain algorithms with single-point polygons?

My internal representation is oriented counter-clockwise and not closed, my point type is based on int.

Thanks
   Volker

--
Volker Schöch | vschoech_at_[hidden]<mailto:vschoech_at_[hidden]>
Senior Software Engineer
We are looking for C++ Developers: http://www.think-cell.com/career
________________________________
think-cell Software GmbH        http://www.think-cell.com>
Chausseestr. 8/E        phone / fax     +49 30 666473-10 / -19
10115 Berlin, Germany   US phone / fax  +1 800 891 8091 / +1 212 504 3039
Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schödl


Geometry list run by mateusz at loskot.net