Apply twice the line radius in order to properly account for diameter

This commit is contained in:
David Zhao 2019-03-07 17:25:51 +09:00
parent d97c070ef1
commit b2f4850275
1 changed files with 3 additions and 2 deletions

View File

@ -103,8 +103,9 @@ private void applyPath()
for (int i = 0; i < values.Length; i++)
{
// Make sure that we are accounting for path width when calculating vertex positions
float x = (i + count - values.Length) / (float)(count - 1) * (DrawWidth - path.PathWidth);
float y = GetYPosition(values[i]) * (DrawHeight - path.PathWidth);
// We need to apply 2x the path radius to account for it because the full diameter of the line accounts into height
float x = (i + count - values.Length) / (float)(count - 1) * (DrawWidth - 2 * path.PathWidth);
float y = GetYPosition(values[i]) * (DrawHeight - 2 * path.PathWidth);
path.AddVertex(new Vector2(x, y));
}
}