rdpFinal listOfPoints original epsi acc
        | (length listOfPoints) == 2 = rdpFinal restOfList original epsi (acc ++ [point1])
        | distToLine < epsi          = rdpFinal restOfList original epsi (acc ++ [point1])
        | otherwise                  = rdpFinal tilPoint original epsi acc
        where
                twoPoints       = findFarthestTwoPoints listOfPoints [] 0
                point1          = twoPoints !! 0
                point2          = twoPoints !! 1
                distOfTwoPoints = distFunc point1 point2
                farthestPoint   = findFarthestPointToLine listOfPoints twoPoints (0,0) 0
                distToLine      = pointToLineDist point1 point2 farthestPoint
                restOfList      = drop (fromJust (elemIndex point2 original)) original
                tilPoint        = take (fromJust (elemIndex farthestPoint original)) original ++ [farthestPoint]
rdpFinal listOfPoints original epsi acc
        | (length listOfPoints) == 2 = rdpFinal restOfList original epsi (acc ++ [point1])
        | distToLine < epsi          = rdpFinal restOfList original epsi (acc ++ [point1])
        | otherwise                  = rdpFinal tilPoint original epsi acc
        where
                twoPoints       = findFarthestTwoPoints listOfPoints [] 0
                point1          = twoPoints !! 0
                point2          = twoPoints !! 1
                distOfTwoPoints = distFunc point1 point2
                farthestPoint   = findFarthestPointToLine listOfPoints twoPoints (0,0) 0
                distToLine      = pointToLineDist point1 point2 farthestPoint
                restOfList      = drop (fromJust (elemIndex point2 original)) original
                tilPoint        = take (fromJust (elemIndex farthestPoint original)) original ++ [farthestPoint]
rdpFinal listOfPoints original epsi acc
        | (length listOfPoints) == 2 = rdpFinal restOfList original epsi (acc ++ [point1])
        | distToLine < epsi          = rdpFinal restOfList original epsi (acc ++ [point1])
        | otherwise                  = rdpFinal tilPoint original epsi acc
        where
                twoPoints       = findFarthestTwoPoints listOfPoints [] 0
                point1          = twoPoints !! 0
                point2          = twoPoints !! 1
                distOfTwoPoints = distFunc point1 point2
                farthestPoint   = findFarthestPointToLine listOfPoints twoPoints (0,0) 0
                distToLine      = pointToLineDist point1 point2 farthestPoint
                restOfList      = drop (fromJust (elemIndex point2 original)) original
                tilPoint        = take (fromJust (elemIndex farthestPoint original)) original ++ [farthestPoint]