public static IBoundedLine GetBoundedLine(DoubleVector2 firstPoint, DoubleVector2 secondPoint)
 {
     var dx = secondPoint.X - firstPoint.X;
     var dy = secondPoint.Y - firstPoint.Y;
     var yPerX = dy/dx;
     if (double.IsInfinity(yPerX))
     {
         return new BoundedVertical(firstPoint.X, firstPoint.Y, secondPoint.Y);
     }
     return new TwoPointBoundedLine(firstPoint, secondPoint);
 }
 internal TwoPointBoundedLine(DoubleVector2 first, DoubleVector2 second)
 {
     leftToRight = first.X < second.X;
     if (leftToRight)
     {
         left = first;
         right = second;
     }
     else
     {
         left = second;
         right = first;
     }
 }
 private static bool IsIntersectionWithinBounds(IBoundedLine second, DoubleVector2 intersection)
 {
     return (second.LeftX < intersection.X && intersection.X < second.RightX)
            || (second.BottomY < intersection.Y && intersection.Y < second.TopY);
 }
 public static Angle FromPoint(DoubleVector2 doubleVector2)
 {
     return new Angle(Math.Atan2(doubleVector2.Y, doubleVector2.X));
 }