Subversion Repositories gelsvn

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
688 khor 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
6
 
7
#include <iostream>
8
#include <algorithm>
9
#include "Vec2f.h"
10
#include "Vec2d.h"
11
#include "Mat2x2f.h"
12
#include "Mat2x2d.h"
13
#include "CGLA.h"
14
 
15
namespace CGLA {
16
  using namespace std;
17
 
18
  template<class T, class V>
19
  bool linear_combine(const ArithVec2Float<T,V>& a,
20
		      const ArithVec2Float<T,V>& b,
21
		      const ArithVec2Float<T,V>& c,
22
		      T& x,
23
		      T& y) 
24
  {
25
    Vec2d xy = invert(Mat2x2d(a[0],b[0],a[1],b[1])) * Vec2d(c[0], c[1]);
26
    x = xy[0];
27
    y = xy[1];
28
    return true;
29
  }
30
 
31
 
32
  template class ArithVec2Float<float, Vec2f>;
33
  template class ArithVec2Float<double, Vec2d>;
34
 
35
  template bool 
36
  linear_combine<double,Vec2d>(const ArithVec2Float<double,Vec2d>&,
37
			       const ArithVec2Float<double,Vec2d>&,
38
			       const ArithVec2Float<double,Vec2d>&,
39
			       double&,
40
			       double&);
41
 
42
  template bool 
43
  linear_combine<float,Vec2f>(const ArithVec2Float<float,Vec2f>&,
44
			      const ArithVec2Float<float,Vec2f>&,
45
			      const ArithVec2Float<float,Vec2f>&,
46
			      float&,
47
			      float&);
48
 
49
 
50
}