CCCoreLib icon indicating copy to clipboard operation
CCCoreLib copied to clipboard

Replace CC_RAD_TO_DEG/CC_DEG_TO_RAD with inline methods

Open asmaloney opened this issue 5 years ago • 3 comments

Describe the feature you would like

Replacing these constants with inlines would make code more readable and help eliminate casting and compiler warnings.

CCLib::CC_RAD_TO_DEG*phi

becomes

CCLib::radiansToDegrees( phi )

(Move strategy here from comment below.)

Because this touches a lot of math, I'm going to do this in multiple steps so it can be reviewed more easily.

  • [x] Add CCMath.h, mark RAD_TO_DEG as deprecated, and commit CCCoreLib
  • [x] Change all occurrences in CloudCompare and wait for code review
  • [x] Mark DEG_TO_RAD as deprecated and commit CCCoreLib
  • [x] Change all occurrences in CloudCompare and wait for code review
  • [x] Mark ZERO_TOLERANCE as deprecated and commit CCCoreLib
  • [x] Change all occurrences in CloudCompare and wait for code review
  • [ ] Once everything is converted, remove RAD_TO_DEG, DEG_TO_RAD, and ZERO_TOLERANCE

asmaloney avatar Apr 24 '20 12:04 asmaloney

Why not

dgirardeau avatar Apr 24 '20 16:04 dgirardeau

So the next question is where do these new methods (and the ZERO_TOLERANCE ones) live? They are no longer constants.

Maybe a new CCMath.h?

asmaloney avatar Apr 25 '20 11:04 asmaloney

Yes why not!

dgirardeau avatar Apr 25 '20 18:04 dgirardeau