Boost logo

Boost Users :

Subject: Re: [Boost-users] making a geometry half closed
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2014-01-26 18:00:15


Hi,

Sean Farrow wrote:
>
> Hi,
>
> Ok, take a windows RECT structure:
>
> typedefstruct_RECT {
>
> LONG left;
>
> LONG top;
>
> LONG right;
>
> LONG bottom;
>
> } RECT, *PRECT;
>
> The remarks then state:
>
> By convention, the right and bottom edges of the rectangle are
> normally considered exclusive. In other words, the pixel whose
> coordinates are ( right, bottom ) lies immediately outside of the
> rectangle. For example, when RECT is passed to the FillRect function,
> the rectangle is filled up to, but not including, the right column and
> bottom row of pixels.
>
> How can I gain the same behaviour when doing equals, overlaps etc.?
>
> Any help appreciated.
>
> Cheers
>
> Sean.
>
> *From:*Boost-users [mailto:boost-users-bounces_at_[hidden]] *On
> Behalf Of *Barend Gehrels
> *Sent:* 26 January 2014 21:49
> *To:* boost-users_at_[hidden]
> *Subject:* Re: [Boost-users] making a geometry half closed
>
> Hi Sean,
>
> Sean Farrow wrote On 26-1-2014 14:44:
>
> Hi,
>
> From what I understand any boost geometry is fully closed. Is
> there a way of making a geometry half closed, such that the bottom
> row is not included?
>
> I'm needing to do this with a Box2D$Values.
>
> Any help appreciated.
>
>
> No, this is not really implemented. Which problem do you have in mind?
> For example a "touch" relationship where two geometries touch each
> other, would this differ if they touch the upper row instead of the
> lower row?
>
> The within-algorithm (for point-in-box) considers a point within if it
> is completely inside. That can be finetuned by supplying a strategy
> which considers bottom-row / right row.
>

The coordinates aren't floating points. Maybe using right-1 for
<max_corner, 0> and bottom-1 for <max_corner, 1> could work? It probably
depends on the use case.

Just a quick thought. Coordinates are increasing top-down right? E.g.
polygons marked as CW in Boost.Geometry would appear as CCW on your screen.

Regards,
Adam



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net