[QGIS-Developer] segmentSide and leftOfLine functions

Raymond Nijssen r.nijssen at terglobo.nl
Tue Jan 15 06:08:22 PST 2019


Since 2 months there's a new function called leftOfLine() which 
calculates if a point is left or right from a line(segment). While using 
it I wondered why:

It returns
-1 if point is on left side
1 if point is on right side

cause I would expect the opposite result, or call the function 
rightOfLine().



When diving into this, I also found the function segmentSide() which 
calculates the exact same (but having a better name).


Here they are

segmentSide:

https://github.com/qgis/QGIS/blob/63a34455215d25851d648409bef9913bb0906e3f/src/core/geometry/qgsgeometryutils.cpp#L988


leftOfLine:

https://github.com/qgis/QGIS/blob/63a34455215d25851d648409bef9913bb0906e3f/src/core/geometry/qgsgeometryutils.cpp#L583

Am I missing something or should this be fixed?

Regards,
Raymond



More information about the QGIS-Developer mailing list