The midpoint of the line segment joining two points with position vectors is the point . Its displacements from the endpoints are and , so it lies on the segment and is equidistant from its endpoints. It is also the centroid of the two endpoints.
For line segments and , , the squared Euclidean distance is a convex quadratic function on a square. Its minimum is either an admissible stationary point or a minimum on one of the four edges. Each edge minimum is a point-to-segment orthogonal projection, restricted to the interval. Testing these five candidates gives a complete algorithm; when the directions are parallel, the edge candidates suffice. Independently restricting both coordinates of the unconstrained stationary point is generally incorrect because the variables are coupled by .
For segments with initial direction vectors , initial endpoint displacement , and translation velocities , contact is feasibility of the displayed linear equation with and . Minimizing is a small linear programming problem. A nonsingular three-column coefficient matrix gives at most one candidate; singular, parallel and degenerate cases require the constrained feasibility problem rather than division by a vanishing determinant.
The earliest approach within distance is a convex optimization problem with a norm constraint and the same segment and time bounds as contact. An elementary alternative enumerates whether each segment parameter is free or at an endpoint. In each nonsingular active case the free closest-point parameters are affine functions of time, leaving a quadratic distance inequality on a valid time interval. Rank-deficient cases need their null-space constraints retained. Unlike contact, the two segment parameters and time are no longer determined by a vector equality.
Articles by others on the same topic
A line segment is a part of a line that is bounded by two distinct endpoints. Unlike a line, which extends infinitely in both directions, a line segment has a definite length and consists of all the points that lie between its two endpoints. It can be represented mathematically by the notation \( \overline{AB} \), where \( A \) and \( B \) are the endpoints of the segment.