Subversion Repositories gelsvn

Rev

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

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