{"id":313642,"date":"2020-11-23T21:00:43","date_gmt":"2020-11-23T21:00:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313642"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313642","title":{"rendered":"\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 3D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<h1 id=\"chto-zachem\">\u0427\u0442\u043e? \u0417\u0430\u0447\u0435\u043c?<\/h1>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e <strong>\u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 3D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438<\/strong>. \u041a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u0438 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u0438 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0434\u0443\u043c\u0430\u044e, \u0412\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0435\u0439, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0412\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e-\u0442\u043e \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430\u0445, \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0437\u0443\u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0438\u0445.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0412\u044b \u0433\u0443\u0440\u0443 \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0412\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nf\/pc\/1h\/nfpc1hgwl6bsmcp7m3moqcaj6mq.jpeg\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<hr>\n<p>  <\/p>\n<h2 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0427\u0442\u043e? \u0417\u0430\u0447\u0435\u043c?<\/li>\n<li>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430?<\/li>\n<li>\u041e\u0431\u0449\u0438\u0435 \u0441\u043b\u043e\u0432\u0430<\/li>\n<li>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/li>\n<li>\u0410\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/li>\n<li>\u041f\u043e\u043b\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/li>\n<\/ul>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<p><em>\u0412\u044b\u0440\u0430\u0436\u0430\u044e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/users\/muji-4ok\/\" class=\"user_link\">muji-4ok<\/a> \u0437\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"chto-takoe-vypuklaya-obolochka\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430?<\/h2>\n<p>  <\/p>\n<p><em>\u0412\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u043e\u0439<\/em> \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 X \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e X. <\/p>\n<p>  <\/p>\n<p><em>\u0421\u0442\u0440\u043e\u0433\u043e, \u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e.<\/em> \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<br \/>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0438, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a \u043d\u0430\u0434\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a \u043b\u0435\u0436\u0430\u043b\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jp\/ln\/ai\/jplnaibmzuesqd1zeyewl_cfpls.jpeg\"><\/p>\n<p>  <\/p>\n<p><em>\u041d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0435\u0439 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0432\u044b\u043f\u0443\u043a\u043b\u0430\u044f 2D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430<\/em><br \/>  <em>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043c\u043d\u043e\u0433\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443<\/em><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0432\u044b\u043f\u0443\u043a\u043b\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0441\u0440\u0430\u0437\u0443 \u043e\u0441\u043e\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0435\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u0432\u0435\u0434\u044c \u0437\u043d\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0435\u0448\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044f &quot;\u0432\u043d\u0435\u0448\u043d\u0438\u0435&quot; \u0442\u043e\u0447\u043a\u0438 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"obschie-slova\">\u041e\u0431\u0449\u0438\u0435 \u0441\u043b\u043e\u0432\u0430<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e, \u0447\u0435\u043c \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435, \u0432\u044b\u043f\u0443\u043a\u043b\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 3D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0448\u0438 \u0442\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0430 \u043d\u0430\u0448\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0439.<\/p>\n<p>  <\/p>\n<p><em>\u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u0435\u0441\u043b\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043d\u0430\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e, \u0447\u0442\u043e \u0436\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043e\u0431\u044a\u0451\u043c\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435?<\/em><\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u2014 \u0442\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c. \u041f\u043e\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0451\u043c\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a, \u0438 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0430\u0447\u0430: \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a \u0431\u0443\u043c\u0430\u0433\u043e\u0439. <\/p>\n<p>  <\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e <em>\u043c\u043d\u043e\u0433\u043e\u0433\u0440\u0430\u043d\u043d\u0438\u043a\u0430<\/em> \u0432\u043e\u0437\u044c\u043c\u0435\u043c <em>\u043f\u043e\u0434\u0430\u0440\u043e\u043a<\/em> \u0438 \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u043e\u0431\u0435\u0440\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0430\u0440\u043e\u0447\u043d\u043e\u0439, \u0431\u043b\u0435\u0441\u0442\u044f\u0449\u0435\u0439, \u0431\u0443\u043c\u0430\u0433\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0434\u0438\u043d \u0438\u0437 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c) \u043f\u043e\u0438\u0441\u043a\u0430 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>&quot;\u0437\u0430\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u0430&quot;<\/strong>.<\/p>\n<p>  <\/p>\n<p><em><u>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/u><\/em> \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0438\u043a\u0430\u043a\u0438\u0435 4 \u043d\u0435 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0435 3 \u0442\u043e\u0447\u043a\u0438 \u0437\u0430\u0434\u0430\u044e\u0442 \u0441\u0432\u043e\u044e \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"opisanie-algoritma\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043d\u0430 \u043c\u0435\u043d\u044c\u0448\u0438\u0435 \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0438, \u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0438\u0445 \u0440\u0435\u0448\u0430\u0442\u044c. <\/p>\n<p>  <\/p>\n<p>\u042f \u043f\u0440\u043e\u0448\u0443 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f 3d \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u0435\u043d \u0438 \u043d\u0435\u0441\u043b\u043e\u0436\u0435\u043d.<\/p>\n<p>  <\/p>\n<p><strong>1. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/strong><br \/>  \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u0433\u0440\u0430\u043d\u044c, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0447\u043d\u0435\u0442\u0441\u044f \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0438, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0439\u0442\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<br \/>  \u042d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0435\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e \u043e\u0441\u0438 Z. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u0437\u044f\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043e\u0441\u044c, \u043d\u043e \u043a\u0430\u043a \u0431\u044b &quot;\u043a\u043b\u0430\u0441\u0442\u044c&quot; \u043d\u0430\u0448 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043f\u043e \u043e\u0441\u0438 Z \u0437\u0432\u0443\u0447\u0438\u0442 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u0430\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c XY \u0441\u043c\u0435\u0441\u0442\u0438\u043b\u0430\u0441\u044c, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0441 \u043d\u0430\u0448\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439. \u041c\u044b \u043a\u0430\u043a \u0431\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438 \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u043d\u0430 \u0441\u0442\u043e\u043b. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443 P, \u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b &quot;\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438&quot; \u043f\u043e\u0434\u0430\u0440\u043e\u043a \u2014 f.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0431\u043e\u0440 \u0432\u0442\u043e\u0440\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u043e \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u043e\u043d\u044f\u0442\u0435\u043d. \u041c\u044b \u0431\u0435\u0440\u0435\u043c \u0442\u043e\u0447\u043a\u0443 Q, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0435\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c f (\u0442\u043e\u0447\u043a\u0443 prQ). \u0418\u0449\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0442\u043e\u0447\u043a\u0443, \u0447\u0442\u043e \u0443\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438 (\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438) {P, Q} \u0438 {Q, prQ} \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u2014 \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0443\u0433\u043e\u043b \u2014 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0439. \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0442\u0443\u043f\u043e\u0439, \u0437\u043d\u0430\u0447\u0438\u0442 \u0442\u043e\u0447\u043a\u0430 Q \u043a\u0430\u043a \u0431\u044b \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0438\u0436\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445, \u0435\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043f\u043e\u043b\u044f\u0440\u043d\u043e\u043c\u0443 \u0443\u0433\u043b\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u0447\u043a\u0430 Q \u0442\u043e\u0436\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yv\/qn\/lo\/yvqnlofz95cznygnn_kj_nxktde.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0431\u043e\u0440 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d. \u041c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443 R, \u0442\u0430\u043a\u0443\u044e \u0447\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u043a \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c\u043e\u0439 P, Q \u0438 R \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c (0, 0, 1) \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0433\u043e\u043b. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u0430\u044f \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 f \u2014 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 XY. \u041a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c \u0447\u0435\u0440\u0442\u0435\u0436\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0445\u0443\u0434\u0448\u0438\u0442\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u0431\u0435\u0437 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0430 \u043d\u0438\u0436\u043d\u044f\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0442\u043e\u0447\u043a\u0430 R \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0438 \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0437\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430\u0440\u0443\u0436\u0443 (\u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0440\u0430\u043d\u0438 \u043d\u0430\u0448 \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043a\u0443\u0434\u0430-\u0442\u043e \u0432\u043d\u0438\u0437).<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u043e\u0447\u0435\u043a \u043b\u0435\u0432\u0443\u044e \u0442\u0440\u043e\u0439\u043a\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0442\u043e\u0447\u043a\u0438 P, Q, R \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430-\u0434\u0430\u043c! \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0433\u0440\u0430\u043d\u0435\u0439.<\/p>\n<p>  <\/p>\n<p><strong>2. \u0418\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0440\u0435\u0431\u0435\u0440<\/strong><br \/>  \u041a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0432\u0442\u043e\u0440\u0430\u044f, \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f, \u0447\u0430\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u043e\u0449\u0435 \u043f\u0435\u0440\u0432\u043e\u0439. \u0422\u043e \u0435\u0441\u0442\u044c \u0435\u0441\u043b\u0438 \u0412\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0438\u0434\u0435\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0412\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0431\u0435\u0440.<\/p>\n<p>  <\/p>\n<p><em><u>\u0418\u0434\u0435\u044f:<\/u><\/em> \u041c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0440\u0435\u0431\u0440\u0430 \u0432 \u0441\u0442\u0435\u043a\u0435, \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0438\u0445 \u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c: \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e \u0432 \u043d\u0430\u0448\u0443 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443. \u0415\u0441\u043b\u0438 \u043d\u0430\u0434\u043e, \u0442\u043e \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u044c (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043b\u0435\u0433\u0430\u0435\u0442 \u043a \u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443), \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u0442\u0435\u043a \u0434\u0432\u0430 \u0440\u0435\u0431\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u043e\u044f\u0441\u044b\u0432\u0430\u044e\u0442 \u043d\u0430\u0448\u0443 \u0433\u0440\u0430\u043d\u044c. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043b\u0435\u0436\u0430\u0442 \u043b\u0438 \u043d\u0430\u0448\u0438 \u0440\u0435\u0431\u0440\u0430 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435, \u0438 \u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043c\u044b \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u0441\u0442\u0435\u043a.<\/p>\n<p>  <\/p>\n<p><em><u>\u0417\u0430\u043c1.<\/u><\/em> \u041a\u0430\u043a \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443? \u041c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 \u0441\u0442\u0435\u043a\u0430 \u0431\u044b\u043b\u043e \u0432\u0437\u044f\u0442\u043e \u0440\u0435\u0431\u0440\u043e E. \u041c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0447\u0435\u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043b\u0435\u0436\u0438\u0442 \u0440\u0435\u0431\u0440\u043e E \u2014 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0443 R. \u0418 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0443\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 \u043d\u043e\u0440\u043c\u0430\u043b\u044f\u043c\u0438 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0433\u0440\u0430\u043d\u0438 (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u0440\u0435\u0431\u0440\u043e E) \u0438 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0440\u0435\u0431\u0440\u043e\u043c E \u0438 \u0442\u043e\u0447\u043a\u043e\u0439 R. \u041c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0433\u0440\u0430\u043d\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u2014 \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0438 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435.<\/p>\n<p>  <\/p>\n<p><em><u>\u0417\u0430\u043c2.<\/u><\/em> \u041a\u0430\u043a \u043c\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u0438, &quot;\u0441\u043c\u043e\u0442\u0440\u044f\u0449\u0438\u0435 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443&quot;, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0431\u0440\u043e E \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0447\u043a\u0438 \u0432 \u0440\u0435\u0431\u0440\u0435 E \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435.<\/p>\n<p>  <\/p>\n<p><em><u>\u0417\u0430\u043c3.<\/u><\/em> \u041a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c \u0438\u0437 <u>\u0438\u0434\u0435\u0438<\/u>, \u041c\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0431\u0440\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0433\u0440\u0430\u043d\u044c, \u0430 \u0432\u043e\u0442 \u043e\u0434\u043d\u043e, \u0438\u043b\u0438 \u043e\u0431\u0430 \u0440\u0435\u0431\u0440\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043b\u0435\u0436\u0438\u0442 \u043b\u0438 \u043d\u0430\u0448\u0435 \u0440\u0435\u0431\u0440\u043e \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435, \u0438 \u0435\u0441\u043b\u0438 \u043b\u0435\u0436\u0438\u0442, \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><em><u>\u0417\u0430\u043c4.<\/u><\/em> \u0415\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0441\u0442\u0430\u043b\u0438 \u0440\u0435\u0431\u0440\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0443\u0436\u0435 \u043e\u0434\u043d\u0430 \u0433\u0440\u0430\u043d\u044c \u043f\u0440\u0438\u043b\u0435\u0436\u0438\u0442 \u043a \u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443. \u041d\u043e \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043b\u0435\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0440\u0435\u0431\u0440\u0430 \u0432 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0431\u0440\u0430, \u043c\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b &quot;\u0437\u0430\u043a\u0440\u044b\u0442\u044c&quot; \u0435\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043b\u044c\u0448\u0435 \u043a \u043d\u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0438 \u043e\u0434\u043d\u0443 \u0433\u0440\u0430\u043d\u044c.<\/p>\n<p>  <\/p>\n<p><em><u>\u0417\u0430\u043c5.<\/u><\/em> \u0415\u0441\u043b\u0438 \u0440\u0435\u0431\u0440\u043e \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043e, \u043a\u0430\u043a &quot;\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0435&quot; \u043c\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u0441 \u043d\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u043e\u0431\u043b\u044e\u043b\u0438 \u0432\u0441\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043f\u043e \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0441\u0442\u0435\u043a\u0430 (\u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0443\u0441\u0442), \u043c\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u044b\u043f\u0443\u043a\u043b\u0443\u044e 3D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443.<\/p>\n<p>  <\/p>\n<h2 id=\"asimptotika\">\u0410\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043d\u0430\u0434 \u0435\u0433\u043e \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u043e\u0439. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u0441\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 N, \u0430 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435 H \u0440\u0435\u0431\u0435\u0440, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 O(NH). \u0412 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 H \u0432\u044b\u0440\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 2N, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 O(N^2).<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u043d\u0435 \u043b\u0443\u0447\u0448\u0430\u044f \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0430, \u0432\u0435\u0434\u044c \u0435\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0427\u0430\u043d\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 O(NlogN), \u043d\u043e \u043b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u0430\u0440\u043a\u0430 \u043b\u0443\u0447\u0448\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438. \u0425\u043e\u0442\u044f \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 2D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0437\u0430 O(NlogN), \u043c\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u044c \u043c\u044b \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435, \u0438 \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u043f\u043e \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0435 \u043c\u044b \u0443\u0448\u043b\u0438 \u043d\u0435 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043c\u044b \u043f\u0440\u0438\u0448\u043b\u0438 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443: \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"realizaciya-algoritma\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043c\u0435\u043b\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0445\u043e\u0442\u044c \u0438 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u0441\u043f\u043b\u043e\u0448\u043d\u043e\u0439 \u043a\u043e\u0434. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043f\u043e\u043b\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 C++.<\/p>\n<p>  <\/p>\n<p><em><u><strong>\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a.<\/strong><\/u><\/em> \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. \u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0447\u0435\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0442\u044c \u0440\u0430\u0434\u0438\u0443\u0441-\u0432\u0435\u043a\u0442\u043e\u0440\u0430. \u041a\u0430\u043a \u0438 \u0443 \u0440\u0430\u0434\u0438\u0443\u0441-\u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0443 \u0442\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b. (\u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u043e\u043b\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u043f\u0443\u0441\u0442\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043d\u0435\u0446).<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Point {     coordinate x;     coordinate y;     coordinate z;     Point (coordinate x = 0, coordinate y = 0, coordinate z = 0) : x(x), y(y), z(z) {}     Point operator- (const Point&amp; other) const;     Point operator+ (const Point&amp; other) const;     bool operator!= (const Point&amp; other) const;     bool operator== (const Point&amp; other) const; };<\/code><\/pre>\n<p>  <\/p>\n<p><em><u><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430.<\/strong><\/u><\/em> \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446 2\u04452 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f (\u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439).<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">coordinate Det2x2(coordinate a11, coordinate a12, coordinate a21, coordinate a22) {     return a11 * a22 - a12 * a21; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0430\u043c\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u0433\u0434\u0435 \u0442\u043e\u0447\u043a\u0430 A \u2014 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u044f \u2014 \u0438\u043b\u0438 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0442\u043e\u0447\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0440\u0430\u0434\u0438\u0443\u0441-\u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 AB \u0438 AC):<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Point VectorProduct(const Point&amp; A, const Point&amp; B, const Point&amp; C) {     Point a = B - A;     Point b = C - A;     return Point (Det2x2(a.y, a.z, b.y, b.z),                   Det2x2(a.x, a.z, b.x, b.z),                   Det2x2(a.x, a.y, b.x, b.y)); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 (\u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u043e\u0432):<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">double GetLenghtVector(Point A, Point B = Point(0, 0, 0)) {     Point vec = B - A;     double lenght = std::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z);     return lenght; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0443\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">double GetAngle(const Point&amp; n1, const Point&amp; n2) {     double len_n1 = GetLenghtVector(n1);     double len_n2 = GetLenghtVector(n2);     double scalar_prod = n1.x * n2.x + n1.y * n2.y + n1.z * n2.z;     if (scalar_prod == 0)     {         return 0;     }     return std::acos((scalar_prod) \/ (len_n1 * len_n2)); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u0430\u043b\u043e\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f <strong>\u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438<\/strong>.<\/p>\n<p>  <\/p>\n<p><em><u><strong>\u0413\u0440\u0430\u043d\u0438 \u0438 \u0440\u0435\u0431\u0440\u0430.<\/strong><\/u><\/em> \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c <u>\u0432\u043d\u0443\u0442\u0440\u0438<\/u> \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0438 \u0433\u0440\u0430\u043d\u0438, \u0438 \u0440\u0435\u0431\u0440\u0430. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u0431\u0440\u0435 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u043e\u043c\u0435\u0440 \u043d\u0430\u0448\u0435\u0439 \u0433\u0440\u0430\u043d\u0438, \u0432\u0435\u0434\u044c \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0442\u043e\u0447\u043a\u0435 \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043b\u0435\u0436\u0438\u0442 \u0434\u0430\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430, \u0430 \u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u0435\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0433\u0440\u0430\u043d\u0438. \u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0448\u0438\u0445 \u0442\u043e\u0447\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Edge {     int first;     int second;     int flatness; \/\/\u043d\u043e\u043c\u0435\u0440 \u0433\u0440\u0430\u043d\u0438     bool is_close = false; \/\/ \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u043b\u0438 \u043d\u0430\u0448\u0435 \u0440\u0435\u0431\u0440\u043e, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0433\u0440\u0430\u043d\u044c?     Edge(int first, int second, int flatness = -1, Point normal = Point(0, 0 , 0)) :                     first(first), second(second), flatness(flatness) {} };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Flatness \u2014 \u0433\u0440\u0430\u043d\u0438 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438. \u0422\u0430\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f 3 \u0442\u043e\u0447\u043a\u0438, \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u043a \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432\u043e\u0432\u043d\u0435 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438). \u0410 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 Another, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0434\u0432\u0443\u043c \u0442\u043e\u0447\u043a\u0430\u043c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0440\u0435\u0442\u044c\u044e. (\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0440\u0438 if \u2014 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043a\u043e\u043d\u0446\u0435.)<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Flatness {     int first;     int second;     int third;     Point normal; \/\/ \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u043a \u0433\u0440\u0430\u043d\u0438, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e     Flatness(int first, int second, int third, Point normal) :         first(first), second(second), third(third), normal(normal) {}     int Another(int one, int two); };<\/code><\/pre>\n<p>  <\/p>\n<p><em><u><strong>Class \u0412\u044b\u043f\u0443\u043a\u043b\u0430\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430.<\/strong><\/u><\/em> <\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">class ConvexHull {     struct Flatness;     struct Edge;      std::vector&lt;Point&gt; points_; \/\/ \u0422\u043e\u0447\u043a\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430     std::vector&lt;Flatness&gt; verge_; \/\/ \u0413\u0440\u0430\u043d\u0438     std::vector&lt;Edge&gt; edges_; \/\/ \u0420\u0435\u0431\u0440\u0430      int count_; \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430      int findMinZ() const;     void findFirstFlatness();     int returnIsEdgeInHull(int a, int b) const;     void makeHull(); public:     ConvexHull(const std::vector&lt;Point&gt;&amp; points): points_(points), count_(points.size()) { makeHull(); } };<\/code><\/pre>\n<p>  <\/p>\n<p><em><u>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b<\/u><\/em><br \/>  \u041f\u043e\u0438\u0441\u043a \u043f\u0435\u0440\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u0438: \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e \u043e\u0441\u0438 Z (\u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043b\u0435\u043a\u0441\u0438\u043a\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435)<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int ConvexHull::findMinZ() const {     int min_id = 0;     for (int i = 1; i &lt; count_; ++i)     {         if (points_[i].z &lt; points_[min_id].z ||             (points_[i].z == points_[min_id].z &amp;&amp; points_[i].y &lt; points_[min_id].y) ||             (points_[i].z == points_[min_id].z &amp;&amp; points_[i].y == points_[min_id].y &amp;&amp;                 points_[i].x &lt; points_[min_id].x))         {             min_id = i;         }     }     return min_id; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043b\u0435\u0436\u0438\u0442 \u043b\u0438 \u0443\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0440\u0435\u0431\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int ConvexHull::returnIsEdgeInHull(int a, int b) const {     for (int i = 0; i &lt; edges_.size(); ++i)     {         if ((edges_[i].first == a &amp;&amp; edges_[i].second == b) ||             (edges_[i].first == b &amp;&amp; edges_[i].second == a))         {             return i;         }     }      return -1; }<\/code><\/pre>\n<p>  <\/p>\n<p><em><u><strong>\u0421\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<\/strong><\/u><\/em> <em>(\u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e)<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0438\u0445 \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445: \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u0435\u0449\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0432\u0435\u0434\u044c \u044f \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p><em><u>\u0428\u0430\u0433 \u043f\u0435\u0440\u0432\u044b\u0439:<\/u><\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void ConvexHull::findFirstFlatness() {     int first_point, second_point, third_point; \/\/ \u043d\u0430\u0448\u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0440\u0438 \u0442\u043e\u0447\u043a\u0438     first_point = findMinZ();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e \u043e\u0441\u0438 Z. \u0418\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u0442\u0443 \u0442\u043e\u0447\u043a\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u044c \u043d\u0430\u0448 &quot;\u043f\u043e\u0434\u0430\u0440\u043e\u043a&quot;.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">    double min_angle = 7; \/\/ \u0422\u0430\u043a \u043a\u0430\u043a \u0443\u0433\u043e\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e 2pi, \u043e\u043d \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 7     int min_id = -1;     for (int i = 0; i &lt; count_; ++i)     {         if (first_point == i) \/\/ \u043d\u0430\u0448\u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439         {             continue;         }         Point start = points_[first_point];         Point next = points_[i];         double angle = GetAngle(start - next, next - Point(next.x, next.y, start.z));         if (min_angle &gt; angle)         {             min_angle = angle;             min_id = i;         }     }     second_point = min_id;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0432\u0442\u043e\u0440\u0443\u044e \u0442\u043e\u0447\u043a\u0443, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">    min_angle = 7;     min_id = -1;     for (int i = 0; i &lt; count_; ++i)     {         if (first_point == i || second_point == i)         {             continue;         }         Point normal = VectorProduct(points_[first_point], points_[second_point], points_[i]);         double angle = GetAngle(Point(0, 0, 1), normal);         if (min_angle &gt; angle)         {             min_angle = angle;             min_id = i;         }     }     third_point = min_id;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u0442\u044c\u044e \u0442\u043e\u0447\u043a\u0443 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0442\u0430\u043a\u0443\u044e, \u0447\u0442\u043e\u0431\u044b \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u0438 \u0438\u0441\u043a\u043e\u043c\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0431\u044b\u043b\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0430 \u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 XY, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u043e\u0440\u043c\u0430\u043b\u044c (0, 0, 1). \u0427\u0442\u043e \u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u043e \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0443\u0433\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0442\u0440\u0438 \u0442\u043e\u0447\u043a\u0438 (\u043a\u0430\u043a \u043b\u0435\u0432\u0430\u044f \u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432), \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u044c \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0442\u0440\u0438 \u0440\u0435\u0431\u0440\u0430 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0440\u0435\u0431\u0435\u0440.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">    if (VectorProduct(points_[first_point], points_[second_point], points_[third_point]).z &gt; 0)     {         std::swap (second_point, third_point);     }     Point new_normal = VectorProduct(points_[first_point], points_[second_point], points_[third_point]);     verge_.push_back(Flatness(first_point, second_point, third_point, new_normal)); \/\/ \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u044c     edges_.push_back(Edge(first_point, second_point, 0));     edges_.push_back(Edge(second_point, third_point, 0));     edges_.push_back(Edge(third_point, first_point, 0)); }<\/code><\/pre>\n<p>  <\/p>\n<p><em><u>\u0428\u0430\u0433 \u0432\u0442\u043e\u0440\u043e\u0439:<\/u><\/em><br \/>  \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0441\u043e \u0441\u043a\u0443\u0447\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0440\u0435\u0431\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void ConvexHull::makeHull() {     findFirstFlatness();     std::stack&lt;int&gt; stack;     stack.push(0);     stack.push(1);     stack.push(2);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0435\u0440\u0434\u0446\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430: \u043d\u0430\u0448 \u0446\u0438\u043a\u043b, \u043f\u043e\u043a\u0430 \u0441\u0442\u0435\u043a \u043d\u0435 \u043f\u0443\u0441\u0442. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u044b\u0439 \u0431\u043b\u043e\u043a, \u044f \u0440\u0430\u0437\u043e\u0431\u044c\u044e \u043a\u043e\u0434 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438: \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0431\u0435\u0440 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">    while (!stack.empty())     {         Point new_normal;         Edge e = edges_[stack.top()]; \/\/ \u0431\u0435\u0440\u0435\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u0435 \u0440\u0435\u0431\u0440\u043e, \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e         stack.pop();         if (e.is_close) \/\/ \u0435\u0441\u043b\u0438 \u0432 \u0440\u0435\u0431\u0440\u043e \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0433\u0440\u0430\u043d\u0438, \u043c\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c         {             continue;         }         int min_id = -1;         double min_angle = 7;          for (int i = 0; i &lt; count_; ++i)         {             int another = verge_[e.flatness].Another(e.first, e.second);             if (i != another &amp;&amp; e.first != i &amp;&amp; e.second != i) \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e \u0442\u043e\u0447\u043a\u0430 \u043d\u0435 \u0438\u0437 \u0442\u043e\u0439 \u0436\u0435 \u0433\u0440\u0430\u043d\u0438             {                 \/\/ \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u0435\u0431\u0440\u043e\u043c \u0438 i-\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439                 Point current_normal = VectorProduct(points_[e.second], points_[e.first], points_[i]);                 double angle = GetAngle(current_normal, verge_[e.flatness].normal);                  if (min_angle &gt; angle)                 {                     min_angle = angle;                     min_id = i;                     new_normal = current_normal;                 }             }         }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443\u0436\u0435 \u0440\u0435\u0431\u0440\u0430, \u0432\u0435\u0434\u0443\u0449\u0438\u0435 \u0438\u0437 \u0440\u0435\u0431\u0440\u0430 e \u0432 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443, \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c. \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0431\u0440\u043e, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0431\u0440\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435, \u043c\u044b \u043a\u0440\u0430\u0441\u0438\u043c \u0435\u0433\u043e \u0432 is_closed = true, \u0432\u0435\u0434\u044c \u043c\u044b \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0433\u0440\u0430\u043d\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u044b\u043a\u0430\u0442\u044c \u0434\u0432\u0430 \u0440\u0435\u0431\u0440\u0430 \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u2014 \u043d\u0430\u0448\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0438 \u0442\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e \u0440\u0435\u0431\u0440\u043e \u0435 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">        if (min_id != -1) \/\/ \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0434\u0443\u0440\u0430\u043a\u0430 - \u0435\u0441\u043b\u0438 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 4\u0445 \u0432\u0435\u0440\u0448\u0438\u043d         {             e.is_close = true; \/\/ \u0440\u0430\u0437 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0442\u0440\u0435\u043b\u0438 \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0443\u0436\u0435 \u0432\u0442\u043e\u0440\u0443\u044e \u0433\u0440\u0430\u043d\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443             int count_flatness = verge_.size(); \/\/ \u043d\u043e\u043c\u0435\u0440 \u043d\u0430\u0448\u0435\u0439 \u0433\u0440\u0430\u043d\u0438             int first_edge_in_hull = returnIsEdgeInHull(e.first, min_id); \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 -1, \u0435\u0441\u043b\u0438 \u0440\u0435\u0431\u0440\u0430 \u0435\u0449\u0435 \u043d\u0435\u0442             int second_edge_in_hull = returnIsEdgeInHull(e.second, min_id);              if (first_edge_in_hull == -1)             {                 edges_.push_back(Edge(e.first, min_id, count_flatness));                 stack.push(edges_.size() - 1);             }             if (second_edge_in_hull == -1)             {                 edges_.push_back(Edge(min_id, e.second, count_flatness));                 stack.push(edges_.size() - 1);             }             if (first_edge_in_hull != -1)             {                 edges_[first_edge_in_hull].is_close = true;             }             if (second_edge_in_hull != -1)             {                 edges_[second_edge_in_hull].is_close = true;             }              verge_.push_back(Flatness(e.first, e.second, min_id, new_normal));         }      } \/\/ \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 while } \/\/ \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;cmath&gt; #include &lt;stack&gt; #include &lt;iomanip&gt;  using coordinate = int64_t;  struct Point; coordinate Det2x2(coordinate a11, coordinate a12, coordinate a21, coordinate a22); Point VectorProduct(const Point&amp; A, const Point&amp; B, const Point&amp; C); double GetLenghtVector(Point A, Point B); double GetAngle(const Point&amp; n1, const Point&amp; n2);  struct Point {     coordinate x;     coordinate y;     coordinate z;     Point(coordinate x = 0, coordinate y = 0, coordinate z = 0) : x(x), y(y), z(z) {}     Point operator-(const Point&amp; other) const     {         return Point(x - other.x, y - other.y, z - other.z);     }     Point operator+(const Point&amp; other) const     {         return Point(x + other.x, y + other.y, z + other.z);     }     bool operator!= (const Point&amp; other) const     {         return (x != other.x || y != other.y || z != other.z);     }     bool operator== (const Point&amp; other) const     {         return (x == other.x &amp;&amp; y == other.y &amp;&amp; z == other.z);     } };  coordinate Det2x2(coordinate a11, coordinate a12, coordinate a21, coordinate a22) {     return a11 * a22 - a12 * a21; }  \/\/[AB, AC] Point VectorProduct(const Point&amp; A, const Point&amp; B, const Point&amp; C) {     Point a = B - A;     Point b = C - A;     return Point (Det2x2(a.y, a.z, b.y, b.z),                   Det2x2(a.x, a.z, b.x, b.z),                   Det2x2(a.x, a.y, b.x, b.y)); }  \/\/vector AB double GetLenghtVector(Point A, Point B = Point(0, 0, 0)) {     Point vec = B - A;     double lenght = std::sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z);     return lenght; }  double GetAngle(const Point&amp; n1, const Point&amp; n2) {     double len_n1 = GetLenghtVector(n1);     double len_n2 = GetLenghtVector(n2);     double scalar_prod = n1.x * n2.x + n1.y * n2.y + n1.z * n2.z;     if (scalar_prod == 0)     {         return 0;     }     return std::acos((scalar_prod) \/ (len_n1 * len_n2)); }  class ConvexHull {     struct Flatness     {         int first;         int second;         int third;         Point normal; \/\/ \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u043a \u0433\u0440\u0430\u043d\u0438, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e         Flatness(int first, int second, int third, Point normal) :             first(first), second(second), third(third), normal(normal) {}         int Another(int one, int two)         {             if ((one == first &amp;&amp; two == second) || (one == second &amp;&amp; two == first))             {                 return third;             }             if ((one == first &amp;&amp; two == third) || (one == third &amp;&amp; two == first))             {                 return second;             }             if ((one == third &amp;&amp; two == second) || (one == second &amp;&amp; two == third))             {                 return first;             }             return -1; \/\/ error         }     };      struct Edge     {         int first;         int second;         int flatness; \/\/\u043d\u043e\u043c\u0435\u0440 \u0433\u0440\u0430\u043d\u0438         bool is_close = false;         Edge(int first, int second, int flatness = -1, Point normal = Point(0, 0 , 0)):                     first(first), second(second), flatness(flatness) {}     };      std::vector&lt;Point&gt; points_;     std::vector&lt;Flatness&gt; verge_;     std::vector&lt;Edge&gt; edges_;      int count_; \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0447\u0435\u043a \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430      int findMinZ() const;     void findFirstFlatness();     int returnIsEdgeInHull(int a, int b) const;     void makeHull(); public:     ConvexHull(const std::vector&lt;Point&gt;&amp; points): points_(points), count_(points.size()) { makeHull();} };  void ConvexHull::makeHull() {     findFirstFlatness();     std::stack&lt;int&gt; stack;     stack.push(0);     stack.push(1);     stack.push(2);      while (!stack.empty())     {         Point new_normal;         Edge e = edges_[stack.top()]; \/\/ \u0431\u0435\u0440\u0435\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u0435 \u0440\u0435\u0431\u0440\u043e, \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e         stack.pop();         if (e.is_close) \/\/ \u0435\u0441\u043b\u0438 \u0432 \u0440\u0435\u0431\u0440\u043e \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0433\u0440\u0430\u043d\u0438, \u043c\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c         {             continue;         }         int min_id = -1;         double min_angle = 7;          for (int i = 0; i &lt; count_; ++i)         {             int another = verge_[e.flatness].Another(e.first, e.second);             if (i != another &amp;&amp; e.first != i &amp;&amp; e.second != i) \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e \u0442\u043e\u0447\u043a\u0430 \u043d\u0435 \u0438\u0437 \u0442\u043e\u0439 \u0436\u0435 \u0433\u0440\u0430\u043d\u0438             {                 \/\/ \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u0435\u0431\u0440\u043e\u043c \u0438 i-\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439                 Point current_normal = VectorProduct(points_[e.second], points_[e.first], points_[i]);                 double angle = GetAngle(current_normal, verge_[e.flatness].normal);                  if (min_angle &gt; angle)                 {                     min_angle = angle;                     min_id = i;                     new_normal = current_normal;                 }             }         }          if (min_id != -1) \/\/ \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0434\u0443\u0440\u0430\u043a\u0430 - \u0435\u0441\u043b\u0438 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 4\u0445 \u0432\u0435\u0440\u0448\u0438\u043d         {             e.is_close = true; \/\/ \u0440\u0430\u0437 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0442\u0440\u0435\u043b\u0438 \u044d\u0442\u043e \u0440\u0435\u0431\u0440\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0443\u0436\u0435 \u0432\u0442\u043e\u0440\u0443\u044e \u0433\u0440\u0430\u043d\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443             int count_flatness = verge_.size(); \/\/ \u043d\u043e\u043c\u0435\u0440 \u043d\u0430\u0448\u0435\u0439 \u0433\u0440\u0430\u043d\u0438             int first_edge_in_hull = returnIsEdgeInHull(e.first, min_id);             int second_edge_in_hull = returnIsEdgeInHull(e.second, min_id);              if (first_edge_in_hull == -1)             {                 edges_.push_back(Edge(e.first, min_id, count_flatness));                 stack.push(edges_.size() - 1);             }             if (second_edge_in_hull == -1)             {                 edges_.push_back(Edge(min_id, e.second, count_flatness));                 stack.push(edges_.size() - 1);             }             if (first_edge_in_hull != -1)             {                 edges_[first_edge_in_hull].is_close = true;             }             if (second_edge_in_hull != -1)             {                 edges_[second_edge_in_hull].is_close = true;             }              verge_.push_back(Flatness(e.first, e.second, min_id, new_normal));         }      } \/\/ \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 while } \/\/ \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430  int ConvexHull::findMinZ() const {     int min_id = 0;     for (int i = 1; i &lt; count_; ++i)     {         if (points_[i].z &lt; points_[min_id].z ||             (points_[i].z == points_[min_id].z &amp;&amp; points_[i].y &lt; points_[min_id].y) ||             (points_[i].z == points_[min_id].z &amp;&amp; points_[i].y == points_[min_id].y &amp;&amp;                 points_[i].x &lt; points_[min_id].x))         {             min_id = i;         }     }     return min_id; }  void ConvexHull::findFirstFlatness() {     int first_point, second_point, third_point;     first_point = findMinZ();     double min_angle = 7;     int min_id = -1;     for (int i = 0; i &lt; count_; ++i)     {         if (first_point == i)         {             continue;         }         Point start = points_[first_point];         Point next = points_[i];         double angle = GetAngle(start - next, next - Point(next.x, next.y, start.z));         if (min_angle &gt; angle)         {             min_angle = angle;             min_id = i;         }     }     second_point = min_id;      min_angle = 7;     min_id = -1;     for (int i = 0; i &lt; count_; ++i)     {         if (first_point == i || second_point == i)         {             continue;         }         Point normal = VectorProduct(points_[first_point], points_[second_point], points_[i]);         double angle = GetAngle(Point(0, 0, 1), normal);         if (min_angle &gt; angle)         {             min_angle = angle;             min_id = i;         }     }     third_point = min_id;      \/\/ \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435     if (VectorProduct(points_[first_point], points_[second_point], points_[third_point]).z &gt; 0)     {         std::swap (second_point, third_point);     }     Point new_normal = VectorProduct(points_[first_point], points_[second_point], points_[third_point]);     verge_.push_back(Flatness(first_point, second_point, third_point, new_normal)); \/\/ \u043f\u0435\u0440\u0430\u044f \u0433\u0440\u0430\u043d\u044c     edges_.push_back(Edge(first_point, second_point, 0));     edges_.push_back(Edge(second_point, third_point, 0));     edges_.push_back(Edge(third_point, first_point, 0)); }  int ConvexHull::returnIsEdgeInHull(int a, int b) const {     for (int i = 0; i &lt; edges_.size(); ++i)     {         if ((edges_[i].first == a &amp;&amp; edges_[i].second == b) ||             (edges_[i].first == b &amp;&amp; edges_[i].second == a))         {             return i;         }     }      return -1; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438 \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445.<\/p>\n<\/div>\n<p> \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\/529352\/\"> https:\/\/habr.com\/ru\/post\/529352\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<h1 id=\"chto-zachem\">\u0427\u0442\u043e? \u0417\u0430\u0447\u0435\u043c?<\/h1>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e <strong>\u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u0439 3D \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438<\/strong>. \u041a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u0438 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u0438 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0434\u0443\u043c\u0430\u044e, \u0412\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0435\u0439, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0412\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e-\u0442\u043e \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430\u0445, \u0412\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0437\u0443\u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0438\u0445.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0412\u044b \u0433\u0443\u0440\u0443 \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0412\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nf\/pc\/1h\/nfpc1hgwl6bsmcp7m3moqcaj6mq.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-313642","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313642","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=313642"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313642\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}