SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExtendedModel.cpp
Go to the documentation of this file.
1 
23 #include <numeric> // for std::accumulate
27 #include "ModelFitting/utils.h"
28 
29 namespace ModelFitting {
30 
33  std::shared_ptr<BasicParameter> rotation_angle, double width, double height,
35  : PositionedModel(x, y), m_width{width}, m_height{height} {
36  for (auto& component : component_list) {
37  auto scaled = make_unique<ScaledModelComponent>(std::move(component), x_scale, y_scale);
38  auto rotated = make_unique<RotatedModelComponent>(std::move(scaled), rotation_angle);
39  m_component_list.emplace_back(std::move(rotated));
40  }
41 }
42 
43 ExtendedModel::ExtendedModel(ExtendedModel&&) = default;
44 
46 
47 double ExtendedModel::getValue(double x, double y) const {
48  x -= getX();
49  y -= getY();
50  return std::accumulate(m_component_list.begin(), m_component_list.end(), 0.,
51  [x, y](double a, const std::unique_ptr<ModelComponent>& b) {
52  return a + b->getValue(x, y);
53  });
54 }
55 
56 double ExtendedModel::getWidth() const {
57  return m_width;
58 }
59 
60 double ExtendedModel::getHeight() const {
61  return m_height;
62 }
63 
64 } // end of namespace ModelFitting
double getValue(double x, double y) const
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
ExtendedModel(std::vector< std::unique_ptr< ModelComponent >> &&component_list, std::shared_ptr< BasicParameter > x_scale, std::shared_ptr< BasicParameter > y_scale, std::shared_ptr< BasicParameter > rotation_angle, double width, double height, std::shared_ptr< BasicParameter > x, std::shared_ptr< BasicParameter > y)
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
std::vector< std::unique_ptr< ModelComponent > > m_component_list
Definition: ExtendedModel.h:57
T move(T...args)
STL class.
STL class.
T accumulate(T...args)