[QGIS-Developer] segmentSide and leftOfLine functions

Nyall Dawson nyall.dawson at gmail.com
Wed Jan 16 15:19:39 PST 2019


On Wed, 16 Jan 2019 at 00:08, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
>
> 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?

Should be fixed -- looks like needless duplication to me. One of the
methods should be deprecated and tagged for removal in QGIS 4.0.

(Don't deprecate the method which accepts double arguments -- we don't
want to force construction of QgsPoints if they aren't already
available)

Nyall

>
> Regards,
> Raymond
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list