Commit 2828bd33 authored by Nico Mack's avatar Nico Mack

Fixed conversion bug. No conversion required if instance and target unit

are identical.
parent 9d58dc0e
......@@ -5,7 +5,7 @@ package lu.list.itis.dkd.tui.utility;
// ***************************************************************************
public enum AngleUnit {
DEG(1), RAD((2 * Math.PI) / 360);
DEG(360 / (2 * Math.PI)), RAD((2 * Math.PI) / 360);
public final double factor;
......@@ -30,7 +30,10 @@ public enum AngleUnit {
// ---------------------------------------------------------------------------
public double convertTo(double value, AngleUnit target) {
double normalized = value / this.factor;
if (target.equals(this)) {
return value;
}
return value * target.factor;
}
......
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