Home > General-Functions > SUGR > Projection_3D_2D > sugr_generate_true_2D_point_pairs_Projection_3D_2D.m

sugr_generate_true_2D_point_pairs_Projection_3D_2D

PURPOSE ^

% Generate N point pairs for given Projection P

SYNOPSIS ^

function [X,y] = sugr_generate_true_2D_point_pairs_Projection_3D_2D(P,N,dX,dY,dZ,br)

DESCRIPTION ^

% Generate N point pairs for given Projection P

 [X,y] = sugr_generate_true_2D_point_pairs_Projection_3D_2D(P,N,dX,dY,dZ,boolean_r);

 P         = 3x4 matrix
 N         = number of points
 dX,dY,dZ  = size of box around [0,0,0]
 boolean_r = boolean: points should sit random
                else: points sit in a square (N should be square)

 [X,y] = point pairs
      X.e,y.e      = N x 3, N x 2 matrices of Cartesian point coordinates
      X.Cee,y.Cee  = N x 3 x 3, N x 2 x 2 with CovM of point pairs

 Wolfgang Förstner 02/2013
 wfoerstn@uni-bonn.de

 See also sugr_estimation_algebraic_Projection_3D_2D_from_point_pairs
 sugr_estimation_ml_Projection_3D_2D_from_point_pairs

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Generate N point pairs for given Projection P
0002 %
0003 % [X,y] = sugr_generate_true_2D_point_pairs_Projection_3D_2D(P,N,dX,dY,dZ,boolean_r);
0004 %
0005 % P         = 3x4 matrix
0006 % N         = number of points
0007 % dX,dY,dZ  = size of box around [0,0,0]
0008 % boolean_r = boolean: points should sit random
0009 %                else: points sit in a square (N should be square)
0010 %
0011 % [X,y] = point pairs
0012 %      X.e,y.e      = N x 3, N x 2 matrices of Cartesian point coordinates
0013 %      X.Cee,y.Cee  = N x 3 x 3, N x 2 x 2 with CovM of point pairs
0014 %
0015 % Wolfgang Förstner 02/2013
0016 % wfoerstn@uni-bonn.de
0017 %
0018 % See also sugr_estimation_algebraic_Projection_3D_2D_from_point_pairs
0019 % sugr_estimation_ml_Projection_3D_2D_from_point_pairs
0020 
0021 function [X,y] = sugr_generate_true_2D_point_pairs_Projection_3D_2D(P,N,dX,dY,dZ,br)
0022 
0023 if br
0024     for n=1:N
0025         Xe             = [rand(1)*dX;...
0026             rand(1)*dY;...
0027             rand(1)*dZ;...
0028             1];
0029         ye             = P * Xe;
0030         X.e(n,:)       = Xe(1:3)'/Xe(4);
0031         X.Cee(n,:,:)   = zeros(3);
0032         y.e(n,:)       = ye(1:2)'/ye(3);
0033         y.Cee(n,:,:)   = zeros(2);
0034     end
0035 else
0036     M = ceil(N^(1/3));
0037     n=0;
0038     for k=1:M
0039         for l=1:M
0040             for m=1:M
0041                 n = n+1;
0042                 if n <= N
0043                     Xe = [(k-(M+1)/2)/(M-1);...
0044                         (l-(M+1)/2)/(M-1);...
0045                         (m-(M+1)/2)/(M-1);...
0046                         1];
0047                     ye           = P * Xe;
0048                     X.e(n,:)       = Xe(1:3)'/Xe(4);
0049                     X.Cee(n,:,:)   = zeros(3);
0050                     y.e(n,:)       = ye(1:2)'/ye(3);
0051                     y.Cee(n,:,:)   = zeros(2);
0052                 end
0053             end
0054         end
0055     end
0056 end

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005