Subversion Repositories gelsvn

Rev

Rev 207 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 207 Rev 296
Line 1... Line 1...
1
#ifndef __QEM_H
1
#ifndef __QEM_H
2
#define __QEM_H
2
#define __QEM_H
3
 
3
 
4
#include <cfloat>
4
#include <cfloat>
5
#include "CGLA/Vec3f.h"
-
 
6
#include "CGLA/Vec3d.h"
5
#include "CGLA/Vec3d.h"
7
#include "CGLA/Mat3x3d.h"
6
#include "CGLA/Mat3x3d.h"
8
 
7
 
9
 
8
 
10
namespace
9
namespace
Line 41... Line 40...
41
					A += q.A;
40
					A += q.A;
42
					b += q.b;
41
					b += q.b;
43
					c += q.c;
42
					c += q.c;
44
				}
43
				}
45
			
44
			
46
			float error(const CGLA::Vec3f& _p) const
45
			float error(const CGLA::Vec3d& p) const
47
				{
46
				{
48
					CGLA::Vec3d p(_p);
-
 
49
					return dot(p,A*p) + 2*dot(b,p)+ c;
47
					return dot(p,A*p) + 2*dot(b,p)+ c;
50
				}
48
				}
51
 
49
 
52
			double determinant() const
50
			double determinant() const
53
				{
51
				{
54
					return CGLA::determinant(A);
52
					return CGLA::determinant(A);
55
				}
53
				}
56
			
54
			
57
			const CGLA::Vec3f grad(const CGLA::Vec3f& _p) const
55
			const CGLA::Vec3d grad(const CGLA::Vec3d& _p) const
58
				{
56
				{
59
					CGLA::Vec3d p(_p);
57
					CGLA::Vec3d p(_p);
60
					CGLA::Vec3f g(2*A*p+2*b);
58
					CGLA::Vec3d g(2*A*p+2*b);
61
					return g;
59
					return g;
62
				}
60
				}
63
			
61
			
64
			CGLA::Vec3f opt_pos(double QEM_thresh = 0.005) const;
62
			CGLA::Vec3d opt_pos(double QEM_thresh = 0.005) const;
65
			
63
			
66
		};
64
		};
67
}
65
}
68
 
66
 
69
namespace GEO = Geometry;
67
namespace GEO = Geometry;