void MainWindow::sort_simplex(Simplex &smplx)
{
    unsigned ar_size = smplx.get_number_of_vertexes();   //sort
    for (unsigned j=0; j<ar_size-1; j++)
        for (unsigned i=0; i<ar_size-1; i++)
            if (func(smplx.get_vertex(i)) > func(smplx.get_vertex(i+1)))
                std::swap(smplx.m_array[i], smplx.m_array[i+1]);
    smplx.set_h(smplx.get_vertex(ar_size-1));   //set h,g,l
    smplx.set_g(smplx.get_vertex(ar_size-2));
    smplx.set_l(smplx.get_vertex(0));
    Point c;     //calculate center of mass
    for (unsigned i=0; i<ar_size-1; i++)
        c += smplx.m_array[i];
//    c = std::accumulate(m_array.begin(), m_array.end() - 1, 0) /(ar_size - 1);
    c /= ar_size-1;
    smplx.set_c(c);

//    std::sort(m_array.begin(), m_array.end(), comparator_by_f);
}