MIDPOINT3D Middle point of two 3D points or of a 3D edge.

   MID = midPoint3d(P1, P2)
   Compute the middle point of the two points P1 and P2.

   MID = midPoint3d(EDGE)
   Compute the middle point of the edge given by EDGE.
   EDGE has the format: [X1 Y1 Z1 X2 Y2 Z2], and MID has the format 
   [XMID YMID ZMID], 
   with XMID = (X1+X2)/2, YMID = (Y1+Y2)/2 and ZMID = (Z1+Z2)/2.

   [MIDX MIDY] = midPoint3d(...)
   Return the result as two separate variables or arrays.

   Works also when EDGE is a N-by-6 array, in this case the result is a
   N-by-3 array containing the midPoint3d of each edge.


   Example
   P1 = [10 20 30];
   P2 = [30 40 50];
   % edge input
   midPoint3d([P1 P2])
   ans =
       20  30  40

   % two points input
   midPoint3d(P1, P2)
   ans =
       20  30  40

   % three outputs
   [xm ym zm] = midPoint3d(P1, P2)
   xm =
       20  
   ym = 
       30  
   zm = 
       40

   See also
     edges3d, points3d

Package: matgeom