Skip to content

Commit

Permalink
fixed crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Givikap120 committed Oct 10, 2024
1 parent d05a80e commit 7d1ed39
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ private static double getCurveComfort(Vector2 start, Vector2 middle, Vector2 end
{
float deltaDistance = Math.Abs(Vector2.Distance(start, middle) - Vector2.Distance(middle, end));
float scaleDistance = Vector2.Distance(start, end) / 4;
if (scaleDistance == 0)
return 1;

float result = Math.Min(deltaDistance / scaleDistance, 1);
return 1 - (double)result;
}
Expand Down Expand Up @@ -297,15 +300,5 @@ private static double calculateAngleSigned(Vector2 p1, Vector2 p2, Vector2 p3)
return Math.Atan2(det, dot);
}

private static double calculateAngleAbs(Vector2 p1, Vector2 p2, Vector2 p3)
{
Vector2 v1 = p2 - p1;
Vector2 v2 = p2 - p3;

float dot = v1.X * v2.X + v1.Y * v2.Y;
float modSum = v1.Length * v2.Length;

return Math.Acos(dot / modSum);
}
}
}

0 comments on commit 7d1ed39

Please sign in to comment.