I have an array that defines an unbroken path as follows;
var path = new [] {
new Vector2(0.4f, 0.2f),
new Vector2(1f, 1.1f),
new Vector2(2f, 1f),
new Vector2(2.5, 0.6f)
}
Which results in the following visualisation;
The number of points in the path is variable. How can I determine the co-ordinate that represents the centre of this path? Centre in this case is defined as a co-ordinate on one of the lines where splitting the path at that point would result in two paths of equal length.
Summing the points and averaging is not a solution, considering this would result in a co-ordinate not on the path.
Is there something in c# or unity3d that can provide this value, or do I need to whip out some funky math stuff?