Haskell-- Типы данных и их синонимыimport Data.List data Point = Point {getx, gety :: Float}type Octagon = [Point]type RelID = Float -- Определяем Epsilonepsilon = 1e-6 -- Вспомогательные простейшие функцииsign :: Float -> IntgetAngle :: Point -> FloatgetDistPnt :: Point -> Point -> FloatcalcPntRelID :: Point -> Point -> RelIDcalcSectRelID :: (Point, Point) -> Point -> RelID calcRelID :: Octagon -> Point -> RelIDcalcRelID oct pnt | getDistPnt (Point 0 0) pnt < epsilon = 0 | anglePnt2Corner beg < epsilon = calcPntRelID beg pnt | otherwise = calcSectRelID (beg, end) pnt where pnt_angle = getAngle pnt anglePnt2Corner corn = abs (pnt_angle - getAngle corn) cmpByAngleNear apnt bpnt = compare (anglePnt2Corner apnt) $ anglePnt2Corner bpnt nearestCorns = sortBy cmpByAngleNear oct beg = head nearestCorns begAngle = sign (pnt_angle - getAngle beg) testSign x = sign (pnt_angle - getAngle x) /= begAngle end = head . dropWhile testSign . tail $ nearestCorns sign x = undefinedgetAngle pnt = undefinedgetDistPnt apnt bpnt = undefinedcalcPntRelID apnt bpnt = undefinedcalcSectRelID (beg, end) pnt = undefined