Commit da0041e8 authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Save angles in radians

Because that's better than loading degrees as radians

Also, 0 mod 360 = 0, not 360
parent 03fd26ae
......@@ -406,8 +406,8 @@ QMap<QString, QVariant>
InstrumentWidgetEncoder::encodeSector(const Shape2DSector *obj) {
const auto outerRadius = obj->getDouble("outerRadius");
const auto innerRadius = obj->getDouble("innerRadius");
const auto startAngle = obj->getDouble("startAngle");
const auto endAngle = obj->getDouble("endAngle");
const auto startAngle = obj->getDouble("startAngle") * M_PI / 180;
const auto endAngle = obj->getDouble("endAngle") * M_PI / 180;
const auto centerX = obj->getPoint("center").x();
const auto centerY = obj->getPoint("center").y();
......
......@@ -1069,11 +1069,11 @@ void Shape2DSector::setDouble(const QString &prop, double value) {
m_innerRadius = m_outerRadius >= value ? value : 0.99 * m_outerRadius;
} else if (prop == "startAngle") {
m_startAngle = fmod(value, 360);
m_startAngle = m_startAngle > 0 ? m_startAngle : m_startAngle + 360;
m_startAngle = m_startAngle >= 0 ? m_startAngle : m_startAngle + 360;
m_startAngle *= to_radians;
} else if (prop == "endAngle") {
m_endAngle = fmod(value, 360);
m_endAngle = m_endAngle > 0 ? m_endAngle : m_endAngle + 360;
m_endAngle = m_endAngle >= 0 ? m_endAngle : m_endAngle + 360;
m_endAngle *= to_radians;
} else
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment