# MecCircle

# Description

A structure representing the Minimum Enclosing Circle (MEC), used to calculate the smallest circular area that can enclose a group of points.

# How to Use

// Get enemy hero positions
std::vector<Vector> enemyPositions;
auto enemies = ObjectManager::Get_EnemyHeroes();
for (auto enemy : enemies)
{
    if (enemy->IsValid() && enemy->IsVisible() && enemy->IsTargetable() && 
        enemy->Position().Distance(ObjectManager::Player()->Position()) <= 1500.f)
    {
        enemyPositions.push_back(enemy->Position());
    }
}

// If there are multiple enemies, calculate the minimum enclosing circle
if (enemyPositions.size() >= 2)
{
    // Get the minimum circle enclosing all enemies
    MecCircle circle = MEC::GetMec(enemyPositions);
    
    // Use the minimum enclosing circle information
    Vector circleCenter = circle.Center;
    float circleRadius = circle.Radius;
    
    // Check if there are enough enemies in the circle and the circle radius is moderate
    if (enemyPositions.size() >= 3 && circleRadius < 350.f)
    {
        // Suitable for using AOE skills, such as Annie's W, Teemo's mushrooms, etc.
        ObjectManager::Player()->CastSpell(eSpellSlot::R, circleCenter);
    }
    
    // Draw the minimum enclosing circle for debugging
    Geometry::Circle(circleCenter, circleRadius).Draw(MAKE_COLOR(255, 0, 0, 255), 2.f);
}

# Properties

Property Type Description
Center Vector Circle center position
Radius float Circle radius