Exemplo n.º 1
0
bool Point::isSegmentIntersect(const Point& A, const Point& B, const Point& C, const Point& D)
{
    float S, T;
    
    if (isLineIntersect(A, B, C, D, &S, &T )&&
        (S >= 0.0f && S <= 1.0f && T >= 0.0f && T <= 1.0f))
    {
        return true;
    }
    
    return false;
}
Exemplo n.º 2
0
bool Vec2::isSegmentIntersect(const Vec2& A, const Vec2& B, const Vec2& C, const Vec2& D)
{
    Real S, T;
    
    if (isLineIntersect(A, B, C, D, &S, &T )&&
        (S >= 0.0f && S <= 1.0f && T >= 0.0f && T <= 1.0f))
    {
        return true;
    }
    
    return false;
}
 bool Vector2::isSegmentOverlap(const Vector2& A, const Vector2& B, const Vector2& C, const Vector2& D)
 {
     double S, T;
     
     if (isLineIntersect(A, B, C, D, &S, &T )&&
         (S >= 0.0f && S <= 1.0f && T >= 0.0f && T <= 1.0f))
     {
         return true;
     }
     
     return false;
     
 }
Exemplo n.º 4
0
Point Point::getIntersectPoint(const Point& A, const Point& B, const Point& C, const Point& D)
{
    float S, T;
    
    if (isLineIntersect(A, B, C, D, &S, &T))
    {
        // Point of intersection
        Point P;
        P.x = A.x + S * (B.x - A.x);
        P.y = A.y + S * (B.y - A.y);
        return P;
    }
    
    return Point::ZERO;
}
Exemplo n.º 5
0
Vec2 Vec2::getIntersectPoint(const Vec2& A, const Vec2& B, const Vec2& C, const Vec2& D)
{
    float S, T;
    
    if (isLineIntersect(A, B, C, D, &S, &T))
    {
        // Vec2 of intersection
        Vec2 P;
        P.x = A.x + S * (B.x - A.x);
        P.y = A.y + S * (B.y - A.y);
        return P;
    }
    
    return Vec2::ZERO;
}
 Vector2 Vector2::getIntersectPoint(const Vector2& A, const Vector2& B, const Vector2& C, const Vector2& D)
 {
     double S, T;
     
     if (isLineIntersect(A, B, C, D, &S, &T))
     {
         // Vector2 of intersection
         Vector2 P;
         P.x = A.x + S * (B.x - A.x);
         P.y = A.y + S * (B.y - A.y);
         return P;
     }
     
     return Vector2::kZero;
 }