% Create 2D point Usage: Point_2D = sugr_Point_2D(xe) Euclidean vector, CovM = 0 Point_2D = sugr_Point_2D(xh) homogeneous vector, CovM = 0 Point_2D = sugr_Point_2D(x,y) Euclidean coordinates, CovM = 0 Point_2D = sugr_Point_2D(xe,Cee) Euclidean vector with Cov.matrix Point_2D = sugr_Point_2D(xh,Chh) homgeneous vector with Cov.matrix Point_2D = sugr_Point_2D(u,v,w) homogeneous coordinates, CovM = 0 Point_2D = sugr_Point_2D(x,y,Cee) Euclidean coordinates with Euclidean Cov.matrix Point_2D = sugr_Point_2D(x,y,sx,sy) independent Euclidean coordinates with standard deviations Point_2D = sugr_Point_2D(u,v,w,Chh) homogeneous coordinates with homogeneous Cov.matrix * Point_2D = structure .h = spherically normalized homogeneous coordinates .Crr = reducedcovariance matrix .Jr = null space of .h' .type = 1 Wolfgang Förstner 1/2011 wfoerstn@uni-bonn.de See also sugr_Line_2D, sugr_Line_3D, sugr_Plane_3D, sugr_Point_3D
0001 %% Create 2D point 0002 % 0003 % Usage: 0004 % Point_2D = sugr_Point_2D(xe) 0005 % Euclidean vector, CovM = 0 0006 % 0007 % Point_2D = sugr_Point_2D(xh) 0008 % homogeneous vector, CovM = 0 0009 % 0010 % Point_2D = sugr_Point_2D(x,y) 0011 % Euclidean coordinates, CovM = 0 0012 % 0013 % Point_2D = sugr_Point_2D(xe,Cee) 0014 % Euclidean vector with Cov.matrix 0015 % 0016 % Point_2D = sugr_Point_2D(xh,Chh) 0017 % homgeneous vector with Cov.matrix 0018 % 0019 % Point_2D = sugr_Point_2D(u,v,w) 0020 % homogeneous coordinates, CovM = 0 0021 % 0022 % Point_2D = sugr_Point_2D(x,y,Cee) 0023 % Euclidean coordinates with Euclidean Cov.matrix 0024 % 0025 % Point_2D = sugr_Point_2D(x,y,sx,sy) 0026 % independent Euclidean coordinates with standard deviations 0027 % 0028 % Point_2D = sugr_Point_2D(u,v,w,Chh) 0029 % homogeneous coordinates with homogeneous Cov.matrix 0030 % 0031 % * Point_2D = structure 0032 % .h = spherically normalized homogeneous coordinates 0033 % .Crr = reducedcovariance matrix 0034 % .Jr = null space of .h' 0035 % .type = 1 0036 % 0037 % Wolfgang Förstner 1/2011 0038 % wfoerstn@uni-bonn.de 0039 % 0040 % See also sugr_Line_2D, sugr_Line_3D, sugr_Plane_3D, sugr_Point_3D 0041 0042 function Point_2D = sugr_Point_2D(a1,a2,a3,a4) 0043 0044 % default 0045 Chh = zeros(3); 0046 0047 switch nargin 0048 case 0 0049 case 1 % 2- or 3-vector 0050 size_a1 = size(a1,1); 0051 switch size_a1 0052 case 2 0053 %% (1) Euclidean vector, CovM == 0 0054 % spherically normalized 0055 Point_2D = sugr_minimal_vector([a1;1],Chh); 0056 0057 case 3 0058 %% (1) homogeneous vector, CovM == 0 0059 Point_2D = sugr_minimal_vector(a1,Chh); 0060 0061 end 0062 case 2 0063 0064 size_a2 = size(a1,1); 0065 switch size_a2 0066 case 1 0067 %% (2) Euclidean coordinates, CovM == 0 0068 Point_2D = sugr_minimal_vector([a1;a2;1],Chh); 0069 0070 case 2 0071 %% (2) Euclidean vector 0072 % spehrically normalized 0073 Point_2D = sugr_minimal_vector([a1;1],[a2 zeros(2,1); zeros(1,3)]); 0074 0075 case 3 0076 %% (3) uncertain homogeneous coordinates 0077 Point_2D = sugr_minimal_vector(a1,a2); 0078 end 0079 case 3 0080 size_a3 = size(a3,1); 0081 switch size_a3 0082 case 1 0083 %% (3) homogeneous vector, CovM == 0 0084 % spehrically normalized 0085 Point_2D = sugr_minimal_vector([a1;a2;a3],Chh); 0086 0087 case 2 0088 %% (3) Euclidean coordinates 0089 % spehrically normalized 0090 Point_2D = sugr_minimal_vector([a1;a2;1],[a3 zeros(2,1); zeros(1,3)]); 0091 end 0092 0093 case 4 0094 size_a4 = size(a4,1); 0095 switch size_a4 0096 case 1 0097 %% (4) Euclidean vector, independent coordinates 0098 % spehrically normalized 0099 Point_2D = sugr_minimal_vector([a1;a2;1],... 0100 [ a3^2, 0, 0; 0, a4^2, 0; zeros(1,3)]); 0101 0102 case 3 0103 %% (4) homogeneous coordinates 0104 % spehrically normalized 0105 Point_2D = sugr_minimal_vector([a1;a2;a3],a4); 0106 end 0107 0108 end 0109 0110 Point_2D.Jr = null(Point_2D.h'); 0111 Point_2D.type=1; 0112