public int findSideIntersect ( SquareNode n , LineSegment2D_F64 line , Point2D_F64 intersection , LineSegment2D_F64 storage ) { for ( int j = 0 , i = 3 ; j < 4 ; i = j , j ++ ) { storage . a = n . square . get ( i ) ; storage . b = n . square . get ( j ) ; if ( Intersection2D_F64 . intersection ( line , storage , intersection ) != null ) { return i ; } } // bug but I won't throw an exception to stop it from blowing up a bunch return - 1 ; }
Finds the side which intersects the line on the shape . The line is assumed to pass through the shape so if there is no intersection it is considered a bug