Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_unwarp.cxx
Go to the documentation of this file.
1 /*
2 Copyright 2000-12 Pierre SMARS (smars@yuntech.edu.tw)
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #include "a_unwarp.h"
17 //---------------------------------------------------------------------------
18 void a_unwarp::unwarp(double u, double v, double & un, double& vn)
19 {
20  double du = u-u0_;
21  double dv = v-v0_;
22  double r2 = du*du+dv*dv;
23  un = u + K1_*du*r2 + K2_*du*r2*r2 + P1_*(2*du*du+r2) + 2*P2_*du*dv;
24  vn = v + K1_*dv*r2 + K2_*dv*r2*r2 + P2_*(2*dv*dv+r2) + 2*P1_*du*dv;
25 }
26 //---------------------------------------------------------------------------
27 std::istream& operator>> (std::istream& i, a_unwarp& l)
28 {
29  i >> l.u0_ >> l.v0_;
30  i >> l.K1_ >> l.K2_;
31  i >> l.P1_ >> l.P2_;
32  return i;
33 }
34 //---------------------------------------------------------------------------
35 std::ostream& operator<< (std::ostream& o, const a_unwarp& l)
36 {
37  o << l.u0_ << " " << l.v0_ << std::endl;
38  o << l.K1_ << " " << l.K2_ << std::endl;
39  o << l.P1_ << " " << l.P2_ << std::endl;
40  return o;
41 }
std::istream & operator>>(std::istream &i, a_unwarp &l)
Definition: a_unwarp.cxx:27
std::ostream & operator<<(std::ostream &o, const a_unwarp &l)
Definition: a_unwarp.cxx:35
void unwarp(double u, double v, double &un, double &vn)
Definition: a_unwarp.cxx:18