How do you find the midpoint of several 3D points? I need help writing a formula for a program I'm making.
I need to work out how to find the midpoint of several 3D points.
Think of it as a multi-line grappling hook.
If I fire a line at three points in the world, how do I find the point where I can suspend in the air? 
I wish to find the coordinates of the green dot. 

An equation that works with an array of all the 3D points being the input while also being adaptable to multiple (not required) points instead of just 3 would be great.
Thank you! 
 A: If you are using a computer graphics system that uses homogeneous coordinates (4 values per 3D point) then you can just add all the components together.
For example
$$ \pmatrix{x_1 \\ y_1 \\ z_1 \\ 1} + \pmatrix{x_2 \\ y_2 \\ z_2 \\ 1} + \pmatrix{x_3 \\ y_3 \\ z_3 \\ 1} = \pmatrix{x_1+x_2+x_3 \\ y_1+y_2+y_3 \\ z_1+z_2+z_3 \\ 3} $$
The cartesian coordinates of the result is the "mid-point" (also known as the barycenter).
$$ \pmatrix{ \frac{x_1+y_1+z_1}3 \\ \frac{x_2+y_2+z_2}3 \\ \frac{x_3+y_3+z_3}3 }$$
A: This will be the center of gravity, or the average of the points. If the points are $x=(x_1,x_2,x_3)$, $~y=(y_1,y_2,y_3)$, and $z=(z_1,z_2,z_3)$, you want to average each coordinate to obtain the point:
$$a=\\\left(\frac{x_1+y_1+z_1}3,\frac{x_2+y_2+z_2}3,\frac{x_3+y_3+z_3}3\right)$$
This same solution works for any number of points, not just three. For example, for two points, this gives you the midpoint.
Note that, in vector arithmetic, we have $x+y+z=3a$. Thus, $(x-a)+(y-a)+(z-a)=0$. We can think of each of those terms as a force from the point $a$ towards one of the three points. Since it adds to $0$, the forces cancel each other out, and so $a$ is in equilibrium. This means it works with your grappling hook intuition.
