% Create 3D point Point_3D = sugr_Point_3D(a1,a2,a3,a4,a5,a6) Usage: (1) Point_3D = sugr_Point_3D(Xe) Euclidean vector, CovM = 0 (1) Point_3D = sugr_Point_3D(Xh) homogeneous vector, CovM = 0 (2) Point_3D = sugr_Point_3D(Xe,Cee) Euclidean vector and CovM (2) Point_3D = sugr_Point_3D(Xh,Chh) homgeneous vector and CovM (6) Point_3D = sugr_Point_3D(X,Y,Z,sX,sY,sZ) independent Euclidean coordinates with standard dev * Point_3D = structure .h = spherically normalized homogeneous coordinates .Crr = reduced covariance matrix .Jr = null space of .h' .type = 3 Bernhard Wrobel, Wolfgang Förstner 2/2013 wfoerstn@uni-bonn.de See also sugr_Line_3D, sugr_Plane_3D, sugr_Point_2D
0001 %% Create 3D point 0002 % 0003 % Point_3D = sugr_Point_3D(a1,a2,a3,a4,a5,a6) 0004 % 0005 % Usage: 0006 % (1) Point_3D = sugr_Point_3D(Xe) 0007 % Euclidean vector, CovM = 0 0008 % 0009 % (1) Point_3D = sugr_Point_3D(Xh) 0010 % homogeneous vector, CovM = 0 0011 % 0012 % (2) Point_3D = sugr_Point_3D(Xe,Cee) 0013 % Euclidean vector and CovM 0014 % 0015 % (2) Point_3D = sugr_Point_3D(Xh,Chh) 0016 % homgeneous vector and CovM 0017 % 0018 % (6) Point_3D = sugr_Point_3D(X,Y,Z,sX,sY,sZ) 0019 % independent Euclidean coordinates with standard dev 0020 % 0021 % * Point_3D = structure 0022 % .h = spherically normalized homogeneous coordinates 0023 % .Crr = reduced covariance matrix 0024 % .Jr = null space of .h' 0025 % .type = 3 0026 % 0027 % Bernhard Wrobel, Wolfgang Förstner 2/2013 0028 % wfoerstn@uni-bonn.de 0029 % 0030 % See also sugr_Line_3D, sugr_Plane_3D, sugr_Point_2D 0031 0032 0033 function Point_3D = sugr_Point_3D(a1,a2,a3,a4,a5,a6) 0034 0035 % default 0036 Chh = zeros(4); 0037 0038 switch nargin 0039 case 0 0040 case 1 % 3- or 4-vector 0041 size_a1 = size(a1,1); 0042 switch size_a1 0043 case 3 0044 %% (1) Euclidean vector, CovM == 0 0045 % spherically normalized 0046 Point_3D = sugr_minimal_vector([a1;1],Chh); 0047 0048 case 4 0049 %% (1) homogeneous vector, CovM == 0 0050 Point_3D = sugr_minimal_vector(a1,Chh); 0051 0052 end 0053 case 2 0054 0055 size_a2 = size(a1,1); 0056 switch size_a2 0057 case 1 0058 Point_3D = sugr_minimal_vector([a1(:);1],[a2,zeros(3,1);zeros(1,4)]); 0059 0060 case 3 0061 %% (2) Euclidean coordinates, CovM == 0 0062 Point_3D = sugr_minimal_vector([a1;1],[a2,zeros(3,1);zeros(1,4)]); 0063 0064 case 4 0065 %% (2) homogeneous vector 0066 % spherically normalized 0067 Point_3D = sugr_minimal_vector(a1,a2); 0068 end 0069 case 6 0070 %% (6) homogeneous coordinates 0071 % individual standard deviations 0072 Point_3D = sugr_minimal_vector(... 0073 [a1;a2;a3;1],... 0074 [diag([a4,a5,a6]).^2,zeros(3,1);[0,0,0,1]]); 0075 0076 0077 end 0078 0079 Point_3D.Jr = null(Point_3D.h'); 0080 0081 Point_3D.type=3; 0082