public void CommonIntersectionPointTest( float ax1, float ay1, float ax2, float ay2, float bx1, float by1, float bx2, float by2, float ix, float iy )
{
LineSegment segA = new LineSegment( new Point( ax1, ay1 ), new Point( ax2, ay2 ) );
LineSegment segB = new LineSegment( new Point( bx1, by1 ), new Point( bx2, by2 ) );
Point expectedIntersection = new Point( ix, iy );
// are we really collinear?
Assert.Throws<InvalidOperationException>( ( ) => ( (Line) segA ).GetIntersectionWith( (Line) segB ) );
Assert.Throws<InvalidOperationException>( ( ) => segA.GetIntersectionWith( (Line) segB ) );
Assert.Throws<InvalidOperationException>( ( ) => ( (Line) segA ).GetIntersectionWith( segB ) );
Assert.Throws<InvalidOperationException>( ( ) => segB.GetIntersectionWith( (Line) segA ) );
Assert.Throws<InvalidOperationException>( ( ) => ( (Line) segB ).GetIntersectionWith( segA ) );
Assert.AreEqual( expectedIntersection, segB.GetIntersectionWith( segA ) );
Assert.AreEqual( expectedIntersection, segA.GetIntersectionWith( segB ) );
}