Home > vbmeg > functions > device > vivid > vb_get_3d_point.m

vb_get_3d_point

PURPOSE ^

Find nearest 3D & 2D-coordinate to the target point

SYNOPSIS ^

function [Vp, Xp, Yp, dmin] = vb_get_3d_point(xp,V,X,Y)

DESCRIPTION ^

 Find nearest 3D & 2D-coordinate to the target point

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [Vp, Xp, Yp, dmin] = vb_get_3d_point(xp,V,X,Y)
0002 % Find nearest 3D & 2D-coordinate to the target point
0003 %
0004 % Copyright (C) 2011, ATR All Rights Reserved.
0005 % License : New BSD License(see VBMEG_LICENSE.txt)
0006 
0007 NP   = size(xp,1);
0008 Id   = zeros(NP,1);
0009 dmin = zeros(NP,1);
0010 
0011 % Find 2D-point index near the target point
0012 for n = 1:NP
0013     dd = (X - xp(n,1)).^2 + (Y - xp(n,2)).^2;
0014     [ddmin, ix] = min(dd);
0015     Id(n)   = ix;
0016     dmin(n) = sqrt(ddmin);
0017 end;
0018 
0019 Vp = V(Id,:);
0020 Xp = X(Id,:);
0021 Yp = Y(Id,:);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005