[QGIS-Developer] QgsTriangle.angles() return wrong values ?

Nicolas Godet nicolas.godet at outlook.fr
Sat Dec 4 04:52:44 PST 2021


Dear devs,

I have issues with the return of QgsTriangle.angles().
https://qgis.org/pyqgis/master/core/QgsTriangle.html?highlight=qgstriangle#qgis.core.QgsTriangle.angles

Here is an example:

>>> triangle = QgsTriangle()
>>> triangle.setExteriorRing(QgsLineString([QgsPoint(78598.328125, 330538.375, 0), QgsPoint(78606.3203125, 330544, 0), QgsPoint(78601.46875, 330550.90625, 0), QgsPoint(78598.328125, 330538.375, 0)]))
>>> triangle.angles()
[0.7119509950830287, 0.0008857138004074727, 0.85795961791146]
>>> [math.degrees(a) for a in triangle.angles()]
[40.79178723839677, 0.05074766261984076, 49.157465098983366]

If we display this triangle, none of the angles have such a low angle.
[cid:e23c990e-fd85-40e1-b5dc-158e5b175048]
https://prnt.sc/21p9ju6


We should have a near-90° angle, which we don't...

https://www.triangle-calculator.com/?what=vc&a=78598.328125&a1=330538.375&3dd=3D&a2=&b=78606.3203125&b1=330544&b2=&c=78601.46875&c1=330550.90625&c2=&submit=Solve&3d=0

Am I doing this wrong ?

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20211204/0330e92c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 3057 bytes
Desc: image.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20211204/0330e92c/attachment.png>


More information about the QGIS-Developer mailing list