Boost logo

Geometry :

Subject: [ggl] box_range is not a valid range
From: Barend Gehrels (barend)
Date: 2011-05-10 12:08:16


>
> Yes, I've seen the changes. The points_view/copy_policy is a good idea for things like box and segment, except the copy_policy seems to make extra copy of the box/segment while being constructed. Is it intended?

No, oops, must be by accident. Will be solved.

>
> Also, now that box_view is of ring type, why it cannot be an opened ring?
> The view concept is a kinda confusing concept. It mixes the range and geometry concepts.
> I think the view concept should follow the range concept.
> As mentioned in "[ggl] transform linestring into a ring", I found two geometry wrappers very useful in many aspects. Here they are:
>
> // warp X as linestring
> // X : could be ring, range
> // CloseOpenedRing : close presumed opened ring if set to true, otherwise do nothing
> template<class X, bool CloseOpenedRing = true>
> struct linestring_wrapper;
>
> // warp X as ring
> // X: could be linestring, range
> template<class X, bool ClockWise = true, bool Closed = false>
> class ring_wrapper;
>
> // convenient generators
> as_linestring(X);
> as_ring(X);
>
>
> now, a box_view bv could be either as_linestring(bv) or as_ring(bv), the view concept is then decoupled from geometry concept.
> of course, these wrappers could also handle box directly with box_view (since box is ring, we need to know if it is closed/clockwise, so box_view should take care both closure and winding and generate proper range).

Right, very good points. The general idea is like this, create a view_as function returning the geometry as another concept. Luke has mentioned this on this list as well, and Bruno seconded this idea, and I agree. So box_view is only the first step. view_as<ring_tag>(box) would replace (or make use of) it, and things as orientation and closure must be optionally specified somehow. view_as<polygon_tag>(ring) would make, for example, a polygon from a ring, and things can also be seen as linestring, multi-versions, etc.
However, that will not be included for 1.47

Regards, Barend

>

Sent from iPad.
Barend Gehrels
www.barendgehrels.nl


Geometry list run by mateusz at loskot.net