libprimis
libprimis copied to clipboard
`RAD` does not equal one radian
The radian is a ratio equal to 180/π degrees or 1/(2π) revolutions. Because (of course) tools.h
has to do everything its way, the macro RAD
is defined as π/180 which is, of course, totally wrong.
The reason that RAD is inverted is for performance (division is slow and multiplication is fast), but this does not excuse the poor naming of the macro.
Does this mean that the value of RAD
should be changed, or that the macro name RAD
should be changed?
Yes
(actually, it's probably better to change the name, on the outside case that the division vs multiplication speed matters)
On further inspection, there are /RAD
events where the RAD
constant is the divisor, making it not only counterproductive but also confusing to use the inverse radian for RAD
.
I've taken a look at this and the codebase has both angle*RAD and angle/RAD as @no-lex said
Is the division vs multiplication thing really that impactful? If so, whould we make an INV_RAD = 180/π constant and change the codebase accordingly?
If not, the value of RAD should be π/180 imho I could start working on this once I have a clearer way of doing this
@no-lex Actually why isn't this issue closed? lol