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 % Created: 2020-03-13 0015 % Copyright 2020 0016 0017 isLine3d = @(x) validateattributes(x,{'numeric'},... 0018 {'nonempty','nonnan','real','finite','size',[nan,6]}); 0019 0020 % Check if the line is valid 0021 p=inputParser; 0022 addRequired(p,'line',isLine3d) 0023 parse(p,line) 0024 0025 line2 = line; 0026 line2(:,4:6) = normalizeVector3d(line2(:,4:6)); 0027 0028 end 0029