{"id":295937,"date":"2019-12-17T16:32:16","date_gmt":"2019-12-17T16:32:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295937"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295937","title":{"rendered":"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0431\u044a\u0435\u043c\u0430 \u0438 \u0446\u0435\u043d\u0442\u0440\u0430 \u043c\u0430\u0441\u0441 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/479290\/\">\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0432\u0441\u0435 \u0437\u043d\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u043e \u043e\u0442 \u043c\u0435\u043d\u044f \u00ab\u0432\u043b\u0430\u0441\u0442\u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u043b\u0438\u00bb. \u041d\u0430\u0448\u0435\u043b \u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0435\u0441\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u0430 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 \u0430\u0432\u0442\u043e\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u0432 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u0430. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0435\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 (\u0438 \u0441 \u043a\u043e\u0434\u043e\u043c) \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0445\u0430\u0431\u0440\u043e\u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0431\u043e\u0432 \u0434\u043b\u044f \u0438\u0433\u0440\u0443\u0448\u043a\u0438 \u0438 \u0433\u0434\u0435-\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043d\u043e\u0433\u0430\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u043c\u043e\u0431\u0430 (\u0430 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c) \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u043d\u0430\u0434 \u043d\u043e\u0433\u0430\u043c\u0438 \u043c\u043e\u0431\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mg\/o0\/1j\/mgo01jfkte64gkwjovk8xisnzsm.jpeg\"><br \/>  <a name=\"habracut\"><\/a><br \/>  \u041c\u043e\u0431 \u2014 \u044d\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a, \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 (\u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0438\u0434\u0438\u0442 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%BE%D1%80%D0%BC%D1%83%D0%BB%D0%B0_%D0%BF%D0%BB%D0%BE%D1%89%D0%B0%D0%B4%D0%B8_%D0%93%D0%B0%D1%83%D1%81%D1%81%D0%B0\" rel=\"nofollow\">\u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0413\u0430\u0443\u0441\u0441\u0430<\/a>, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430, \u043d\u043e \u0437\u0430\u0447\u0435\u043c&#8230;). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0435 \u0438\u043c\u0435\u0442\u044c \u0441\u0430\u043c\u043e\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0439 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u044b\u0439 \u043e\u0431\u044a\u0435\u043c, \u043a\u0430\u043a \u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u044b\u043c \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xt\/pl\/lu\/xtplludmrhnnpocxqv0ughwqilo.png\"><br \/>  <i>(\u043d\u0443 \u0442\u0438\u043f\u0430 \u0442\u0430\u043a\u043e\u0433\u043e)<\/i><\/p>\n<p>  \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 UPD, \u043f\u043e\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u0439, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430 \u041a\u0414\u041f\u0412 \u043f\u0440\u0430\u0432\u044b\u0439 \u043c\u043e\u0431 \u041d\u0435 \u041e\u043a, \u0430 \u043b\u0435\u0432\u044b\u0439 \u041e\u043a:<br \/>  \u041f\u0440\u0430\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043d\u0435 \u041e\u043a \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0431 \u0437\u0430\u0432\u0430\u043b\u0438\u0442\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434, \u0442.\u043a. \u0435\u0433\u043e \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0437\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043e\u043f\u043e\u0440\u044b. \u041f\u043b\u043e\u0449\u0430\u0434\u044c \u043e\u043f\u043e\u0440\u044b \u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438. \u0412 \u043b\u0435\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043e\u043f\u043e\u0440\u044b \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u0430 \u043f\u043e\u0434 \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 (\u0442.\u043a. \u0434\u0438\u043d\u043e\u0437\u0430\u0432\u0440\u0441\u043a\u0438\u0435 \u043b\u0430\u043f\u044b \u0431\u043e\u043b\u044c\u0448\u0435), \u0430 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0441\u0430\u043c\u0430 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u0438 \u0431\u043b\u0438\u0436\u0435 \u043a \u0445\u0432\u043e\u0441\u0442\u0443.<br \/>  \u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 \u0438 \u0446\u0435\u043d\u0442\u0440\u0430 \u043c\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0435: <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gs\/fz\/x8\/gsfzx8ju0ggexquycogdnpp-jwk.jpeg\"><\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u043d\u0443 \u0441 \u043a\u043e\u0434\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0431\u044a\u0435\u043c\u0430 (Python, \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u0447\u0435\u043a \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def RecSetDirsTriangles(para, Connects, TR):     \"\"\"\u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0440\u0435\u0431\u0440\u043e \u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\"\"\"     #1.\u043d\u0430\u0439\u0442\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0443, \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0435\u0449\u0435 \u043d\u0435\u0442     for i in range(0,len(Connects)):         if i != para[0] and i != para[1] and Connects[i][para[0]] and Connects[i][para[1]]: #\u0432\u043e\u0442 \u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a!             fl = 1             for T in TR:                 if i in T and para[1] in T and para[0] in T:                     fl = 0 #\u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0443\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d                     break             if fl: #\u043d\u0430\u0439\u0434\u0435\u043d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a!                 TR += [(para[1],para[0],i)]                 Recc((para[0], i) , Connects, TR)                 Recc((i, para[1]) , Connects, TR)  def FindV(dots, Connects):     \"\"\"\u0438\u0449\u0435\u043c \u043e\u0431\u044a\u0435\u043c. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 - dots \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0435\u0440\u0448\u0438\u043d \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430 \u0432\u0438\u0434\u0430 [x, y, z], Connects - \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430, Connects[i][j]=1 \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438 i, j, \u0438\u043d\u0430\u0447\u0435 =0 \"\"\"     #1. \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0441 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438     TR = []     for i in range(1,len(Connects)):#\u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0438 \u0435\u0449\u0435 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e         if Connects[i][0]:             for j in range(i+1, len(Connects)):                 if Connects[0][j] and Connects[i][j]:                     TR += [(0,i,j)]                     break             RecSetDirsTriangles((0,i),Connects, TR)             break     print(\"\u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432: \", len(TR))          #2. \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0431\u0430\u0437\u044b \u0438 \u043e\u0431\u044a\u0435\u043c \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b     V = 0     for T in TR:         '''\u0413\u0430\u0443\u0441 \u0440\u0443\u043b\u0438\u0442:           x1y2                         x2y3                         x3y1                           x2y1                        x3y2                        x1y3'''         S = 0.5 * (dots[T[0]][0]*dots[T[1]][1] + dots[T[1]][0]*dots[T[2]][1] + dots[T[2]][0]*dots[T[0]][1] - dots[T[1]][0]*dots[T[0]][1] - dots[T[2]][0]*dots[T[1]][1] - dots[T[0]][0]*dots[T[2]][1])         #S \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c + \u0438\u043b\u0438 - \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a         V += S*(dots[T[0]][2] + dots[T[1]][2] + dots[T[2]][2])\/3 #\u043e\u0431\u044a\u0435\u043c \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e...      return math.fabs(V) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u0443\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u2014 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043c\u044b \u0444\u0438\u0433\u0443\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u00ab\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435\u00bb \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c xy \u0433\u0440\u0430\u043d\u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0438 \u0437\u043d\u0430\u043a, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0430\u0434\u043e \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043c \u0444\u0438\u0433\u0443\u0440\u044b (\u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b). \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0435\u0441\u043b\u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u0438 \u043e\u0431\u044a\u0435\u043c \u0438 \u0437\u043d\u0430\u043a \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044e.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0432\u0437\u0433\u043b\u044f\u0434\u0435 \u00ab\u0441\u043d\u0430\u0440\u0443\u0436\u0438\u00bb \u043d\u0430 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a, \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0431\u044b\u043b\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 (\u0432 \u0438\u0434\u0435\u0430\u043b\u0435 \u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438; \u0435\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435, \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0440\u0435\u0442\u0443\u0440\u043d \u043e\u0442\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u0431\u044a\u0435\u043c\u0430).<\/p>\n<p>  \u0414\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0431\u0435\u0440\u0435\u043c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (\u0442\u043e\u0447\u043a\u0438 a1, a2, a3), \u0438\u0449\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0434\u0432\u0435 \u0441\u043e\u0432\u043f\u0430\u0432\u0448\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a: a2, a1, b1).<br \/>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ar\/-k\/zv\/ar-kzv2kd0qceid5m47na1xyvmi.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u043f\u0440\u043e\u0435\u0446\u0438\u0440\u0443\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c xy, \u0442\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u00ab\u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e\u00bb \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c, \u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0446\u0438 \u00ab\u043d\u0438\u0436\u043d\u0435\u0433\u043e\u00bb \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442 \u0437\u043d\u0430\u043a \u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u0413\u0430\u0443\u0441\u0441\u0430. \u0417\u0434\u0435\u0441\u044c \u00ab\u043d\u0438\u0436\u043d\u0438\u0439\u00bb \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u2014 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435 \u2014 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434 \u043d\u0438\u043c \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0431\u044a\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430. \u00ab\u041d\u0438\u0436\u043d\u0438\u0439\u00bb \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0443 \u043d\u0435\u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0448\u0435 \u00ab\u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e\u00bb.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430, \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u043e\u0436\u0438\u0442\u044c (\u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0437\u043d\u0430\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u00ab\u0441\u0430\u043c \u0441\u043e\u0431\u043e\u0439\u00bb) \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043c\u044b \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0437\u043c, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0433\u0440\u0430\u043d\u0435\u0439 \u0438 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439 \u044d\u0442\u0438\u0445 \u0433\u0440\u0430\u043d\u0435\u0439 \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c xy. \u0410 \u043e\u0431\u044a\u0435\u043c\u044b \u043f\u0440\u0438\u0437\u043c \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u0438 (\u043f\u043e \u0413\u0430\u0443\u0441\u0441\u0443, \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c) \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e z-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0432\u0435\u0440\u0448\u0438\u043d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c\u044e xy, \u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043c\u0430, \u0432\u0441\u0435 \u0437\u043d\u0430\u043a\u0438 \u0441\u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u0443\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c (\u043d\u0430\u0434\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0440\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u044b \u043f\u0440\u0438\u0437\u043c\u044b \u0431\u0435\u0437 \u043c\u043e\u0434\u0443\u043b\u044f).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ll\/lt\/qk\/llltqkv7v0i-r-i_50mzu0jqage.jpeg\"><br \/>  <i>(\u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u00ab\u0432\u0435\u0440\u0445\u043d\u044f\u044f\u00bb \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u0438\u0437\u043c\u0430)<\/i><\/p>\n<p>  \u0421 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u0446\u0435\u043d\u0442\u0440\u0430 \u043c\u0430\u0441\u0441 \u0432\u0441\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u0436\u0435. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438 \u0446\u0435\u043d\u0442\u0440\u044b \u043c\u0430\u0441\u0441 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b \u0438 \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e, \u0443\u043c\u043d\u043e\u0436\u0430\u044f \u043d\u0430 \u043e\u0431\u044a\u0435\u043c \u043f\u0440\u0438\u0437\u043c\u044b (\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u0430\u0441\u0441\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u043f\u043e \u043e\u0431\u044a\u0435\u043c\u0443 \u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c). \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u044b \u043c\u0430\u0441\u0441 \u0434\u0432\u0443\u0445 \u0442\u0435\u0442\u0440\u0430\u044d\u0434\u0435\u0440\u043e\u0432 (+1 \u0444\u0443\u043d\u043a\u0446\u0438\u044f) \u0438 \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u0430\u043a \u0436\u0435 \u00ab\u043d\u0435 \u043f\u043e\u0440\u0442\u0438\u0442\u0441\u044f\u00bb, \u0435\u0441\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c xy (\u0430 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u0431\u044b\u0442\u044c \u0440\u0435\u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u044f \u041c\u0430\u0433\u0440\u0438\u0442\u0442\u0430).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tm\/cz\/fm\/tmczfmf_yneom5ureeng0eny85a.jpeg\"><br \/>  <i>(\u0432\u043e\u0442 \u044d\u0442\u0438 \u0434\u0432\u0430 \u0442\u0435\u0442\u0440\u0430\u044d\u0434\u0435\u0440\u0430, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u043c \u0438 \u0440\u044b\u0436\u0438\u043c, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u043e\u0439 (\u043d\u0438\u0436\u0435 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0442\u0435\u0442\u0440\u0430\u044d\u0434\u0435\u0440\u0430) \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0438\u0441\u043a\u043e\u043c\u0443\u044e \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u0443\u044e \u043f\u0440\u0438\u0437\u043c\u0443. \u041d\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438 \u0446\u0435\u043d\u0442\u0440\u044b \u043c\u0430\u0441\u0441 \u0438 \u043e\u0431\u044a\u0435\u043c\u044b \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0444\u0438\u0433\u0443\u0440. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u0432 \u043a\u043e\u0434\u0435)<\/i><\/p>\n<p>  \u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e \u0438 \u0442\u043e:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def RecSetDirsTriangles(para, Connects, TR):     #1.\u043d\u0430\u0439\u0442\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0443, \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0435\u0449\u0435 \u043d\u0435\u0442     for i in range(0,len(Connects)):         if i != para[0] and i != para[1] and Connects[i][para[0]] and Connects[i][para[1]]: #\u0432\u043e\u0442 \u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a!             fl = 1             for T in TR:                 if i in T and para[1] in T and para[0] in T:                     fl = 0                     break             if fl: #\u043d\u0430\u0439\u0434\u0435\u043d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a!                 TR += [(para[1],para[0],i)]                 Recc((para[0], i) , Connects, TR)                 Recc((i, para[1]) , Connects, TR)      def TetrV(mas):#dot1, dot2, dot3, dot4):     \"\"\"\u043e\u0431\u044a\u0435\u043c \u0442\u0435\u0442\u0440\u0430\u044d\u0434\u0435\u0440\u0430 \u043f\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\"\"\"     M = np.zeros((3,3),float)     for i in range(1,4):         for j in range(0,3):             M[i-1][j] = mas[i][j] - mas[0][j]     #print(M)     return math.fabs(np.linalg.det(M)\/6)  def FindVandCM(dots, Connects):     \"\"\"\u0438\u0449\u0435\u043c \u043e\u0431\u044a\u0435\u043c \u0438 \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430\"\"\"     #1. \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0441 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438     TR = []     for i in range(1,len(Connects)): #\u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0438 \u0435\u0449\u0435 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e         if Connects[i][0]:             for j in range(i+1, len(Connects)):                 if Connects[0][j] and Connects[i][j]:                     TR += [(0,i,j)]                     break             RecSetDirsTriangles((0,i),Connects, TR)             break     print(\"\u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432: \", len(TR))          #2. \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0431\u0430\u0437\u044b, \u043e\u0431\u044a\u0435\u043c \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b \u0438 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e     V = 0     CM = [0, 0, 0]     for T in TR:         '''\u0413\u0430\u0443\u0441 \u0440\u0443\u043b\u0438\u0442:           x1y2                         x2y3                         x3y1                           x2y1                        x3y2                        x1y3'''         S = 0.5 * (dots[T[0]][0]*dots[T[1]][1] + dots[T[1]][0]*dots[T[2]][1] + dots[T[2]][0]*dots[T[0]][1] - dots[T[1]][0]*dots[T[0]][1] - dots[T[2]][0]*dots[T[1]][1] - dots[T[0]][0]*dots[T[2]][1])         #S \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c + \u0438\u043b\u0438 - \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a         V += S*(dots[T[0]][2] + dots[T[1]][2] + dots[T[2]][2])\/3 #\u043e\u0431\u044a\u0435\u043c \u0443\u0441\u0435\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0437\u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e...                  #c \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u043c\u0430\u0441\u0441 \u044f \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043e\u0442\u0434\u0435\u043b\u0430\u044e\u0441\u044c         c1 = ((dots[T[0]][0] + dots[T[1]][0] + dots[T[2]][0])\/3, (dots[T[0]][1]+ dots[T[1]][1]+ dots[T[2]][1])\/3) #\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430         hm = min([dots[T[0]][2] , dots[T[1]][2] , dots[T[2]][2]])         hM = max([dots[T[0]][2] , dots[T[1]][2] , dots[T[2]][2]])         indM = [dots[T[0]][2] , dots[T[1]][2] , dots[T[2]][2]].index(hM)         indm = [dots[T[0]][2] , dots[T[1]][2] , dots[T[2]][2]].index(hm)         V3 = S * hm         if indM == indm: #\u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a!             CM[0] += V3*c1[0]             CM[1] += V3*c1[1]             CM[2] += V3*hm\/2             continue         L = [0,1,2]                  L.remove(indM)         L.remove(indm)         indmidle = L[0]         dots1 = [dots[T[0]], dots[T[1]], dots[T[2]], (dots[T[indM]][0], dots[T[indM]][1] , hm)] #\u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0442\u0435\u0442\u0440\u0430\u044d\u0434\u0435\u0440         V1 = TetrV(dots1)         if S &lt; 0:             V1 = -V1         V2 = S * ( dots[T[indmidle]][2] - hm)\/3         #V3 = S * hm         CM[0] += V1*((dots[T[0]][0] + dots[T[1]][0] + dots[T[2]][0] + dots[T[indM]][0])\/4) + V2*((dots[T[0]][0] + dots[T[1]][0] + dots[T[2]][0] + dots[T[indmidle]][0])\/4) + V3*c1[0]         CM[1] += V1*((dots[T[0]][1] + dots[T[1]][1] + dots[T[2]][1] + dots[T[indM]][1])\/4) + V2*((dots[T[0]][1] + dots[T[1]][1] + dots[T[2]][1] + dots[T[indmidle]][1])\/4) + V3*c1[1]         CM[2] += V1*((dots[T[0]][2] + dots[T[1]][2] + dots[T[2]][2] + hm)\/4) + V2*((dots[T[0]][2] + dots[T[1]][2] + dots[T[2]][2] + hm)\/4) + V3*hm\/2      CM[0] = CM[0]\/V     CM[1] = CM[1]\/V     CM[2] = CM[2]\/V      return (math.fabs(V), CM) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0443\u0441\u043e\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0433\u0434\u0435 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430 \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0434, \u0435\u0433\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439 \u00ab\u043d\u0430\u0440\u0443\u0436\u0443\u00bb \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u043f\u0440\u043e\u0442\u0438\u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0438\u00bb \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0430\u043d\u0438 \u2014 \u0438 \u0432\u0443\u0430\u043b\u044f!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hz\/rh\/3y\/hzrh3yrdahhv8ei7gvmxsutzprc.jpeg\"><br \/>  <i>(\u0443\u0433\u0430\u0434\u0430\u0439 \u0444\u0438\u043b\u044c\u043c!)<\/i><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/479290\/\"> https:\/\/habr.com\/ru\/post\/479290\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/479290\/\">\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0432\u0441\u0435 \u0437\u043d\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043d\u043e \u043e\u0442 \u043c\u0435\u043d\u044f \u00ab\u0432\u043b\u0430\u0441\u0442\u0438 \u0441\u043a\u0440\u044b\u0432\u0430\u043b\u0438\u00bb. \u041d\u0430\u0448\u0435\u043b \u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0435\u0441\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u0430 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 \u0430\u0432\u0442\u043e\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u0432 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u0443\u043c\u0430. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0435\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 (\u0438 \u0441 \u043a\u043e\u0434\u043e\u043c) \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0445\u0430\u0431\u0440\u043e\u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0431\u043e\u0432 \u0434\u043b\u044f \u0438\u0433\u0440\u0443\u0448\u043a\u0438 \u0438 \u0433\u0434\u0435-\u0442\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043d\u043e\u0433\u0430\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0446\u0435\u043d\u0442\u0440 \u043c\u0430\u0441\u0441 \u043c\u043e\u0431\u0430 (\u0430 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c) \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u043d\u0430\u0434 \u043d\u043e\u0433\u0430\u043c\u0438 \u043c\u043e\u0431\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mg\/o0\/1j\/mgo01jfkte64gkwjovk8xisnzsm.jpeg\">  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-295937","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=295937"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295937\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}