quadricRGBfunctions.h 3.67 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg                *
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/                              *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/
Pierre Kraemer's avatar
Pierre Kraemer committed
24
25
26
27
28
29
30

#ifndef QUADRICLF_H_
#define QUADRICLF_H_


#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
31
#include "Utils/cgognStream.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45

using namespace CGoGN;

enum channel {RED=0, GREEN, BLUE};
#define COLCHANNELS 3

template <typename REAL>
class QuadricRGBfunctions {
public:
	typedef Geom::Vector<3,REAL> VEC3;
	typedef Geom::Vector<6,REAL> VEC6;
	typedef Geom::Matrix<6,6,REAL> MATRIX66;

	typedef Geom::Matrix<3,3,REAL> MATRIX33;
46
	typedef Geom::Matrix<3,6,REAL> MATRIX36;
Pierre Kraemer's avatar
Pierre Kraemer committed
47
48

private:
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
49
	MATRIX66 A;
Pierre Kraemer's avatar
Pierre Kraemer committed
50
51
52
53
54
55
56
57
58
59
	VEC6 b[COLCHANNELS];
	REAL c[COLCHANNELS];


public:
	static std::string CGoGNnameOfType() ;

	QuadricRGBfunctions();
	QuadricRGBfunctions(int i);
	QuadricRGBfunctions(const QuadricRGBfunctions&);
60
	QuadricRGBfunctions(const MATRIX36&, const REAL gamma = REAL(0), const REAL alpha = REAL(0)) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
61

62
	virtual ~QuadricRGBfunctions() {} ;
Pierre Kraemer's avatar
Pierre Kraemer committed
63

64
	REAL operator() (const MATRIX36&) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
65

66
	bool findOptimizedRGBfunctions(MATRIX36& lff) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
67
68
69

	void operator += (const QuadricRGBfunctions&) ;
	void operator -= (const QuadricRGBfunctions&) ;
70
71
	void operator *= (const REAL v) ;
	void operator /= (const REAL v) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
72
73
74

	void zero () ;

Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
75
	friend std::ostream& operator<< (std::ostream &out, const QuadricRGBfunctions& q) {
76
77
		out << "quadricRGBf : " << std::endl ;
		out << "q.A" << "= " << q.A << std::endl ;
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
78
		for (unsigned int i = 0 ; i < 3 ; ++i) {
79
80
			out << "q.b["<<i<<"] = " << q.b[i] << std::endl ;
			out << "q.c["<<i<<"] = " << q.c[i] << std::endl ;
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
81
82
83
		}
		return out ;
	} ;
Pierre Kraemer's avatar
Pierre Kraemer committed
84
85
86
	friend std::istream& operator>> (std::istream &in, const QuadricRGBfunctions&) {return in;};

private :
87
88
89
90
	void buildIntegralMatrix_A(MATRIX66 &, const REAL alpha) const;
	void buildIntegralMatrix_b(MATRIX66 &, const REAL alpha) const;
	void buildIntegralMatrix_c(MATRIX66 &, const REAL alpha) const;
	void buildRotateMatrix(MATRIX66 &N, const REAL gamma) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
91
92
93
94
95
96
97

};


#include "quadricRGBfunctions.hpp"

#endif /* QUADRICLF_H_ */