Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008
00009 #include "vgui_un_project.h"
00010
00011 #include <vnl/vnl_vector_fixed.h>
00012 #include <vnl/vnl_matrix_fixed.h>
00013 #include <vnl/vnl_inverse.h>
00014
00015 bool vgui_un_project(double const * const *H,
00016 double const X[4],
00017 double Y[4])
00018 {
00019 vnl_matrix_fixed<double,4,4> M;
00020 M.set_row(0, H[0]);
00021 M.set_row(1, H[1]);
00022 M.set_row(2, H[2]);
00023 M.set_row(3, H[3]);
00024 vnl_vector_fixed<double,4> p(X);
00025 vnl_vector_fixed<double,4> q = vnl_inverse(M)*p;
00026 q.copy_out(Y);
00027 return true;
00028 }
00029
00030 bool vgui_un_project(double const H[4][4], double const X[4], double Y[4]) {
00031 double const *H_[4] = { H[0], H[1], H[2], H[3] };
00032 return vgui_un_project(H_, X, Y);
00033 }
00034
00035 bool vgui_un_project(double const H[16], double const X[4], double Y[4]) {
00036 double const *H_[4] = { H, H+4, H+8, H+12 };
00037 return vgui_un_project(H_, X, Y);
00038 }