Subversion Repositories gelsvn

Rev

Rev 12 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12 Rev 595
-
 
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
 
1
#include <iostream>
7
#include <iostream>
2
#include <algorithm>
8
#include <algorithm>
3
#include "Vec2f.h"
9
#include "Vec2f.h"
4
#include "Vec2d.h"
10
#include "Vec2d.h"
5
#include "Mat2x2f.h"
11
#include "Mat2x2f.h"
6
#include "Mat2x2d.h"
12
#include "Mat2x2d.h"
7
#include "CGLA.h"
13
#include "CGLA.h"
8
 
14
 
9
namespace CGLA {
15
namespace CGLA {
10
  using namespace std;
16
  using namespace std;
11
 
17
 
12
  template<class T, class V>
18
  template<class T, class V>
13
  bool linear_combine(const ArithVec2Float<T,V>& a,
19
  bool linear_combine(const ArithVec2Float<T,V>& a,
14
		      const ArithVec2Float<T,V>& b,
20
		      const ArithVec2Float<T,V>& b,
15
		      const ArithVec2Float<T,V>& c,
21
		      const ArithVec2Float<T,V>& c,
16
		      T& x,
22
		      T& x,
17
		      T& y) 
23
		      T& y) 
18
  {
24
  {
19
    Vec2d xy = invert(Mat2x2d(a[0],b[0],a[1],b[1])) * Vec2d(c[0], c[1]);
25
    Vec2d xy = invert(Mat2x2d(a[0],b[0],a[1],b[1])) * Vec2d(c[0], c[1]);
20
    x = xy[0];
26
    x = xy[0];
21
    y = xy[1];
27
    y = xy[1];
22
    return true;
28
    return true;
23
  }
29
  }
24
	
30
	
25
 
31
 
26
  template class ArithVec2Float<float, Vec2f>;
32
  template class ArithVec2Float<float, Vec2f>;
27
  template class ArithVec2Float<double, Vec2d>;
33
  template class ArithVec2Float<double, Vec2d>;
28
 
34
 
29
  template bool 
35
  template bool 
30
  linear_combine<double,Vec2d>(const ArithVec2Float<double,Vec2d>&,
36
  linear_combine<double,Vec2d>(const ArithVec2Float<double,Vec2d>&,
31
			       const ArithVec2Float<double,Vec2d>&,
37
			       const ArithVec2Float<double,Vec2d>&,
32
			       const ArithVec2Float<double,Vec2d>&,
38
			       const ArithVec2Float<double,Vec2d>&,
33
			       double&,
39
			       double&,
34
			       double&);
40
			       double&);
35
 
41
 
36
  template bool 
42
  template bool 
37
  linear_combine<float,Vec2f>(const ArithVec2Float<float,Vec2f>&,
43
  linear_combine<float,Vec2f>(const ArithVec2Float<float,Vec2f>&,
38
			      const ArithVec2Float<float,Vec2f>&,
44
			      const ArithVec2Float<float,Vec2f>&,
39
			      const ArithVec2Float<float,Vec2f>&,
45
			      const ArithVec2Float<float,Vec2f>&,
40
			      float&,
46
			      float&,
41
			      float&);
47
			      float&);
42
 
48
 
43
 
49
 
44
}
50
}
45
 
51