//
// Created by martin on 27. 3. 2021.
//

#ifndef ARC_MATRIX_ELIFIT_H
#define ARC_MATRIX_ELIFIT_H


#include <vector>
#include <opencv2/core.hpp>
#include <eigen3/Eigen/Core>
#include <map>
#include <set>

/**
 * fits a point combination into an ellipse
 * @param arcGroup an ellipse combination
 * @param ScatterMatrices vector of scatter matrices to each arc
 * @return general ellipse equation
 */
Eigen::Matrix<double, 6, 1> fit(std::set<int> &arcGroup,std::map<int,Eigen::Matrix<double,6,6>> &ScatterMatrices);

/**
 * calculates cumulative factor
 * @param point a point from the combination
 * @return cummulative factor of the point
 */
Eigen::Matrix<double, 6, 6> cumulativeFactor(cv::Point2i &point);

/**
 * calculates cumulative matrix from the elliptical arc
 * @param arc a arc from the ellipse combination
 * @return cumulative matrix of the arc
 */
Eigen::Matrix<double, 6, 6> cumulativeMatrix(std::vector<cv::Point2i> &arc);

#endif //ARC_MATRIX_ELIFIT_H
