/** * Sets the starting angle and angular extent of this arc using two sets of coordinates. The * first set of coordinates is used to determine the angle of the starting point relative to * the arc's center. The second set of coordinates is used to determine the angle of the end * point relative to the arc's center. The arc will always be non-empty and extend * counterclockwise from the first point around to the second point. */ public void setAngles (float x1, float y1, float x2, float y2) { float cx = centerX(); float cy = centerY(); float a1 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y1 - cy, x1 - cx))); float a2 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y2 - cy, x2 - cx))); a2 -= a1; if (a2 <= 0f) { a2 += 360f; } setAngleStart(a1); setAngleExtent(a2); }
/** * Sets the starting angle and angular extent of this arc using two sets of coordinates. The * first set of coordinates is used to determine the angle of the starting point relative to * the arc's center. The second set of coordinates is used to determine the angle of the end * point relative to the arc's center. The arc will always be non-empty and extend * counterclockwise from the first point around to the second point. */ public void setAngles (float x1, float y1, float x2, float y2) { float cx = centerX(); float cy = centerY(); float a1 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y1 - cy, x1 - cx))); float a2 = normAngle(-FloatMath.toDegrees(FloatMath.atan2(y2 - cy, x2 - cx))); a2 -= a1; if (a2 <= 0f) { a2 += 360f; } setAngleStart(a1); setAngleExtent(a2); }