2013/6/23 Barend Gehrels <barend@xs4all.nl>

What is the difference between view::as_centroid and the normal return_centroid? Same question for envelope. IMO all these calls are redundant - we have this already. What does as_bounds do?


The functions we have converts one Geometry into another. View preferably would store reference and provide needed data without conversion. And if someone wanted to convert the geometry because he want to reuse it somehow, he probably should use other method than view.

view::as_centroid for sphere would just access center's coordinates using get<>(), for box it could calculate it on the fly using min and max coordinate, all without the conversion, and storing of additional Point. For any geometry using Points range, this could also be calculated on the fly for one Dimension, in some cases this could be preferable, e.g. when coordinates musn't be calculated for all dimensions.

The same is true with envelope, e.g. envelope's min and max corners for Sphere, Point, even for Polygons could be calculated on the fly, there is no need to create additional Box, especially for Points.

As for bounds(). I'm using this kind of function in the Index. It is a generalization of envelope() and can calculate bounding objects of arbitrary type, e.g. bounding box or sphere.

Regards,
Adam