% create homogeneous 2D line Line_2D = sugr_Line_2D(a1,a2,a3,a4,a5) input cases (1) le Hessian parameters [phi,d], CovM = 0 (1) lh homogeneous coordinate vector, CovM = 0 (2) phi, d Hessian parameters, CovM = 0 (2) le,Cee Euclidean coordinate vector (2) lh,Chh homogeneous coordinate vector (3) a,b,c homogeneous coordinates, CovM == 0 (3) phi,d,Cee Euclidean coordinates (4) u,v,w,Chh homogeneous coordinates (5) x,y,phi,sp,sq centroid form Line_2D = structure * .h = spherically normalized homogeneous coordinates * .Crr = reduced covariance matrix of l.h * .Jr = nullspace of .h' * .type = 2 Wolfgang Förstner 1/2011 wfoerstn@uni-bonn.de See also sugr_Line_2D_hom2Hes, sugr_Line_2D_hom2cen, sugr_Line_2D_Hes2hom, sugr_Line_2D_Hes2cen, sugr_Line_2D_cen2hom, sugr_get_Euclidean_Line_2D, sugr_get_centroid_Line_2D
0001 %% create homogeneous 2D line 0002 % 0003 % Line_2D = sugr_Line_2D(a1,a2,a3,a4,a5) 0004 % 0005 % input cases 0006 % (1) le Hessian parameters [phi,d], CovM = 0 0007 % (1) lh homogeneous coordinate vector, CovM = 0 0008 % (2) phi, d Hessian parameters, CovM = 0 0009 % (2) le,Cee Euclidean coordinate vector 0010 % (2) lh,Chh homogeneous coordinate vector 0011 % (3) a,b,c homogeneous coordinates, CovM == 0 0012 % (3) phi,d,Cee Euclidean coordinates 0013 % (4) u,v,w,Chh homogeneous coordinates 0014 % (5) x,y,phi,sp,sq centroid form 0015 % 0016 % Line_2D = structure 0017 % * .h = spherically normalized homogeneous coordinates 0018 % * .Crr = reduced covariance matrix of l.h 0019 % * .Jr = nullspace of .h' 0020 % * .type = 2 0021 % 0022 % Wolfgang Förstner 1/2011 0023 % wfoerstn@uni-bonn.de 0024 % 0025 % See also sugr_Line_2D_hom2Hes, sugr_Line_2D_hom2cen, 0026 % sugr_Line_2D_Hes2hom, sugr_Line_2D_Hes2cen, sugr_Line_2D_cen2hom, 0027 % sugr_get_Euclidean_Line_2D, sugr_get_centroid_Line_2D 0028 0029 function Line_2D = sugr_Line_2D(a1,a2,a3,a4,a5) 0030 0031 % default 0032 Chh = zeros(3); 0033 0034 switch nargin 0035 case 1 % 2- or 3-vector 0036 size_a1=size(a1,1); 0037 switch size_a1 0038 case 2 0039 %% (1) Euclidean vector (angle-distance), CovM == 0 0040 % minimal representation 0041 Line_2D = sugr_minimal_vector([cos(a1(1)); sin(a1(1)); -a1(2)],Chh); 0042 0043 case 3 0044 %% (1) homogeneous vector, CovM == 0 0045 % minimal representation 0046 Line_2D = sugr_minimal_vector(a1,Chh); 0047 0048 end 0049 0050 case 2 0051 size_a1=size(a1,1); 0052 switch size_a1 0053 case 1 0054 %% (2) Euclidean coordinates, CovM == 0 0055 % minimal representation 0056 Line_2D = sugr_minimal_vector([cos(a1(1)); sin(a1(1)); -a2],Chh); 0057 0058 case 2 0059 %% (2) Euclidean coordinate vector 0060 % homogeneous coordinates 0061 [h,Chh] = sugr_Line_2D_Hes2hom(a1,a2); 0062 % minimal representation 0063 Line_2D = sugr_minimal_vector(h,Chh); 0064 0065 case 3 0066 %% (3) homogeneous coordinates 0067 % minimal representation 0068 Line_2D=sugr_minimal_vector(a1,a2); 0069 0070 end 0071 case 3 0072 size_a3=size(a3,1); 0073 switch size_a3 0074 case 1 0075 %% (3) homogeneous coordinates, CovM == 0 0076 % minimal representation 0077 Line_2D = sugr_minimal_vector([a1;a2;a3],Chh); 0078 0079 case 2 0080 %% (3) Euclidean coordinates 0081 % spherically normalized homogeneous vector 0082 [h,Chh] = sugr_Line_2D_Hes2hom([a1;a2],a3); 0083 % minimal representation 0084 Line_2D = sugr_minimal_vector(h,Chh); 0085 0086 end 0087 0088 case 4 0089 %% (4) homogeneous coordinates 0090 % minimal representation 0091 Line_2D = sugr_minimal_vector([a1;a2;a3],a4); 0092 0093 case 5 0094 %% (5) centroid form 0095 % homogeneous coordinates 0096 [h,Chh] = sugr_Line_2D_cen2hom([a1;a2],a3,a4,a5); 0097 Line_2D = sugr_minimal_vector(h,Chh); 0098 end 0099 Line_2D.Jr = null(Line_2D.h'); 0100 Line_2D.type = 2;