# IntersectionResult

# Description

A structure used to represent the result of intersection calculation between two line segments, including whether they intersect, the intersection point, and whether they are collinear.

# How to Use

// Define the start and end points of the line segments
Vector myPosition = ObjectManager::Player()->Position();
Vector myEndPoint = myPosition.Extend(targetPosition, 500.f);

Vector enemyPosition = enemy->Position();
Vector enemyEndPoint = enemyPosition.Extend(enemyDirection, 300.f);

// Calculate whether the two line segments intersect
IntersectionResult result = myPosition.Intersection(myEndPoint, enemyPosition, enemyEndPoint);

// Use the intersection result
if (result.Intersects)
{
    // The two line segments intersect, get the intersection point
    Vector intersectionPoint = result.Point;
    
    // Perform further calculations using the intersection point
    float distanceToIntersection = myPosition.Distance(intersectionPoint);
    
    // Can decide skill casting based on the intersection point
    if (distanceToIntersection < 300.f)
    {
        // Cast skill at the intersection point
        ObjectManager::Player()->CastSpell(eSpellSlot::E, intersectionPoint);
    }
}

// Check if they are collinear
if (result.IsCollinear)
{
    // The two line segments are collinear, may need special handling
}

# Properties

Property Type Description
Intersects bool Whether the two line segments intersect
Point Vector Coordinates of the intersection point
IsCollinear bool Whether the two line segments are collinear