Go to the documentation of this file.00001 #include "m23d_make_ortho_projection.h"
00002
00003
00004
00005
00006
00007 #include <m23d/m23d_rotation_matrix.h>
00008
00009
00010
00011 vnl_matrix<double> m23d_make_ortho_projection(double Ax, double Ay, double Az)
00012 {
00013 vnl_matrix<double> R=m23d_rotation_matrix(Ax,Ay,Az);
00014 return R.extract(2,3);
00015 }
00016
00017
00018 vnl_matrix<double> m23d_make_ortho_projection(vnl_random& r,
00019 unsigned ns, unsigned nm,
00020 bool first_is_identity,
00021 bool basis_true)
00022 {
00023 vnl_matrix<double> P(2*ns,3*(1+nm));
00024 for (unsigned i=0;i<ns;++i)
00025 {
00026 double a = r.drand64(-0.5,0.5);
00027 double b = r.drand64(-0.5,0.5);
00028 double c = r.drand64(-0.5,0.5);
00029 vnl_matrix<double> Pi=m23d_make_ortho_projection(a,b,c);
00030 if (i==0 && first_is_identity)
00031 Pi=m23d_make_ortho_projection(0,0,0);
00032
00033 for (unsigned j=0;j<=nm;++j)
00034 {
00035 double w=r.drand64(-1.0,1.0);
00036 if (nm==0) w=1.0;
00037
00038 if (basis_true)
00039 {
00040
00041 if (i<=nm && j<=nm)
00042 {
00043 if (i==j) w=1.0;
00044 else w=0.0;
00045 }
00046 }
00047
00048 P.update(w*Pi,i*2,j*3);
00049 }
00050 }
00051 return P;
00052 }
00053
00054