
Geometry : 
Subject: [geometry] get_turns L/L, L/A and is_collinear
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 20140505 05:54:02
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 nonspike 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?
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 list run by mateusz at loskot.net