last_stage_decision :: Int -> Int32 -> Double -> Int32 -> Int32 -> Int -> Int -> Int -> Int -> Int -> Point -> Point -> Point -> [Point] -> ([Int], [Point], [Point])
last_stage_decision dist succesive_inner_product eps dx dy i count wpos pos new_count start_pt end_pt pt dstContours 
        | condition = ([(i+1), (new_count - 1), (addSafePos wpos count), (addSafePos pos count)], finalDstContours, [end_pt, (readDstPt finalDstContours pos)])
        | otherwise = ([(i+1), new_count, (addSafePos wpos count), pos], finalSecondDstContours, [pt, pt])
        where
                condition              = fromIntegral (dist * dist) <= 0.5 * eps * fromIntegral (dx * dx + dy * dy) && dx /= 0 && dy /= 0 && succesive_inner_product >= 0
                finalDstContours       = replaceListValue dstContours end_pt wpos
                finalSecondDstContours = replaceListValue dstContours pt wpos
last_stage_decision :: Int -> Int32 -> Double -> Int32 -> Int32 -> Int -> Int -> Int -> Int -> Int -> Point -> Point -> Point -> [Point] -> ([Int], [Point], [Point])
last_stage_decision dist succesive_inner_product eps dx dy i count wpos pos new_count start_pt end_pt pt dstContours 
        | condition = ([(i+1), (new_count - 1), (addSafePos wpos count), (addSafePos pos count)], finalDstContours, [end_pt, (readDstPt finalDstContours pos)])
        | otherwise = ([(i+1), new_count, (addSafePos wpos count), pos], finalSecondDstContours, [pt, pt])
        where
                condition              = fromIntegral (dist * dist) <= 0.5 * eps * fromIntegral (dx * dx + dy * dy) && dx /= 0 && dy /= 0 && succesive_inner_product >= 0
                finalDstContours       = replaceListValue dstContours end_pt wpos
                finalSecondDstContours = replaceListValue dstContours pt wpos
last_stage_decision dist succesive_inner_product eps dx dy i count wpos pos new_count start_pt end_pt pt dstContours 
        | condition = ([(i+1), (new_count - 1), (addSafePos wpos count), (addSafePos pos count)], finalDstContours, [end_pt, (readDstPt finalDstContours pos)])
        | otherwise = ([(i+1), new_count, (addSafePos wpos count), pos], finalSecondDstContours, [pt, pt])
        where
                condition              = fromIntegral (dist * dist) <= 0.5 * eps * fromIntegral (dx * dx + dy * dy) && dx /= 0 && dy /= 0 && succesive_inner_product >= 0
                finalDstContours       = replaceListValue dstContours end_pt wpos
                finalSecondDstContours = replaceListValue dstContours pt wpos