Boost logo

Boost :

Subject: [boost] [geometry] area, length, centroid, behavior
From: Barend Gehrels (barend_at_[hidden])
Date: 2009-02-24 07:29:07


I would like to hear the opinion of potential geometry users on the list
about the following.

For the three geometries, point, linestring (= sequence of points), polygon:

What should the generic "area" algorithm return for point and linestring?
- 0 (zero)
- compiler error (so this function is not defined for them at all)
- exception
Personally I would feel for 0 (zero) because you can then request the
"area" in a generic collection, regardless of what is inside.

What should the generic "length" algorithm return for polygon?
- 0 (zero)
- its perimeter
- compiler error
- exception

What should the generic "centroid" algorithm return for point and
linestring?
- the point / the average its points
- compiler error
- exception
and for an invalid polygon (e.g. no points at all, or not closed)?
- exception
- return "false" (if centroid is passed as a reference parameter)
- ? (we've not always the compiler error option here because points are
usually stored in a runtime collection)

Thanks, Barend


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk