FindClosestPoint

版本 1.0.0.0 (1.3 KB) 作者: Matthew Kelly
Given a line AB, and a point C, find point D on line AB that is closest to C.
74.0 次下载
更新时间 2016/4/27

查看许可证

% [D,lambda,isConvex] = findClosestPoint(A,B,C)
%
% Given a line segment AB, and an arbitrary point C, compute the point D on
% the line AB which is closest to point C.
%
% INPUTS:
% A = [2,n] = [Ax;Ay] = First point on the line
% B = [2,n] = [Bx;By] = Second point on the line
% C = [2,n] = [Cx;Cy] = Arbitrary point of interest
%
% OUTPUTS:
% D = [2,n] = [Dx;Dy] = point on AB that is nearest to C
% lambda = [1,n] = lagrange multiplier: D = lambda*A + (1-lambda)*B
% isConvex = true if D is a convex combination of A and B
% isConvex = lambda >=0 && lambda <= 1
%

引用格式

Matthew Kelly (2024). FindClosestPoint (https://www.mathworks.com/matlabcentral/fileexchange/56791-findclosestpoint), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2012a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Spatial Search 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0