@@ -0,0 +1,1272 @@
+package uk.org.ulcompsoc.ld32.components;%0A%0Aimport com.badlogic.ashley.core.Component;%0Aimport com.badlogic.gdx.math.Vector2;%0A%0Apublic class Position extends Component %7B%0A%09public Vector2 position = new Vector2(0.0f, 0.0f);%0A%0A%09/**%0A%09 * @return the value of r, a distance used in polar cooridinates. sqrt is%0A%09 *         slow, consider using %7B@link #getRSquared()%7D if possible.%0A%09 */%0A%09public float getR() %7B%0A%09%09return (float) Math.sqrt(getRSquared());%0A%09%7D%0A%0A%09/**%0A%09 * @return r%5E2, a distance used in polar coordinates. saves a sqrt if you%0A%09 *         can do comparisons with the squared value.%0A%09 */%0A%09public float getRSquared() %7B%0A%09%09return position.x * position.x + position.y * position.y;%0A%09%7D%0A%0A%09public float getPhi() %7B%0A%09%09return (float) Math.atan2(position.y, position.x);%0A%09%7D%0A%0A%09public Position setPolar(float r, float phi) %7B%0A%09%09position.set(r * (float) Math.cos(phi), r * (float) Math.sin(phi));%0A%0A%09%09return this;%0A%09%7D%0A%0A%09private Position() %7B%0A%09%09this(0.0f, 0.0f);%0A%09%7D%0A%0A%09private Position(final Vector2 vec) %7B%0A%09%09this(vec.x, vec.y);%0A%09%7D%0A%0A%09private Position(float x, float y) %7B%0A%09%09this.position.set(x, y);%0A%09%7D%0A%0A%09public static Position fromEuclidean(float x, float y) %7B%0A%09%09return new Position(x, y);%0A%09%7D%0A%0A%09public static Position fromPolar(float r, float phi) %7B%0A%09%09return new Position().setPolar(r, phi);%0A%09%7D%0A%7D%0A

Add initial Position component supporting polar coordinates