|
Boost Users : |
Subject: Re: [Boost-users] Enquiry on boost.geometry and intersection()
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2018-11-16 13:25:02
Please do not top-post.
Zhang Qun wrote:
> Hi, Adam thanks for the reply and detailed code and explanation. Yes,
> it worked.
> I implemented as per your instructions but encountered a small
> problem. That is sometimes I realized the intersections points between
> the linestrings and the polygon are not in a "consistent" order, e.g.
> as shown in the below image, lingstring 1 has P1->P2; However, instead
> of P3->P4, linestring 2 is P4->P3. I actually expect linestring 2 is
> also along P3->P4 direction. Is this how it is supposed to be? Any
> workaround to solve this problem? Thanks.
>
> Presentation1.png
>
I don't know what happens in this case exactly because I don't know the
data but I would rather assume that Boost.Geometry doesn't care about
the order of linestring points (both directions represent the same
geometry). The simplest solution would be to check the direction of the
output and if needed reverse the linestrings manually or with bg::reverse().
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