Going along with my last post, just a quick tip: sometimes it makes sense to use comments to show how a loop will progress. For me, at least, this is another way to get a grasp on how values are changing and ensure that calculations account for the situations you may need.
In this case, following the logic flow, I realized that the initial value for v2 was where things were breaking down. I was also able to capture the final segment without using an additional for-loop
which makes things a bit cleaner. I’m actually going to evaluate some of my other triangle logic to see if I can do the same thing using the vx -= vertices.Length
method to take care of the last parent loop.