History

use radians instead of degrees (almost) everywhere

Andrew Meadows committed 12 years ago

Commit aa8c2fc1 parent de8165c51 files · +302 −306Browse files

Showing the changes to libraries/script-engine/src/EventTypes.cpp (1 of 51 files). Show all

Unified · Split

libraries/script-engine/src/EventTypes.cpp+2−3
@@ -387,11 +387,10 @@ TouchEvent::TouchEvent(const QTouchEvent& event, const TouchEvent& other) { · 386 unmodified lines
387387 calculateMetaAttributes(other);
388388 }
389389
390−// returns the degrees between two points (note: 0 degrees is 'east')
390+// returns the angle (in degrees) between two points (note: 0 degrees is 'east')
391391 float angleBetweenPoints(const glm::vec2& a, const glm::vec2& b ) {
392392 glm::vec2 length = b - a;
393− float radian = std::atan2(length.y, length.x);
394− float angle = radian * 180.0f / PIE;
393+ float angle = DEGREES_PER_RADIAN * std::atan2(length.y, length.x);
395394 if (angle < 0) {
396395 angle += 360.0f;
397396 };