Boost logo

Geometry :

Subject: [geometry] Negative distance?
From: Volker Schöch (vschoech_at_[hidden])
Date: 2012-03-08 02:47:03


Hi,

I am seeing negative results from the distance algorithm with boost::geometry::distance(MultiPolygon, Point). I wonder if this is a problem in my code, or a bug in GGL, or by design -- and in the latter case, what's the meaning of negative distances?

The boost::geometry documentation says:

> The function distance implements function Distance from the OGC Simple Feature Specification.

The OGC Simple Feature Specification says:

> Distance (anotherGeometry: Geometry):Double - Returns the shortest distance between any two Points in the two geometric objects as calculated in the spatial reference system of this geometric object. Because the geometries are closed, it is possible to find a point on each geometric object involved, such that the distance between these 2 points is the returned distance between their geometric objects.

I don't find my question explicitly answered there, but since in mathematical geometry distances are usually non-negative and there is no mentioning or explanation of why and how OGC would define negative distances, I assume it may be a bug?

I am using boost 1.48.0, my polygon type is oriented counter-clockwise and not closed, my point type is based on int.

Regards
   Volker

--
Volker Schöch | vschoech_at_[hidden]
Senior Software Engineer
think-cell Software GmbH | Chausseestr. 8/E | 10115 Berlin | Germany
http://www.think-cell.com | phone +49 30 666473-10 | US phone +1 800 891 8091
Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306
Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl

Geometry list run by mateusz at loskot.net