Ultimaker / CuraEngine

Powerful, fast and robust engine for converting 3D models into g-code instructions for 3D printers. It is part of the larger open source project Cura.
https://ultimaker.com/en/products/cura-software
GNU Affero General Public License v3.0
1.69k stars 887 forks source link

Fix crash when using tangent on angles with PI/2 value #2110

Closed wawanbreton closed 4 months ago

wawanbreton commented 4 months ago

std::tan with a value of PI/2 works but returns a huge number, which will crash subsequent processings (like offsetting a polygon with this value). A function has been added to process a "safe tangent" calculation that return a big but not huge number. There was previously a similar safety in the code, but it was completely inefficient...

CURA-11804

Note: unit tests are fixed in an other branch (not merged at the time of writing this)