Boost logo

Geometry :

Subject: [geometry] Spherical area
From: Vissarion Fysikopoulos (vissarion.fysikopoulos_at_[hidden])
Date: 2016-07-07 14:20:42

Hi all,

I am working on the computation of the spherical area of a polygon. I
would like to discuss two topics.

A. Currently Boost.Geometry has a strategy called area_huiller (there is
a typo, the right name is Huilier). Basically, this strategy adds the
signed areas of the triangles formed by the North pole and a segment of
the polygon.

Apart from the typo there are two more serious problems about this

1) Accuracy problems because of badly conditioned triangles (cf.

2) Incorrect results in corner cases: polygons that contain a pole,
polygons that has a pole as a vertex (cf.

Problem 1) is fixed by using another strategy (let me call it
area_trapezoidal) that adds the areas of the "spherical trapezoids" that
formed by each segment of the polygon tow meridian segments starting
from segment's endpoints and end at the equator, and the corresponding
equator segment. See the last formula in

Problem 2) can be solved independently in both strategies, by keeping
track whether the polygon encircles the South pole and then subtract a
quantity---4*\pi or 2*\pi depending on the strategy---from the result.

For the case of polygons that have South pole as a vertex (sub-case of
Problem 2), area_huiller strategy should do more work (either switch the
computation using the North pole or count the angle of the polygon on
South pole and subtract the corresponding quantity).

The first question here is: does it worth the effort to implement fixes
for area_huiller since the trapezoidal one seems to be supreme? Do you
have any test case where you need a formula such as area_huiller, i.e.
it assumes that we decompose the polygon to triangles? My opinion is the
area_huiller is redundant and we can remove it.

Another advantage of area_trapezoidal is that it can be used as a basis
for geographic area, which will be my next step.

B. There is a natural question on the semantics of the spherical polygon
area. Given a polygon on a sphere is not clear if we refer to the
polygon with the smallest enclosing area or it's complement. Also, I
guess that we assume that the segments of a polygon are geodesics to
avoid cases of polygons with segments that wrap around the globe. For
example POLYGON((1 1, -1 1, -1 -1, 1 -1, 1 1)) can be assumed to wrap
around the sphere or not. With the assumption of geodesic segments this
is uniquely defined.

This issue is connected to whether we allow a polygon to have negative
area. A polygon admits two orientations. The one corresponds to positive
area. The other either corresponds to the same value of area negated or
to the area of the complement of the polygon. I would go for the first
definition since it seems that will be more compatible to cartesian case.

 From your experience with Boost.Geometry what do you think is the best

Any comment or feedback is more than welcome!

Best regards,

Geometry list run by mateusz at