tesseract-ocr / tesseract

Tesseract Open Source OCR Engine (main repository)
https://tesseract-ocr.github.io/
Apache License 2.0
59.53k stars 9.23k forks source link

Fix FP exception in Wordrec::angle_change (issue #4242) #4243

Closed stweil closed 1 month ago

stweil commented 1 month ago

std::asin only allows arguments in [-1, 1], but rounding errors can produce values which are slightly outside of this range and which would cause a FP exception (or wrong calculation results).

Rename also the internally used function TPOINT::length to TPOINT::length2 because it calculates the square of the length.

amitdo commented 1 month ago

Thanks!