secondRecursiveFunc :: [Point] -> Int -> Int32 -> Int32 -> Int -> Int -> Range -> Range -> Point -> (Range, Int) 
secondRecursiveFunc srcContours count dx dy max_dist pos slice right_slice start_pt
        | pos == (last slice)                      = (right_slice, max_dist) 
        | pos /= (last slice) && ((fromIntegral dist) > max_dist) = secondRecursiveFunc srcContours count dx dy (fromIntegral dist) (addSafePos pos count) slice new_right_slice start_pt
        | otherwise                                = secondRecursiveFunc srcContours count dx dy max_dist (addSafePos pos count) slice right_slice start_pt
        where
                new_right_slice = changeFirstValue right_slice ((pos + count - 1) `mod` count)
                pt              = readPt srcContours pos
                dist            = abs (((snd pt) - (snd start_pt)) * dx - ((fst pt) - (fst start_pt)) * dy)
secondRecursiveFunc :: [Point] -> Int -> Int32 -> Int32 -> Int -> Int -> Range -> Range -> Point -> (Range, Int)
secondRecursiveFunc srcContours count dx dy max_dist pos slice right_slice start_pt
        | pos == (last slice)                      = (right_slice, max_dist) 
        | pos /= (last slice) && ((fromIntegral dist) > max_dist) = secondRecursiveFunc srcContours count dx dy (fromIntegral dist) (addSafePos pos count) slice new_right_slice start_pt
        | otherwise                                = secondRecursiveFunc srcContours count dx dy max_dist (addSafePos pos count) slice right_slice start_pt
        where
                new_right_slice = changeFirstValue right_slice ((pos + count - 1) `mod` count)
                pt              = readPt srcContours pos
                dist            = abs (((snd pt) - (snd start_pt)) * dx - ((fst pt) - (fst start_pt)) * dy)
secondRecursiveFunc srcContours count dx dy max_dist pos slice right_slice start_pt
        | pos == (last slice)                      = (right_slice, max_dist) 
        | pos /= (last slice) && ((fromIntegral dist) > max_dist) = secondRecursiveFunc srcContours count dx dy (fromIntegral dist) (addSafePos pos count) slice new_right_slice start_pt
        | otherwise                                = secondRecursiveFunc srcContours count dx dy max_dist (addSafePos pos count) slice right_slice start_pt
        where
                new_right_slice = changeFirstValue right_slice ((pos + count - 1) `mod` count)
                pt              = readPt srcContours pos
                dist            = abs (((snd pt) - (snd start_pt)) * dx - ((fst pt) - (fst start_pt)) * dy)