MIDPOINT Middle point of two points or of an edge.
MID = midPoint(P1, P2)
Compute the middle point of the two points P1 and P2.
MID = midPoint(EDGE)
Compute the middle point of the edge given by EDGE.
EDGE has the format: [X1 Y1 X2 Y2], and MID has the format [XMID YMID],
with XMID = (X1+X2)/2, and YMID = (Y1+Y2)/2.
[MIDX MIDY] = midPoint(...)
Return the result as two separate variables or arrays.
Works also when EDGE is a N-by-4 array, in this case the result is a
N-by-2 array containing the midpoint of each edge.
Example
P1 = [10 20];
P2 = [30 40];
midPoint([P1 P2])
ans =
20 30
See also
edges2d, points2d
------
Author: David Legland
e-mail: david.legland@grignon.inra.fr
Created: 2010-08-06, using Matlab 7.9.0.529 (R2009b)
Copyright 2010 INRA - Cepia Software Platform.
Package: matgeom