5 #include "GeoModelKernel/GeoXF.h" 6 #include "GeoModelKernel/GeoDefinitions.h" 23 Function::~Function ()
27 Product operator * (
const Function & a,
const Function & b)
29 return Product (&a, &b);
32 PreMult operator * (
const GeoTrf::Transform3D & xf,
const Function & b)
34 return PreMult (xf, &b);
37 PostMult operator * (
const Function & a,
const GeoTrf::Transform3D & xf)
39 return PostMult (&a, xf);
42 unsigned int Function::dimensionality ()
const 53 Product::Product (
const Function * arg1,
54 const Function * arg2):m_arg1 (arg1->clone ()),
55 m_arg2 (arg2->clone ())
57 if (arg1->dimensionality () != arg2->dimensionality ())
60 runtime_error (
"Warning: dimension mismatch in GeoXF::Product");
66 Product *Product::clone ()
const 68 return new Product (*
this);
72 Product::Product (
const Product & right):Function (),
73 m_arg1 (right.m_arg1->clone ()), m_arg2 (right.m_arg2->clone ())
84 unsigned int Product::dimensionality ()
const 86 return m_arg1->dimensionality ();
89 GeoTrf::Transform3D Product::operator () (
double x)
const 91 return (*m_arg1) (x) * (*m_arg2) (x);
96 return (*m_arg1) (x) * (*m_arg2) (x);
107 PreMult::PreMult (
const GeoTrf::Transform3D & arg1,
108 const Function * arg2):m_arg1 (arg1),
109 m_arg2 (arg2->clone ())
115 PreMult *PreMult::clone ()
const 117 return new PreMult (*
this);
121 PreMult::PreMult (
const PreMult & right):Function (), m_arg1 (right.m_arg1),
122 m_arg2 (right.m_arg2->clone ())
132 unsigned int PreMult::dimensionality ()
const 134 return m_arg2->dimensionality ();
137 GeoTrf::Transform3D PreMult::operator () (
double x)
const 139 return m_arg1 * (*m_arg2) (x);
144 return m_arg1 * (*m_arg2) (x);
154 PostMult::PostMult (
const Function * arg1,
155 const GeoTrf::Transform3D & arg2):m_arg1 (arg1->clone ()),
162 PostMult *PostMult::clone ()
const 164 return new PostMult (*
this);
168 PostMult::PostMult (
const PostMult & right):Function (),
169 m_arg1 (right.m_arg1->clone ()), m_arg2 (right.m_arg2)
174 PostMult::~PostMult ()
179 unsigned int PostMult::dimensionality ()
const 181 return m_arg1->dimensionality ();
184 GeoTrf::Transform3D PostMult::operator () (
double x)
const 186 return (*m_arg1) (x) * m_arg2;
191 return (*m_arg1) (x) * m_arg2;
196 m_function (f.clone ())
205 GeoTrf::Transform3D Pow::operator() (
double x)
const 210 GeoTrf::RotationMatrix3D rotate = m_xf.rotation ();
211 GeoTrf::Vector3D translate = m_xf.translation ();
212 Eigen::AngleAxis<double> aa(rotate);
216 double nTimes = (*m_function) (x);
221 double& delta = aa.angle();
226 return GeoTrf::Translation3D (translate) * GeoTrf::Transform3D(aa);
231 return operator () (argument[0]);
234 Pow *Pow::clone ()
const 236 return new Pow (*
this);
239 Pow::Pow (
const Pow & right):Function (), m_xf (right.m_xf),
240 m_function (right.m_function->clone ())