Exemple #1
0
Polygon::Polygon(const VP& SomePoints, bool alreadyconvex)
{
    assert(!SomePoints.empty());

    // 	cout << "Polygon::cctor" << endl;
    if (alreadyconvex)
    {
        m_vPoints = SomePoints;
    }
    else
    {
        m_vPoints = ConvexHull(SomePoints);
    }
    // 	cout << "getting center of mass" << endl;

    m_pPosition = Sum(m_vPoints)/m_vPoints.size();

    // 	cout << "substracting" << endl;
    for (auto& m_vPoint : m_vPoints)
    {
        m_vPoint -= m_pPosition;
    }
    // 	cout << "done" << endl;
}