-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected behaviour of Radians roll-around? #40
Comments
This version returns the result I originally expected: Radians::Radians(const double &rhs):
m_val(rhs)
{
if(rhs > (2 * PI)) {
m_val = std::fmod(rhs, 2 * PI);
}
else if(rhs < 0.0) {
m_val = std::fmod(rhs, -(2 * PI));
}
} |
So Radians always produces a positive number between 0 and 2*PI. A negative number will be converted to its positive equivalent. So On a side note - I think there is mixing of types - ie |
Gotcha. I'll correct my test and implementation. |
Corrected in 89089d2 |
I was setting up tests for the current behaviour or Radians:
Sketchup-API-C-Wrapper/src/SUAPI-CppWrapper/Geometry.cpp
Lines 47 to 58 in 94aa35c
From what I understand of the code it's trying to cap the value by rolling around 2*PI.
For
7.0
I get0.71681469282041377
which I'd expect.For
-7.0
I get5.5663706143591725
which I did not expect.I would have thought I should get
-0.71681469282041377
.Am I wrong? Can you explain the intent so I can fill in test unit for this?
The text was updated successfully, but these errors were encountered: