Boost logo

Geometry :

Subject: Re: [geometry] get_turns L/L, L/A and is_collinear
From: Menelaos Karavelas (menelaos.karavelas_at_[hidden])
Date: 2014-05-05 07:54:38


Hi Adam.

On 05/05/2014 12:54 μμ, Adam Wulkiewicz wrote:
> Hi,
>
> I added tests for is_collinear and fixed some errors yesterday. I also
> unified the value of is_collinear for the first endpoint, it's FALSE
> since there is no preceeding segment for the first endpoint.
>
> For spikes collinear to some segment 2 turns are generated for the
> spike point, one operation_block and one operation_intersection, both
> has is_colinear set to TRUE (in the non-spike IP, if a turn has
> operation_intersection then is_collinear wil be FALSE because the
> Linestring is going in from the outside of the second Linestring).
>
> An interesting edge case is the intersection of 2 equal spikes. e.g. for:
>
> "MULTILINESTRING((0 0,1 1,0 0))",
> "MULTILINESTRING((0 0,1 1,0 0))"
>
> those turns will be created:
>
> ("tii++")("tix+=")("txi=+")("txx==")("ecc==")
>
> but for the opposite case (2 spikes of the same length and in the same
> place but opposite)
>
> "MULTILINESTRING((0 0,1 1,0 0))",
> "MULTILINESTRING((1 1,0 0,1 1))"
>
> those will be generated:
>
> ("tix+=")("tii+=")("txx==")("txi==")
> ("txi=+")("tii=+")("txx==")("tix=="))
>
> because for each spike (duplicated) there are 2 intersecting segments
> and we have 2 ends of which gives 2*2*2=8 turns.
>
> Are you ok with this behavior?
>

AFAIC, this behavior is fine with me (from the point of view of set
operations for linear geometries).

FYI, I just added these two examples in the unit tests for difference
and intersection of linear geometries.

- m.

> You may test additional cases adding them to the
> test/algorithms/overlay/get_turns_linear_linear.cpp
>
> FYI, each string defines the turn like this:
> <method><operation for G1><operation for G2><is_collinear for
> G1><is_collinear for G2>
>
> t - method_touch
> e - method_equal
> i - operation_intersection
> x - operation_blocked
> = - is_collinear == TRUE
> + - is_collinear == FALSE
>
> Regards,
> Adam
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/geometry


Geometry list run by mateusz at loskot.net