Boost logo

Geometry :

Subject: Re: [geometry] one more variation to "transform"/"convert"/"for_each_point"
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2012-02-16 12:15:30


On 16 February 2012 16:34, Bruno Lalande <bruno.lalande_at_[hidden]> wrote:
> So the obvious solution seems to be to propose views.
>
> MyPolygon p;
> for_each(points_view(p), do_something_with_polygon_points);
> for_each(segments_view(p), do_something_with_polygon_segments);
> etc...
>
> Does that address your concern?

Bruno,

I have understood your idea that way.

Actually, I have thought it would be range:

for_each(points_range(p), do_something_with_polygon_points);
for_each(segments_range(p), do_something_with_polygon_segments);

though I'm more inclinde to view terminology. Boost.GIL uses image_view
and describes it as "lightweight object that interprets memory"

A view concept is well-settled in C++ world and also well integrates
with iterators -
"as a looking glass through which the objects can be looked at"
 - http://drdobbs.com/184401789

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

Geometry list run by mateusz at loskot.net