{"id":306432,"date":"2020-07-04T21:00:39","date_gmt":"2020-07-04T21:00:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306432"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306432","title":{"rendered":"\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0439 \u0438 \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u043e\u0441\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/509568\/\">\u0412 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u043e\u0449\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0448\u0438\u043d\u044b,<br \/>  \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0418 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043c\u0438\u0440\u0430. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u043e\u0441\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kr\/nz\/cm\/krnzcmfdifg3rjsy-ess2yqnrtw.jpeg\"><br \/>  <a name=\"habracut\"><\/a><br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. <\/b>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 2 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043f\u0438\u043f\u0435\u0434\u0430\u043c\u0438(\u0434\u0430\u043b\u0435\u0435 \u2014 \u043a\u0443\u0431\u044b), \u043d\u043e \u0438\u0434\u0435\u044f \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430.<br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. <\/b>\u0412\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 Unity.<\/p>\n<h2>\u0410\u043a\u0442 0. \u041e\u0431\u0449\u0430\u044f \u0442\u0435\u043e\u0440\u0438\u044f<\/h2>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 &quot;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Hyperplane_separation_theorem\" rel=\"nofollow\">\u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u0433\u0438\u043f\u0435\u0440\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438<\/a>&quot;.\u0418\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  <b>\u0422\u0435\u043e\u0440\u0435\u043c\u0430.<\/b> \u0414\u0432\u0435 \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0435 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u0442\u043e\u0433\u0434\u0430 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u0438\u043f\u0435\u0440\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442. \u041e\u0441\u044c \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439<br \/>  \u0433\u0438\u043f\u0435\u0440\u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u043e\u0441\u044c\u044e, \u0430 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0444\u0438\u0433\u0443\u0440 \u043d\u0430 \u043d\u0435\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yz\/hw\/x5\/yzhwx5bdreqmndz_lln5qelnmx0.png\"><br \/>  <i>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0441\u044c (\u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439)<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i7\/9d\/nn\/i79dnnhsjdbjbrdmu_6de37dpny.png\"><br \/>  <i>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0441\u044c (\u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439)<\/i><br \/>  <i>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e \u043e\u0441\u044c \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f.<\/i><\/p>\n<p>  <b>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e.<\/b> \u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u0445:  <\/p>\n<ul>\n<li>\u041d\u043e\u0440\u043c\u044b \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0431\u0430(\u043a\u0440\u0430\u0441\u043d\u044b\u0435)<\/li>\n<li>\u0412\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0431\u0435\u0440 \u043a\u0443\u0431\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ff3\/b0d\/482\/ff3b0d4821edbc1246f2a6839499755a.svg\" alt=\"$\\{[\\vec{x},\\vec{y}] : x\u2208X, y\u2208Y\\}$\" data-tex=\"inline\"><\/math>,<\/li>\n<\/ul>\n<p>  &nbsp;&nbsp;&nbsp;\u0433\u0434\u0435 X \u2014 \u0440\u0435\u0431\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0443\u0431\u0430 (\u0437\u0435\u043b\u0435\u043d\u044b\u0435), \u0430 Y \u2014 \u0432\u0442\u043e\u0440\u043e\u0433\u043e (\u0441\u0438\u043d\u0438\u0435).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fg\/qp\/zo\/fgqpzo0hqbi_9s0fntio17pwrj0.png\"><\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0443\u0431 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:  <\/p>\n<ul>\n<li>\u041a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0443\u0431\u0430<\/li>\n<li>\u0420\u0430\u0437\u043c\u0435\u0440\u044b \u043a\u0443\u0431\u0430 (\u0432\u044b\u0441\u043e\u0442\u0430, \u0448\u0438\u0440\u0438\u043d\u0430, \u0433\u043b\u0443\u0431\u0438\u043d\u0430)<\/li>\n<li>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d \u043a\u0443\u0431\u0430<\/li>\n<\/ul>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u0443\u0431\u0435.  <\/p>\n<pre><code class=\"cs\">public class Box {     public Vector3 Center;     public Vector3 Size;     public Quaternion Quaternion;      public Box(Vector3 center, Vector3 size, Quaternion quaternion)     {        this.Center = center;        this.Size = size;        this.Quaternion = quaternion;     }     \/\/ \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439     \/\/ \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 GameObject     public Box(GameObject obj)     {         Center = obj.transform.position;         Size = obj.transform.lossyScale;         Quaternion = obj.transform.rotation;     }  } <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0410\u043a\u0442 1. \u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u044b<\/h2>\n<p>  \u041a\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u043e\u0431\u044a\u0435\u043a\u0442 \u043c\u043e\u0436\u0435\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0435\u0440\u0448\u0438\u043d, \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a\u0443\u0431\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d.<\/p>\n<p>  <b>\u041a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d<\/b> \u2014 \u044d\u0442\u043e \u0433\u0438\u043f\u0435\u0440\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435.<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/18a\/749\/f7b\/18a749f7be02e90bcd906f0d3d940cee.svg\" alt=\"$w+xi+yj+zk$\" data-tex=\"display\"><\/math><\/p>\n<p>  <i>\u041c\u043d\u0438\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c(x,y,z)<\/i> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f<br \/>  <i>\u0412\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c(w)<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0443\u0433\u043e\u043b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0415\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A3%D0%B3%D0%BB%D1%8B_%D0%AD%D0%B9%D0%BB%D0%B5%D1%80%D0%B0\" rel=\"nofollow\">\u0443\u0433\u043b\u043e\u0432 \u042d\u0439\u043b\u0435\u0440\u0430<\/a> \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043c\u0435\u0442\u044c <b>\u043e\u0434\u0438\u043d<\/b> \u0432\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u0447\u0435\u043c <b>\u0442\u0440\u0438<\/b> \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 3 \u043f\u043e\u0434\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430\u0445.<\/p>\n<p>  \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u0432\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430\u0445:<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/post\/426863\/\">\u0420\u0430\u0437<\/a><br \/>  <a href=\"https:\/\/nabbla1.livejournal.com\/172771.html\" rel=\"nofollow\">\u0414\u0432\u0430<\/a><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430\u0445, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0439\u043c\u0435\u043c, \u043a\u0430\u043a \u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440, \u0438 \u043e\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u043c.<\/p>\n<p>  \u0424\u043e\u0440\u043c\u0443\u043b\u0430 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ee7\/de0\/96d\/ee7de096d98ee13bd82f6bd6f496b829.svg\" alt=\"$\\vec{v}' = q * \\vec{v} * \\overline{q}$\" data-tex=\"display\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cee\/f7e\/bf0\/ceef7ebf0d1d96599a6ea898e765f416.svg\" alt=\"$\\vec{v}'$\" data-tex=\"inline\"><\/math> \u2014 \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ff5\/059\/671\/ff5059671e83505859d66f0b992edb1d.svg\" alt=\"$\\vec{v}$\" data-tex=\"inline\"><\/math> \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d68\/cc4\/926\/d68cc4926bf74bae8fa3b51ca4a09ec8.svg\" alt=\"$q$\" data-tex=\"inline\"><\/math> \u2014 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/326\/6cc\/50f\/3266cc50fd6907c0d53f1ab041358d7c.svg\" alt=\"$\\overline{q}$\" data-tex=\"inline\"><\/math> \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u0430 \u0432 \u043e\u0440\u0442\u043e\u043d\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0431\u0430\u0437\u0438\u0441\u0435 \u2014 \u044d\u0442\u043e \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0439 \u043f\u043e \u0437\u043d\u0430\u043a\u0443 \u043c\u043d\u0438\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e.<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2ab\/8e7\/5cd\/2ab8e75cd4b5cae23cdb6feedb4f8db8.svg\" alt=\"$q = w+xi+yj+zk$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e0d\/808\/12d\/e0d80812dfea60be0834f5050ca03623.svg\" alt=\"$\\overline{q} = w-xi-yj-zk$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/269\/760\/ce9\/269760ce95a537b88d1b26a6a525aa2e.svg\" alt=\"$\\vec{v} * \\overline{q}$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f29\/fbb\/e49\/f29fbbe49a0c93e1c2533b2d3a2bc307.svg\" alt=\"$ M = \\vec{v}*\\overline{q} = (0 + v_xi + v_yj + v_zk)(q_w - q_xi - q_yj - q_zk) = $\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a36\/a88\/11a\/a36a8811a5c6f4eafd834f4608922b01.svg\" alt=\"$=\\color{red}{v_xq_wi} + \\color{purple}{v_xq_x} - \\color{blue}{v_xq_yk} + \\color{green}{v_xq_zj} +$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4d9\/ca2\/f8e\/4d9ca2f8ebea0150fa14a5e004140d6e.svg\" alt=\"$+\\color{green}{v_yq_wj} + \\color{blue}{v_yq_xk} + \\color{purple}{v_yq_y} - \\color{red}{v_yq_zi} +$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/13a\/3d4\/4a6\/13a3d44a69e55645956219b2b9c444e0.svg\" alt=\"$+\\color{blue}{v_zq_wk} - \\color{green}{v_zq_xj} + \\color{red}{v_zq_yi} + \\color{purple}{v_zq_z}$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u0438\u0448\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d<br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/de8\/9c7\/cbf\/de89c7cbfd64a9fd15eee1412ed782fa.svg\" alt=\"$M = u_w+u_xi+u_yj+u_zk$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9c5\/184\/6e7\/9c51846e76302aaac7ef016236ba945f.svg\" alt=\"$u_w = \\color{purple}{v_xq_x + v_yq_y + v_zq_z}$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cc0\/f74\/dcf\/cc0f74dcfbe9d8fd340e8d4088a45dd9.svg\" alt=\"$u_xi = \\color{red}{(v_xq_w - v_yq_z + v_zq_y)i}$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/df3\/b71\/b7b\/df3b71b7b2cfb0ea5552970fee29e853.svg\" alt=\"$u_yj = \\color{green}{(v_xq_z + v_yq_w - v_zq_x)j}$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/266\/128\/877\/266128877409bb0d10841e5f0b066cf4.svg\" alt=\"$u_zk = \\color{blue}{(-v_xq_y + v_yq_x + v_zq_w)k}$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0443\u044e\u0441\u044f \u0447\u0430\u0441\u0442\u044c, \u0442.\u0435. <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ca\/7cb\/1a1\/6ca7cb1a1748eee46ce5da5f3bf5894c.svg\" alt=\"$ q*M $\" data-tex=\"inline\"><\/math> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440.<\/p>\n<p>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. <\/b>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0438\u043c\u0443\u044e(\u0432\u0435\u043a\u0442\u043e\u0440\u043d\u0443\u044e) \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f. \u0412\u0435\u0434\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442 \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440.<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ebc\/eb4\/799\/ebceb479989f4ffd1ff4ec806d4d7840.svg\" alt=\"$\\vec{v}' = q*M = (q_w + q_xi + q_yj + q_zk)(u_w + u_xi + u_yj + u_zk) =$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f8c\/b6e\/26c\/f8cb6e26c50a2c6eeb49fefe4294e0d8.svg\" alt=\"$= \\color{red}{q_wu_xi} + \\color{green}{q_wu_yj} + \\color{blue}{q_wu_zk} + $\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7d1\/b2a\/8ae\/7d1b2a8aeb680e82fbe1e0d8bbf4fae6.svg\" alt=\"$ +\\color{red}{q_xu_wi} + \\color{blue}{q_xu_yk} - \\color{green}{q_xu_zj} +$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/52c\/f31\/770\/52cf31770262a78f1d7a324e7c11a72d.svg\" alt=\"$+\\color{green}{q_yu_wj} - \\color{blue}{q_yu_xk} + \\color{red}{q_yu_zi} +$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ab3\/6a1\/373\/ab36a1373d54b05f1dfba894363412b3.svg\" alt=\"$+\\color{blue}{q_zu_wk} +\\color{green}{q_zu_xj} -\\color{red}{q_zu_yi}$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0421\u043e\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u0430<\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/48a\/e1d\/183\/48ae1d183d5753ebc98ed20f619a1120.svg\" alt=\"$v_x' = \\color{red}{q_wu_x + q_xu_w + q_yu_z - q_zu_y}$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/433\/a49\/688\/433a4968805bc1d588a0d72dc5ec736e.svg\" alt=\"$v_y' = \\color{green}{q_wu_y - q_xu_z + q_yu_w + q_zu_x}$\" data-tex=\"inline\"><\/math><br \/>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d38\/e2a\/b3f\/d38e2ab3fd47032e342e4bc6c34a495e.svg\" alt=\"$v_z' = \\color{blue}{q_wu_z + q_xu_y - q_yu_x + q_zu_w}$\" data-tex=\"inline\"><\/math><\/p>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ac2\/a81\/d0e\/ac2a81d0efad7ebdc8144d6500c2b8d0.svg\" alt=\"$v' = (v_x', v_y', v_z')$\" data-tex=\"inline\"><\/math><br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">private static Vector3 QuanRotation(Vector3 v,Quaternion q) {         float u0 = v.x * q.x + v.y * q.y + v.z * q.z;         float u1 = v.x * q.w - v.y * q.z + v.z * q.y;         float u2 = v.x * q.z + v.y * q.w - v.z * q.x;         float u3 = -v.x * q.y + v.y * q.x + v.z * q.w;         Quaternion M = new Quaternion(u1,u2,u3,u0);                  Vector3 resultVector;         resultVector.x = q.w * M.x + q.x * M.w + q.y * M.z - q.z * M.y;           resultVector.y = q.w * M.y - q.x * M.z + q.y * M.w + q.z * M.x;         resultVector.z = q.w * M.z + q.x * M.y - q.y * M.x + q.z * M.w;                  return resultVector; } <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0410\u043a\u0442 2. \u041d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d \u043a\u0443\u0431\u0430<\/h2>\n<p>  \u0417\u043d\u0430\u044f \u043a\u0430\u043a \u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u043c, \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0442\u0440\u0443\u0434\u0430 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0443\u0431\u0430.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0432\u0435\u0440\u0448\u0438\u043d \u043a\u0443\u0431\u0430. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<pre><code class=\"cs\">private static Vector3[] GetPoint(Box box) {         \/\/\u0422\u0443\u0442 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0435\u0440\u0448\u0438\u043d         Vector3[] point = new Vector3[8];          \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b         \/\/....          return point; } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0443\u044e \u0442\u043e\u0447\u043a\u0443(\u043e\u043f\u043e\u0440\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443), \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b.<\/p>\n<p>  \u0418\u0437 \u0446\u0435\u043d\u0442\u0440\u0430 \u043f\u043e\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043a\u0443\u0431\u0430.\u041f\u043e\u0442\u043e\u043c \u043a \u043e\u043f\u043e\u0440\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043a\u0443\u0431\u0430.<\/p>\n<pre><code class=\"cs\">\/\/...         \/\/\u043f\u0435\u0440\u0432\u044b\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b         point[0] = box.Center - box.Size\/2;         point[1] = point[0] + new Vector3(box.Size.x , 0, 0);         point[2] = point[0] + new Vector3(0, box.Size.y, 0);         point[3] = point[0] + new Vector3(0, 0, box.Size.z); \t\t \t\/\/\u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u0442\u043e\u0447\u043a\u0438         point[4] = box.Center + box.Size \/ 2;         point[5] = point[4] - new Vector3(box.Size.x, 0, 0);         point[6] = point[4] - new Vector3(0, box.Size.y, 0);         point[7] = point[4] - new Vector3(0, 0, box.Size.z); \/\/... <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/un\/fm\/fk\/unfmfkxos3_df7226wultv5dabk.png\"><br \/>  <i>\u041c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0442\u043e\u0447\u043a\u0438<\/i><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0432\u0435\u0440\u0448\u0438\u043d, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d.<\/p>\n<pre><code class=\"cs\">\/\/...          for (int i = 0; i &lt; 8; i++)         {             point[i] -= box.Center;\/\/\u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0446\u0435\u043d\u0442\u0440\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442              point[i] = QuanRotation(point[i], box.Quaternion);\/\/\u043f\u043e\u0432\u043e\u0440\u043e\u0442              point[i] += box.Center;\/\/\u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441         }  \/\/... <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0448\u0438\u043d<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">private static Vector3[] GetPoint(Box box) {         Vector3[] point = new Vector3[8];                  \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0435\u0440\u0448\u0438\u043d         point[0] = box.Center - box.Size\/2;         point[1] = point[0] + new Vector3(box.Size.x , 0, 0);         point[2] = point[0] + new Vector3(0, box.Size.y, 0);         point[3] = point[0] + new Vector3(0, 0, box.Size.z); \t\t \t\/\/\u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u0442\u043e\u0447\u043a\u0438         point[4] = box.Center + box.Size \/ 2;         point[5] = point[4] - new Vector3(box.Size.x, 0, 0);         point[6] = point[4] - new Vector3(0, box.Size.y, 0);         point[7] = point[4] - new Vector3(0, 0, box.Size.z);          \/\/\u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0432\u0430\u0442\u0435\u0440\u043d\u0438\u043e\u043d\u043e\u043c         for (int i = 0; i &lt; 8; i++)         {             point[i] -= box.Center;\/\/\u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0446\u0435\u043d\u0442\u0440\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442              point[i] = QuanRotation(point[i], box.Quaternion);\/\/\u043f\u043e\u0432\u043e\u0440\u043e\u0442              point[i] += box.Center;\/\/\u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441         }                  return point; } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f\u043c.<\/p>\n<h2>\u0410\u043a\u0442 3. \u041f\u043e\u0438\u0441\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u043e\u0441\u0435\u0439<\/h2>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0441\u0435\u0439, \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e.<br \/>  \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u0445:<\/p>\n<ul>\n<li>\u041d\u043e\u0440\u043c\u0430\u043b\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0431\u0430(\u043a\u0440\u0430\u0441\u043d\u044b\u0435)<\/li>\n<li>\u0412\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0431\u0435\u0440 \u043a\u0443\u0431\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a83\/c25\/173\/a83c2517373b11e00bff13fa9ccde4c8.svg\" alt=\"$\\{[\\vec{x},\\vec{y}[ : x\u2208X, y\u2208Y\\}$\" data-tex=\"inline\"><\/math>, \u0433\u0434\u0435 X \u2014 \u0440\u0435\u0431\u0440\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0443\u0431\u0430 (\u0437\u0435\u043b\u0435\u043d\u044b\u0435), \u0430 Y \u2014 \u0432\u0442\u043e\u0440\u043e\u0433\u043e (\u0441\u0438\u043d\u0438\u0435).<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fg\/qp\/zo\/fgqpzo0hqbi_9s0fntio17pwrj0.png\"><\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043e\u0441\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043a\u0443\u0431\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u042d\u0442\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0442\u043e\u0447\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0430\u043a\u0442\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/76\/ul\/ua\/76uluamafmv_aomhdxjh4hfup4k.png\"><\/p>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<ul>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9ee\/51f\/4eb\/9ee51f4ebb9c3c246096e08d630ed7c2.svg\" alt=\"$\\vec{a}$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/564\/9f9\/cb8\/5649f9cb8861267b6a0331555574c5b2.svg\" alt=\"$\\vec{b}$\" data-tex=\"inline\"><\/math><\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/564\/9f9\/cb8\/5649f9cb8861267b6a0331555574c5b2.svg\" alt=\"$\\vec{b}$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6bd\/bf2\/1e1\/6bdbf21e12680f677992e06462f5f7e7.svg\" alt=\"$\\vec{c}$\" data-tex=\"inline\"><\/math><\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9ee\/51f\/4eb\/9ee51f4ebb9c3c246096e08d630ed7c2.svg\" alt=\"$\\vec{a}$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6bd\/bf2\/1e1\/6bdbf21e12680f677992e06462f5f7e7.svg\" alt=\"$\\vec{c}$\" data-tex=\"inline\"><\/math><\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u044b \u0440\u0435\u0431\u0435\u0440 \u043a\u0443\u0431\u0430 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u0430\u044f \u043d\u043e\u0432\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u043b\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0441\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044f\u043c. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0442\u044f\u0436\u0435\u043b\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043d\u044f\u0442\u044c.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438 \u043d\u0430\u0439\u0442\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044f\u043c \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043a\u0443\u0431\u043e\u0432(\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442)<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">private static List&lt;Vector3&gt; GetAxis(Vector3[] a, Vector3[] b) {         \/\/\u0440\u0435\u0431\u0440\u0430         Vector3 A;         Vector3 B;          \/\/\u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0438         List&lt;Vector3&gt; Axis = new List&lt;Vector3&gt;();          \/\/\u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0443\u0431\u0430         A = a[1] - a[0];         B = a[2] - a[0];         Axis.Add(Vector3.Cross(A,B).normalized);                  A = a[2] - a[0];         B = a[3] - a[0];         Axis.Add(Vector3.Cross(A,B).normalized);                  A = a[1] - a[0];         B = a[3] - a[0];         Axis.Add(Vector3.Cross(A,B).normalized);                   \/\/\u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0443\u0431\u0430         A = b[1] - b[0];         B = b[2] - b[0];         Axis.Add(Vector3.Cross(A,B).normalized);                  A = b[1] - b[0];         B = b[3] - b[0];         Axis.Add(Vector3.Cross(A,B).normalized);                  A = b[2] - b[0];         B = b[3] - b[0];         Axis.Add(Vector3.Cross(A,B).normalized);          \/\/... } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435:  <\/p>\n<pre><code class=\"cs\">private static List&lt;Vector3&gt; GetAxis(Vector3[] a, Vector3[] b) {         \/\/\u0440\u0435\u0431\u0440\u0430         Vector3 A;         Vector3 B;  \t\/\/\u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0438         List&lt;Vector3&gt; Axis = new List&lt;Vector3&gt;();  \t\/\/\u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0443\u0431\u0430         for (int i = 1; i &lt; 4; i++)         {             A = a[i] - a[0];             B = a[(i+1)%3+1] - a[0];             Axis.Add(Vector3.Cross(A,B).normalized);         } \t\/\/\u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0443\u0431\u0430         for (int i = 1; i &lt; 4; i++)         {             A = b[i] - b[0];             B = b[(i+1)%3+1] - b[0];             Axis.Add(Vector3.Cross(A,B).normalized);         }          \/\/... } <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0431\u0435\u0440 \u043a\u0443\u0431\u043e\u0432. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c: <\/p>\n<pre><code class=\"cs\">private static List&lt;Vector3&gt; GetAxis(Vector3[] a, Vector3[] b) {         \/\/...         \/\/\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439         \/\/...          \/\/\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f         for (int i = 1; i &lt; 4; i++)         {             A = a[i] - a[0];             for (int j = 1; j &lt; 4; j++)             {                 B = b[j] - b[0];                 if (Vector3.Cross(A,B).magnitude != 0)                 {                     Axis.Add(Vector3.Cross(A,B).normalized);                 }             }         }         return Axis; } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">private static List&lt;Vector3&gt; GetAxis(Vector3[] a, Vector3[] b) { \t\/\/\u0440\u0435\u0431\u0440\u0430         Vector3 A;         Vector3 B;  \t\/\/\u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0438         List&lt;Vector3&gt; Axis = new List&lt;Vector3&gt;();  \t\/\/\u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0443\u0431\u0430         for (int i = 1; i &lt; 4; i++)         {             A = a[i] - a[0];             B = a[(i+1)%3+1] - a[0];             Axis.Add(Vector3.Cross(A,B).normalized);         } \t\/\/\u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043a\u0443\u0431\u0430         for (int i = 1; i &lt; 4; i++)         {             A = b[i] - b[0];             B = b[(i+1)%3+1] - b[0];             Axis.Add(Vector3.Cross(A,B).normalized);         }          \/\/\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f         for (int i = 1; i &lt; 4; i++)         {             A = a[i] - a[0];             for (int j = 1; j &lt; 4; j++)             {                 B = b[j] - b[0];                 if (Vector3.Cross(A,B).magnitude != 0)                 {                     Axis.Add(Vector3.Cross(A,B).normalized);                 }             }         }         return Axis; } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0410\u043a\u0442 4. \u041f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u0438<\/h2>\n<p>  \u041c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u043e\u0432 \u043d\u0430 \u0432\u0441\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0438. \u0423 \u0442\u0435\u043e\u0440\u0435\u043c\u044b \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0435 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435: \u0435\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u0442\u043e \u043e\u0441\u044c \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u043e\u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430 \u2014 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c(\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u044e) \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438, \u0430 \u0434\u043b\u0438\u043d\u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u2014 \u0433\u043b\u0443\u0431\u0438\u043d\u043e\u0439 \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 <i><b>v<\/b><\/i> \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 <i><b>a<\/b><\/i>:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/62d\/651\/e55\/62d651e55f6c52dee6dc73db5fd7de3f.svg\" alt=\"$proj_\\left\\langle \\vec{a} \\right\\rangle \\vec{v} = \\frac{(\\vec{v},\\vec{a})}{| \\vec{a} |}$\" data-tex=\"display\"><\/math><\/p>\n<pre><code class=\"cs\">private static float ProjVector3(Vector3 v, Vector3 a) {         a = a.normalized;         return Vector3.Dot(v, a) \/ a.magnitude;          } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439 \u043d\u0430 \u043e\u0441\u0438-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b.<\/p>\n<p>  \u041d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u043c \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0434\u0432\u0443\u0445 \u043a\u0443\u0431\u043e\u0432, \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0445 \u043e\u0441\u0435\u0439:<\/p>\n<pre><code class=\"cs\">private static Vector3 IntersectionOfProj(Vector3[] a, Vector3[] b, List&lt;Vector3&gt; Axis) {         for (int j = 0; j &lt; Axis.Count; j++)         {            \/\/\u0432 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u043e\u0441\u044c            \/\/\u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439 \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0438 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432         }         \/\/\u0415\u0441\u043b\u0438 \u043c\u044b \u0432 \u0446\u0438\u043a\u043b\u0435 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0438, \u0442\u043e \u043a\u0443\u0431\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e          \/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f. } <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u044c \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u0442\u043e\u0447\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u0439 \u043e\u0441\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/62\/go\/zr\/62gozr8cioxhnpo19t38zy7f1my.png\"><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0431\u0430. \u041e\u043d\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e \u043e\u0441\u044c.<\/p>\n<pre><code class=\"cs\">private static void ProjAxis(out float min, out float max, Vector3[] points, Vector3 Axis) {         max = ProjVector3(points[0], Axis);         min = ProjVector3(points[0], Axis);         for (int i = 1; i &lt; points.Length; i++)         {             float tmp = ProjVector3(points[i], Axis);             if (tmp &gt; max)             {                 max = tmp;             }              if (tmp &lt; min)             {                 min= tmp;             }         } } <\/code><\/pre>\n<p>  \u0418\u0442\u043e\u0433\u043e, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e( <i>ProjAxis<\/i> ), \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0443\u0431\u0430.<\/p>\n<pre><code class=\"cs\">private static Vector3 IntersectionOfProj(Vector3[] a, Vector3[] b, List&lt;Vector3&gt; Axis) {         for (int j = 0; j &lt; Axis.Count; j++)         {             \/\/\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u0430 a             float max_a;             float min_a;             ProjAxis(out min_a,out max_a,a,Axis[j]);              \/\/\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u0430 b             float max_b;             float min_b;             ProjAxis(out min_b,out max_b,b,Axis[j]);                          \/\/...         }         \/\/... } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/og\/ba\/et\/ogbaetjzgs0e5b8gd7dv1ldmf5s.png\"><\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0438 \u0442\u043e\u0447\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e, \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435, \u043d\u043e \u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">            float[] points = {min_a, max_a, min_b, max_b};             Array.Sort(points); <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0442\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e: <\/p>\n<p>  1) \u0415\u0441\u043b\u0438 \u043e\u0442\u0440\u0435\u0437\u043a\u0438 <b>\u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f<\/b>, \u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u0440\u0430\u0439\u043d\u0438\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/j4\/cv\/66\/j4cv66psvb7fdjlyudpcb9z8aeq.png\"><\/p>\n<p>  2) \u0415\u0441\u043b\u0438 \u043e\u0442\u0440\u0435\u0437\u043a\u0438 <b>\u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f<\/b>, \u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u0440\u0430\u0439\u043d\u0438\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zz\/-b\/tw\/zz-btwa_42iu9zxd733dmpvmrye.png\"><\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 <b>\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0438 \u043d\u0435\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435<\/b> \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u0432. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0442, \u0442\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e:<\/p>\n<pre><code class=\"cs\">            \/\/...             \/\/\u0421\u0443\u043c\u043c\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u0432             float sum = (max_b - min_b) + (max_a - min_a);             \/\/\u0414\u043b\u0438\u043d\u0430 \u043a\u0440\u0430\u0439\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a             float len = Math.Abs(p[3] - p[0]);                          if (sum &lt;= len)             {                 \/\/\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0441\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442                 \/\/ \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0435\u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f                 return Vector3.zero;             }             \/\/\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0443\u0431\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043e\u0441\u044c \u0434\u0430\u043b\u0435\u0435             \/\/.... <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0445\u043e\u0442\u044c \u043e\u0434\u0438\u043d \u0432\u0435\u043a\u0442\u043e\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u043e\u0432 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u0442\u043e\u0433\u0434\u0430 \u0438 \u0441\u0430\u043c\u0438 \u043a\u0443\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0439\u0434\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0443\u044e \u043e\u0441\u044c, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0430, \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430.<\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u0443\u0431\u043e\u0432, \u0432\u0441\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435: \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u043e\u0432 \u043d\u0430 <b>\u0432\u0441\u0435<\/b> \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c\u0441\u044f, \u0438 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u0442\u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434 \u0446\u0438\u043a\u043b\u043e\u043c, \u0438 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043d\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u043e\u0439. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0446\u0438\u043a\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440.<\/p>\n<pre><code class=\"cs\">private static Vector3 IntersectionOfProj(Vector3[] a, Vector3[] b, List&lt;Vector3&gt; Axis) {         Vector3 norm = new Vector3(10000,10000,10000);         for (int j = 0; j &lt; Axis.Count; j++)         {                 \/\/...         }         \/\/\u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0448\u0435\u043b\u0441\u044f \u0432\u0435\u043a\u0442\u043e\u0440 \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0435\u0433\u043e         return norm; { <\/code><\/pre>\n<p>  \u0418 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u044c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445. \u0442\u0430\u043a\u0443\u044e \u043e\u0441\u044c \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u0434\u043b\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u043e\u043c\u0430\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c(\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435) \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u0443\u0431\u043e\u0432.<\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0443\u0431\u0430.<\/p>\n<pre><code class=\"cs\">\/\/... if (sum &lt;= len) {    \/\/\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0441\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442    \/\/ \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f    return new Vector3(0,0,0); } \/\/\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u0443\u0431\u044b \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u0430\u043b\u0435\u0435  \/\/\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0439 - \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 2 \u0438 1 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \/\/(\u0441\u043c. \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u0432) float dl = Math.Abs(points[2] - points[1]); if (dl &lt; norm.magnitude) {    norm = Axis[j] * dl;    \/\/\u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438    if(points[0] != min_a)    norm = -norm; } \/\/... <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0412\u0435\u0441\u044c \u043a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">private static Vector3 IntersectionOfProj(Vector3[] a, Vector3[] b, List&lt;Vector3&gt; Axis) {         Vector3 norm = new Vector3(10000,10000,10000);         for (int j = 0; j &lt; Axis.Count; j++)         {             \/\/\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u0430 a             float max_a;             float min_a;             ProjAxis(out min_a,out max_a,a,Axis[j]);              \/\/\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u043a\u0443\u0431\u0430 b             float max_b;             float min_b;             ProjAxis(out min_b,out max_b,b,Axis[j]);              float[] points = {min_a, max_a, min_b, max_b};             Array.Sort(points);              float sum = (max_b - min_b) + (max_a - min_a);             float len = Math.Abs(points[3] - points[0]);                          if (sum &lt;= len)             {                 \/\/\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u0441\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442                 \/\/ \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f                 return new Vector3(0,0,0);             }             float dl = Math.Abs(points[2] - points[1]);             if (dl &lt; norm.magnitude)             {                 norm = Axis[j] * dl;                  \/\/\u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u043e\u0440\u043c\u044b                 if(points[0] != min_a)                     norm = -norm;             }          }         return norm; } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d \u043d\u0430 GitHub, \u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u0441 \u043d\u0438\u043c <a href=\"https:\/\/github.com\/slupok\/BoxCollisionDetected\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u041c\u043e\u0435\u0439 \u0446\u0435\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0439 \u0434\u0432\u0443\u0445 \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0410 \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u043c\u0435.<\/p><\/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\/509568\/\"> https:\/\/habr.com\/ru\/post\/509568\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/509568\/\">\u0412 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u043e\u0449\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0448\u0438\u043d\u044b,<br \/>  \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0418 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043c\u0438\u0440\u0430. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u043e\u0439 \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u043e\u0441\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kr\/nz\/cm\/krnzcmfdifg3rjsy-ess2yqnrtw.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-306432","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306432","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=306432"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306432\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}