1 /**************************************************************************/
2 /*  Copyright 2012 Tim Day                                                */
3 /*                                                                        */
4 /*  This file is part of Evolvotron                                       */
5 /*                                                                        */
6 /*  Evolvotron is free software: you can redistribute it and/or modify    */
7 /*  it under the terms of the GNU General Public License as published by  */
8 /*  the Free Software Foundation, either version 3 of the License, or     */
9 /*  (at your option) any later version.                                   */
10 /*                                                                        */
11 /*  Evolvotron is distributed in the hope that it will be useful,         */
12 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of        */
13 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         */
14 /*  GNU General Public License for more details.                          */
15 /*                                                                        */
16 /*  You should have received a copy of the GNU General Public License     */
17 /*  along with Evolvotron.  If not, see <http://www.gnu.org/licenses/>.   */
18 /**************************************************************************/
19 
20 /*! \file
21   \brief Interfaces for class FunctionPreTransform
22   This class would normally live in functions.h (and is included and registered there),
23   but is split out so it can be efficiently used by MutatableImageDisplay and EvolvotronMain.
24   NB There is no class heirarchy here as all virtualisation and boilerplate services are supplied when the functions are plugged into the FunctionNode template.
25 */
26 
27 #ifndef _function_pre_transform_h_
28 #define _function_pre_transform_h_
29 
30 #include "common.h"
31 
32 #include "function_boilerplate.h"
33 
34 #include "transform.h"
35 
36 //! Function class returning leaf node evaluated at position transfomed by a 12-component linear transform.
37 FUNCTION_BEGIN(FunctionPreTransform,12,1,false,0)
38 
39   //! Return the evaluation of arg(0) at the transformed position argument.
evaluate(const XYZ & p)40   virtual const XYZ evaluate(const XYZ& p) const
41   {
42     const Transform transform(params());
43     return arg(0)(transform.transformed(p));
44   }
45 
46 FUNCTION_END(FunctionPreTransform)
47 
48 #endif
49