//=============================================================================

#pragma once

//== INCLUDES =================================================================


#include <vector>

#include "../my_types.h"

#include "Energy_term.h"


//== NAMESPACE ================================================================


namespace graphene {
namespace surface_mesh {


//== CLASS DEFINITION =========================================================


class
Energy_term_landmarks_skinned_multiple_scans : public Energy_term
{
private:
    struct Per_fitting_target_data
    {
        std::vector<Point> lm_ps;
        std::vector<Point> lm_templ;
        std::vector<Surface_mesh::Vertex> lm_templ_vertices;
        Surface_mesh::Vertex_property<double> local_landmark_weight;

        std::vector<Mat4f> skinning_tpose_to_scanpose;
    };

public:

    Energy_term_landmarks_skinned_multiple_scans(const Energy_term_data& energy_term_data, double weight);

    virtual ~Energy_term_landmarks_skinned_multiple_scans();

    virtual void pre_minimize_action();

    virtual double evaluate();

    virtual void add_rows_big_lse( std::vector<Tripl>& coeffs,
                                   Eigen::VectorXd& b,
                                   unsigned int& r);

    virtual unsigned int n_rows_big_sle();

    virtual bool small_sle_supported() { return false; }

    virtual void solve_result(std::set<Solve_result>& solve_results) {solve_results.insert(SR_VERTICES);}
};


//=============================================================================
} // namespace surface_mesh
} // namespace graphene
//=============================================================================
