https://bugs.documentfoundation.org/show_bug.cgi?id=146479
Bug ID: 146479
Summary: Use basegfx fTools for converting the angle unit
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
There are many places in the code that converting the angle unit is needed.
Either from radians (rad) to degrees (deg), or vice versa. Some of these unit
conversions are now done using direct usage of arithmetic operations (*/). A
better approach would be using basegfx fTools methods. See
'include/basegfx/numeric/ftools.hxx' in the LibreOffice source code.
For example, consider this expression:
3.14159265359/180.0*fAngle
One can easily write it in a better form as:
basegfx::deg2rad(fAngle)
There are even other interesting usages of this function:
double fRad = basegfx::deg2rad(nMSORotationAngle / 60000.0)
can be written as:
double fRad = basegfx::deg2rad<60000>(nMSORotationAngle);
See these example commits:
https://git.libreoffice.org/core/+/b0ce4e848f786a2f452a6a6e426df4b95af4da3c%5E%21/
https://git.libreoffice.org/core/+/7ff2c9cfc5fa8c261b1f7f959172f60255fcf617%5E%21/
This search provides some instances of the issue, although not all of the
results are related:
git grep -F 3.14 *.cxx
A more restricted search can be:
git grep -F 3.14 *.cxx | grep 180
Please also take a look at bug 145759.
--
You are receiving this mail because:
You are the assignee for the bug.