lsst.afw  15.0-16-g953e39cab
LinearFunctor.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2015 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #include <memory>
26 #include "lsst/afw/geom/Functor.h"
27 
28 namespace lsst {
29 namespace afw {
30 namespace geom {
31 
32 LinearFunctor::LinearFunctor(double slope, double intercept)
33  : Functor("LinearFunctor"), _slope(slope), _intercept(intercept) {}
34 
39 
41  return std::make_shared<LinearFunctor>(_slope, _intercept);
42 }
43 
44 double LinearFunctor::operator()(double x) const { return _slope * x + _intercept; }
45 
46 double LinearFunctor::derivative(double x) const { return _slope; }
47 
48 } // namespace geom
49 } // namespace afw
50 } // namespace lsst
LinearFunctor & operator=(LinearFunctor const &)
LinearFunctor(double slope, double intercept)
Concrete implementation of Functor subclass for testing.
Definition: Functor.h:95
A base class for image defects.
double x
virtual double derivative(double x) const
virtual std::shared_ptr< Functor > clone() const
Abstract base class for function objects.
Definition: Functor.h:50
virtual double operator()(double x) const