Skip to content

Commit

Permalink
[csharp] Fixed PathConstraint.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Oct 27, 2018
1 parent 3dd56a5 commit a97728a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spine-csharp/src/PathConstraint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ static void AddAfterPosition (float p, float[] temp, int i, float[] output, int
static void AddCurvePosition (float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
float[] output, int o, bool tangents) {
if (p < PathConstraint.Epsilon || float.IsNaN(p)) {
out[o] = x1;
out[o + 1] = y1;
out[o + 2] = (float)Math.Atan2(cy1 - y1, cx1 - x1);
output[o] = x1;
output[o + 1] = y1;
output[o + 2] = (float)Math.Atan2(cy1 - y1, cx1 - x1);
return;
}
float tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u;
Expand All @@ -429,9 +429,9 @@ static void AddCurvePosition (float p, float x1, float y1, float cx1, float cy1,
output[o + 1] = y;
if (tangents) {
if (p < 0.001f)
out[o + 2] = (float)Math.Atan2(cy1 - y1, cx1 - x1);
output[o + 2] = (float)Math.Atan2(cy1 - y1, cx1 - x1);
else
out[o + 2] = (float)Math.Atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
output[o + 2] = (float)Math.Atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
}
}
}
Expand Down

0 comments on commit a97728a

Please sign in to comment.