System.Drawing.Quadrilateral.DoesIntersects C# (CSharp) Method

DoesIntersects() private static method

Checks if the line coming out of the point downwards intersects with a line through point1 and point2.
private static DoesIntersects ( PointF point, PointF point1, PointF point2 ) : bool
point PointF /// PointF from which vertical line is drawn downwards. ///
point1 PointF /// First PointF through which line is drawn. ///
point2 PointF /// Second PointF through which line is drawn. ///
return bool
        private static bool DoesIntersects(PointF point, PointF point1, PointF point2)
        {
            float x2 = point2.X;
            float y2 = point2.Y;
            float x1 = point1.X;
            float y1 = point1.Y;
            if ((x2 < point.X && x1 >= point.X) || (x2 >= point.X && x1 < point.X)) {
                float y = (y2 - y1) / (x2 - x1) * (point.X - x1) + y1;
                return y > point.Y;
            }
            return false;
        }