NORMALIZELINE3D Normalizes the direction vector of a 3D line. LINE2 = normalizeVector3d(LINE); Returns the normalization of the direction vector of the line, such that ||LINE2(4:6)|| = 1. See also normalizePlane, normalizeVector3d
0001 function line2 = normalizeLine3d(line) 0002 %NORMALIZELINE3D Normalizes the direction vector of a 3D line. 0003 % 0004 % LINE2 = normalizeVector3d(LINE); 0005 % Returns the normalization of the direction vector of the line, such 0006 % that ||LINE2(4:6)|| = 1. 0007 % 0008 % See also 0009 % normalizePlane, normalizeVector3d 0010 % 0011 0012 % ------ 0013 % Author: oqilipo 0014 % E-mail: N/A 0015 % Created: 2020-03-13 0016 % Copyright 2020-2024 0017 0018 isLine3d = @(x) validateattributes(x,{'numeric'},... 0019 {'nonempty','nonnan','real','finite','size',[nan,6]}); 0020 0021 % Check if the line is valid 0022 p=inputParser; 0023 addRequired(p,'line',isLine3d) 0024 parse(p,line) 0025 0026 line2 = line; 0027 line2(:,4:6) = normalizeVector3d(line2(:,4:6)); 0028 0029 end 0030