Programming question/puzzle (Vector Arrays)


I’ve been stuck in this for a while now and I need help.

Here is the problem I need to solve:

I have an array of Vectors. Distance between array elements next to each other should be under 100.

If the Distance between elements next to each other is larger than 100, I would want to add elements to the array between the ones that were just checked. Each element should have a distance of 25 from each other.

The Vector number is the one that comes when going straight line from checked vectors.

Any help? I know the principle of what to do (normalize direction, add 25 to normalized value, etc), but I always get too lost in the calculations and values are all wrong. Thanks!