<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Il 04/12/2021 13:52, Nicolas Godet ha scritto:<br>
<blockquote type="cite"
cite="mid:PA4P190MB11665DEECE547DE4FF0343508F6B9@PA4P190MB1166.EURP190.PROD.OUTLOOK.COM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>>>>
triangle.angles()
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
<div>[0.7119509950830287, 0.0008857138004074727,
0.85795961791146]</div>
<div>>>> [math.degrees(a) for a in triangle.angles()]</div>
[40.79178723839677, 0.05074766261984076, 49.157465098983366]<br>
</div>
<br>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 12pt; color: rgb(0, 0, 0);">
We should have a near-90° angle, which we don't...</div>
</blockquote>
<br>
Hi Nicolas,<br>
it seems the QgsTriangle::angles() fails to correctly return the
value of angles greater than 90° deg. (Pi/2 rad.).<br>
<br>
Actually the function code strangely subtract 90 to such angles:<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/qgis/QGIS/blob/dd0cd13a00998bc153c0b6519ea75038b57a6df5/src/core/geometry/qgstriangle.cpp#L397-L403">https://github.com/qgis/QGIS/blob/dd0cd13a00998bc153c0b6519ea75038b57a6df5/src/core/geometry/qgstriangle.cpp#L397-L403</a><br>
angles.append( ( a1 > M_PI_2 ? a1 - M_PI_2 : a1 ) );<br>
angles.append( ( a2 > M_PI_2 ? a2 - M_PI_2 : a2 ) );<br>
angles.append( ( a3 > M_PI_2 ? a3 - M_PI_2 : a3 ) );<br>
<br>
In fact, the correct value of the angle is 90.05074766261984076 deg.
and not 0.05074766261984076.<br>
<br>
Regards.<br>
<br>
Andrea<br>
</body>
</html>