lightfieldApproximator.h 5.11 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
*                                                                              *
* 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.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21 22 23 24 25 26 27 28
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __LIGHTFIELD_APPROXIMATOR_H__
#define __LIGHTFIELD_APPROXIMATOR_H__

#include "Algo/Decimation/approximator.h"
29
#include "Topology/generic/mapBrowser.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
30 31 32 33 34 35 36 37 38 39

namespace CGoGN
{

namespace Algo
{

namespace Decimation
{

40 41 42 43 44 45 46 47 48 49 50 51
template <typename PFP>
class Approximator_FrameHalf : public Approximator<PFP, typename Geom::Matrix<3,3,typename PFP::REAL> >
{
public:
	typedef typename PFP::MAP MAP ;
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

	typedef Geom::Matrix<3,3,REAL> MATRIX33 ;
	typedef Geom::Matrix<3,6,REAL> MATRIX36 ;

public:
52
	Approximator_FrameHalf(MAP& m, VertexAttribute<MATRIX33>& frame, Predictor<PFP, MATRIX33>* pred = NULL) :
53
		Approximator<PFP, MATRIX33>(m, frame, pred)
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
	{}
	~Approximator_FrameHalf()
	{}
	ApproximatorType getType() const { return A_LightfieldHalf ; }
	bool init() { return true ; } ;
	void approximate(Dart d) ;
} ;

template <typename PFP>
class Approximator_RGBfunctionsHalf : public Approximator<PFP, typename Geom::Matrix<3,6,typename PFP::REAL> >
{
public:
	typedef typename PFP::MAP MAP ;
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

	typedef Geom::Matrix<3,3,REAL> MATRIX33 ;
	typedef Geom::Matrix<3,6,REAL> MATRIX36 ;

protected:
74 75 76
	VertexAttribute<MATRIX33> m_frame ;
	EdgeAttribute<MATRIX33> m_approxFrame ;
	EdgeAttribute<QuadricRGBfunctions<REAL>> m_quadricRGBfunctions ;
77 78

public:
79
	Approximator_RGBfunctionsHalf(MAP& m, VertexAttribute<MATRIX36>& rgbfunctions, Predictor<PFP, MATRIX36>* pred = NULL) :
80
		Approximator<PFP, MATRIX36>(m, rgbfunctions, pred)
81 82 83 84 85 86 87 88
	{ }
	~Approximator_RGBfunctionsHalf	()
	{}
	ApproximatorType getType() const { return A_LightfieldHalf ; }
	bool init() ;
	void approximate(Dart d) ;
} ;

Pierre Kraemer's avatar
Pierre Kraemer committed
89 90 91 92 93 94 95 96 97 98 99 100
template <typename PFP>
class Approximator_Frame : public Approximator<PFP, typename Geom::Matrix<3,3,typename PFP::REAL> >
{
public:
	typedef typename PFP::MAP MAP ;
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

	typedef Geom::Matrix<3,3,REAL> MATRIX33 ;
	typedef Geom::Matrix<3,6,REAL> MATRIX36 ;

protected:
101 102
	VertexAttribute<VEC3> m_position ;
	EdgeAttribute<VEC3> m_approxPosition ;
Pierre Kraemer's avatar
Pierre Kraemer committed
103 104

public:
105
	Approximator_Frame(MAP& m, VertexAttribute<MATRIX33>& frame, Predictor<PFP, MATRIX33>* pred = NULL) :
106
		Approximator<PFP, MATRIX33>(m, frame, pred)
Pierre Kraemer's avatar
Pierre Kraemer committed
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
	{}
	~Approximator_Frame()
	{}
	ApproximatorType getType() const { return A_LightfieldFull ; }
	bool init() ;
	void approximate(Dart d) ;
} ;

template <typename PFP>
class Approximator_RGBfunctions : public Approximator<PFP, typename Geom::Matrix<3,6,typename PFP::REAL> >
{
public:
	typedef typename PFP::MAP MAP ;
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

	typedef Geom::Matrix<3,3,REAL> MATRIX33 ;
	typedef Geom::Matrix<3,6,REAL> MATRIX36 ;

protected:
127 128 129
	VertexAttribute<MATRIX33> m_frame ;
	EdgeAttribute<MATRIX33> m_approxFrame ;
	EdgeAttribute<QuadricRGBfunctions<REAL>> m_quadricRGBfunctions ;
Pierre Kraemer's avatar
Pierre Kraemer committed
130 131

public:
132
	Approximator_RGBfunctions(MAP& m, VertexAttribute<MATRIX36>& rgbfunctions, Predictor<PFP, MATRIX36>* pred = NULL) :
133
		Approximator<PFP, MATRIX36>(m, rgbfunctions, pred)
Kenneth Vanhoey's avatar
Kenneth Vanhoey committed
134
	{ }
Pierre Kraemer's avatar
Pierre Kraemer committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
	~Approximator_RGBfunctions()
	{}
	ApproximatorType getType() const { return A_LightfieldFull ; }
	bool init() ;
	void approximate(Dart d) ;
} ;

} //namespace Decimation

} //namespace Algo

} //namespace CGoGN

#include "Algo/Decimation/lightfieldApproximator.hpp"

#endif