How do you find coordinates midpoint of a segment?
The coordinates of the mid points are the means of the pairs of
coordinates of the two end points.
Thus, if P = (px, py, pz) and Q = (qx, qy, qz)
then the midpoint of PQ is [(px+qx)/2, (py+qy)/2,
(pz+qz)/2].
The result can be simplified for 2-dimensional space, or
extended to more dimensions.