{"id":248159,"date":"2015-01-18T22:59:02","date_gmt":"2015-01-18T18:59:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=248159"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=248159","title":{"rendered":"<span class=\"post_title\">\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043a\u0443\u0440\u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438: \u043f\u0438\u0448\u0435\u043c \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 OpenGL \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438, \u0441\u0442\u0430\u0442\u044c\u044f 2 \u0438\u0437 6<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f, \u044d\u0442\u043e \u044f.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b58\/d5f\/0e8\/b58d5f0e8f7de59bcad1354b0fc92a35.png\"\/><br \/>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0435\u0439 \u0431\u0430\u0448\u043a\u0438, \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 \u0447\u0430\u0441-\u0434\u0432\u0430.<\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u043b\u043e\u0447\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0437\u0430\u043b\u044c\u0451\u043c \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u044b. \u0422\u043e\u0447\u043d\u0435\u0435, \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a OpenGL \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u043b\u0438\u0433\u043e\u043d \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f <i>\u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e<\/i> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u0440\u0435\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u042d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0441 \u043d\u0443\u043b\u044f. \u041c\u043e\u0439 \u043a\u043e\u0434 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0432\u0430\u0448 (\u0440\u0430\u0431\u043e\u0447\u0438\u0439) \u043a\u043e\u0434 \u0441 \u043c\u043e\u0438\u043c. \u042f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0448 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0435\u0433\u043e. \u041b\u044e\u0431\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f, \u043b\u044e\u0431\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c \u0440\u0430\u0434.<\/p>\n<p>  <b>\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0435 \u044d\u0442\u043e\u043c\u0443 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443 \u0438 \u043f\u0438\u0448\u0435\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434, \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u043d\u0430 github.com\/code.google.com \u0438 \u0438\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445! \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043c\u043e\u0447\u044c \u043a\u0430\u043a \u0438 \u0432\u0430\u043c (\u0434\u0440\u0443\u0433\u0438\u0435 \u043b\u044e\u0434\u0438 \u043c\u043e\u0433\u0443\u0442 \u0447\u0435\u0433\u043e \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u0442\u044c), \u0442\u0430\u043a \u0438 \u0431\u0443\u0434\u0443\u0449\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c.<\/b><\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u0420\u0438\u0441\u0443\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a.<\/h1>\n<p>  \u0418\u0442\u0430\u043a, \u0442\u0435\u043c\u0430 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f (\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 \u0434\u0432\u0430 \u0447\u0430\u0441\u0430 \u0434\u043b\u044f \u043f\u043b\u043e\u0445\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0445, \u043d\u043e \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432): \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0411\u0440\u0435\u0437\u0435\u043d\u0445\u044d\u043c\u0430 \u0434\u043b\u044f \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0440\u0435\u0437\u043a\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u0412\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043c\u0435\u044f\u0442\u044c\u0441\u044f, \u043d\u043e \u044d\u0442\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u042f \u043d\u0435 \u0437\u043d\u0430\u044e \u043f\u043e\u0447\u0435\u043c\u0443, \u043d\u043e \u044f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0438\u0445 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043e\u043a \u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0442 \u043d\u0430\u0434 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0430\u0440\u044b \u0447\u0430\u0441\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434:<\/p>\n<pre> triangle(vec2 points[3]) {     vec2 bbox[2] = find_bounding_box(points);     for (each pixel in the bounding box) {         if (inside(bbox, pixel)) {             put_pixel(pixel);         }     } } <\/pre>\n<p>  \u042f \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043b\u044e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434. \u041e\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0439. \u041d\u0430\u0439\u0442\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u043c\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0443 (\u0434\u0430 \u0438 \u043b\u044e\u0431\u043e\u043c\u0443 \u0432\u044b\u043f\u0443\u043a\u043b\u043e\u043c\u0443 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0443) \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. <\/p>\n<p>  <i>\u041e\u0444\u0444\u0442\u043e\u043f: \u0435\u0441\u043b\u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0443\u0442\u0438\u0442\u044c\u0441\u044f \u043d\u0430, \u0441\u043a\u0430\u0436\u0435\u043c, \u0441\u0430\u043c\u043e\u043b\u0451\u0442\u0435, \u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0443, \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u044f\u0434\u0443 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0430\u043c\u043e\u043b\u0451\u0442. \u042d\u0442\u043e \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0435\u0451 \u0440\u0435\u0448\u0438\u0442\u044c <b>\u043d\u0430\u0434\u0451\u0436\u043d\u043e<\/b>. <\/i><\/p>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u044f \u043b\u044e\u0431\u043b\u044e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434? \u0414\u0430 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e, \u0443\u0432\u0438\u0434\u0435\u0432 \u0442\u0430\u043a\u043e\u0435, \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u043e\u0432\u0438\u0447\u043e\u043a \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0435\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043c\u0435\u0442 \u0441 \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0437\u043c\u043e\u043c, \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0439 \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043c\u044b\u043a\u043d\u0435\u0442, \u043c\u043e\u043b, \u0432\u043e\u0442 \u0438\u0434\u0438\u043e\u0442 \u043f\u0438\u0441\u0430\u043b. \u0410 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0436\u043c\u0451\u0442 \u043f\u043b\u0435\u0447\u0430\u043c\u0438, \u043c\u043e\u043b, \u043d\u0443 \u0434\u0430, \u0442\u0430\u043a \u043e\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438. \u041c\u0430\u0441\u0441\u0438\u0432\u043d\u043e-\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u0442\u044b\u0441\u044f\u0447\u0430\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432 (\u044f \u0433\u043e\u0432\u043e\u0440\u044e \u043f\u0440\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b) \u0442\u0432\u043e\u0440\u044f\u0442 \u0447\u0443\u0434\u0435\u0441\u0430. \u041d\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c. \u0414\u0430 \u0438 \u043a\u0430\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430, \u043a\u0430\u043a \u043e\u043d\u043e \u0442\u0430\u043c \u0432 \u043a\u0440\u0435\u043c\u043d\u0438\u0438, \u043d\u0430\u0448\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  \u041e\u043a\u0435\u0439, \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre> void triangle(Vec2i t0, Vec2i t1, Vec2i t2, TGAImage &amp;image, TGAColor color) {     line(t0, t1, image, color);     line(t1, t2, image, color);     line(t2, t0, image, color); }  [...]      Vec2i t0[3] = {Vec2i(10, 70),   Vec2i(50, 160),  Vec2i(70, 80)};     Vec2i t1[3] = {Vec2i(180, 50),  Vec2i(150, 1),   Vec2i(70, 180)};     Vec2i t2[3] = {Vec2i(180, 150), Vec2i(120, 160), Vec2i(130, 180)};       triangle(t0[0], t0[1], t0[2], image, red);     triangle(t1[0], t1[1], t1[2], image, white);     triangle(t2[0], t2[1], t2[2], image, green); <\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/30e\/b4e\/46f\/30eb4e46f1904293298677f515d7e97c.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/github.com\/ssloy\/tinyrenderer\/tree\/7e46cc57fa3f5a41129d6b6fefe4e77f77b8aa84\">\u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043e\u0434\u0430<\/a>. \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u044f \u0434\u0430\u044e \u0442\u0440\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430; \u0435\u0441\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 triangle \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 line(), \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a\u043e\u043d\u0442\u0443\u0440 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u041a\u0430\u043a \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c <i>\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439<\/i> \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a?<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438:   <\/p>\n<ul>\n<li>\u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c (\u0441\u044e\u0440\u043f\u0440\u0438\u0437) \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c<\/li>\n<li>\u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c: \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432\u0435\u0440\u0448\u0438\u043d, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0438\u043c\u0435\u044e\u0442 \u0434\u0432\u0435 \u043e\u0431\u0449\u0438\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b, \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u044b\u0440\u043e\u043a \u0438\u0437-\u0437\u0430 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0439 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/li>\n<\/ul>\n<p>  \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u043d\u043e \u043c\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u043c\u0441\u044f \u044d\u0442\u0438\u043c\u0438 \u0442\u0440\u0435\u043c\u044f. <\/p>\n<p>  \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f line sweeping (\u0437\u0430\u043c\u0435\u0442\u0430\u043d\u0438\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u043e\u043c?):   <\/p>\n<ul>\n<li>\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u043e \u0438\u0445 y-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435<\/li>\n<li>\u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0432\u0443\u044e \u0438 \u043f\u0440\u0430\u0432\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430<\/li>\n<li>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0433\u043e\u0440\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u043b\u0435\u0432\u043e\u0439 \u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u044b<\/li>\n<\/ul>\n<p>  \u0422\u0443\u0442 \u043c\u043e\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0442\u0435\u0440\u044f\u0442\u044c\u0441\u044f, \u043a\u0442\u043e \u043b\u0435\u0432\u044b\u0439, \u043a\u0442\u043e \u043f\u0440\u0430\u0432\u044b\u0439, \u0434\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u0432 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435 \u0442\u0440\u0438 \u043e\u0442\u0440\u0435\u0437\u043a\u0430\u2026 <br \/>  \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0441\u0432\u043e\u0438\u0445 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 \u0447\u0430\u0441, \u0447\u0442\u0435\u043d\u0438\u0435 \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u043a\u0443\u0434\u0430 \u043a\u0430\u043a \u043c\u0435\u043d\u0435\u0435 \u0446\u0435\u043d\u043d\u043e, \u043d\u0435\u0436\u0435\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e (\u0432\u044b\u0441\u0442\u0440\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e!) \u043a\u043e\u0434\u0430 \u0441 \u043c\u043e\u0438\u043c.<\/p>\n<p>  [\u043f\u0440\u043e\u0448\u0451\u043b \u0447\u0430\u0441]<\/p>\n<p>  \u041a\u0430\u043a \u0440\u0438\u0441\u0443\u044e \u044f? \u0415\u0449\u0451 \u0440\u0430\u0437, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u0442\u043e \u044f \u0435\u0433\u043e \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u0432\u043e\u0437\u044c\u043c\u0443 \u043d\u0430 \u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0442\u043e\u0447\u043a\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, t0,t1,t2, \u043e\u043d\u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e y-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<br \/>  \u0422\u043e\u0433\u0434\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0410 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0436\u0434\u0443 t0 \u0438 t2, \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0411 \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0436\u0434\u0443 t0 \u0438 t1, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u0435\u0436\u0434\u0443 t1 \u0438 t2.  <\/p>\n<pre> void triangle(Vec2i t0, Vec2i t1, Vec2i t2, TGAImage &amp;image, TGAColor color) {     \/\/ sort the vertices, t0, t1, t2 lower-to-upper (bubblesort yay!)     if (t0.y&gt;t1.y) std::swap(t0, t1);     if (t0.y&gt;t2.y) std::swap(t0, t2);     if (t1.y&gt;t2.y) std::swap(t1, t2);      line(t0, t1, image, green);     line(t1, t2, image, green);     line(t2, t0, image, red); } <\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0410 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0430 \u043a\u0440\u0430\u0441\u043d\u044b\u043c, \u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0411 \u0437\u0435\u043b\u0451\u043d\u044b\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/c86\/7b3\/e2c\/c867b3e2c19c2af991885384f76847c0.png\"\/><\/p>\n<p>  \u0413\u0440\u0430\u043d\u0438\u0446\u0430 \u0411, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u0430\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u043c \u043d\u0438\u0436\u043d\u044e\u044e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u0440\u0430\u0437\u0440\u0435\u0437\u0430\u0432 \u0435\u0433\u043e \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u0432 \u0442\u043e\u0447\u043a\u0435 \u0438\u0437\u043b\u043e\u043c\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0411.<\/p>\n<pre> void triangle(Vec2i t0, Vec2i t1, Vec2i t2, TGAImage &amp;image, TGAColor color) {     \/\/ sort the vertices, t0, t1, t2 lower-to-upper (bubblesort yay!)     if (t0.y&gt;t1.y) std::swap(t0, t1);     if (t0.y&gt;t2.y) std::swap(t0, t2);     if (t1.y&gt;t2.y) std::swap(t1, t2);      int total_height = t2.y-t0.y;     for (int y=t0.y; y&lt;=t1.y; y++) {         int segment_height = t1.y-t0.y+1;         float alpha = (float)(y-t0.y)\/total_height;         float beta  = (float)(y-t0.y)\/segment_height; \/\/ be careful with divisions by zero         Vec2i A = t0 + (t2-t0)*alpha;         Vec2i B = t0 + (t1-t0)*beta;         image.set(A.x, y, red);         image.set(B.x, y, green);     } } <\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d41\/6a4\/99a\/d416a499a0e471b80d05a6488ea1fa4c.png\"\/><\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u0440\u044b\u0432\u043d\u044b\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u0438. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0440\u0430\u0437\u0430 (\u0433\u0434\u0435 \u043c\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u044f\u043c\u044b\u0435) \u044f \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u043e\u0447\u0438\u043b\u0441\u044f \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 90\u00b0. \u041f\u043e\u0447\u0435\u043c\u0443? \u042d\u0442\u043e \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c. \u041f\u0440\u043e\u0441\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043b\u0438\u043d\u0438\u044f\u043c\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u044b \u0442\u043e\u0447\u0435\u043a, \u0442\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u043f\u0440\u043e\u043f\u0430\u0434\u0443\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a91\/fa0\/094\/a91fa0094cbd7e921d129fbb47eed7b1.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u0442\u043e\u0440\u043e\u0439 \u0446\u0438\u043a\u043b:  <\/p>\n<pre> void triangle(Vec2i t0, Vec2i t1, Vec2i t2, TGAImage &amp;image, TGAColor color) {     \/\/ sort the vertices, t0, t1, t2 lower-to-upper (bubblesort yay!)     if (t0.y&gt;t1.y) std::swap(t0, t1);     if (t0.y&gt;t2.y) std::swap(t0, t2);     if (t1.y&gt;t2.y) std::swap(t1, t2);      int total_height = t2.y-t0.y;     for (int y=t0.y; y&lt;=t1.y; y++) {         int segment_height = t1.y-t0.y+1;         float alpha = (float)(y-t0.y)\/total_height;         float beta  = (float)(y-t0.y)\/segment_height; \/\/ be careful with divisions by zero         Vec2i A = t0 + (t2-t0)*alpha;         Vec2i B = t0 + (t1-t0)*beta;         if (A.x&gt;B.x) std::swap(A, B);         for (int j=A.x; j&lt;=B.x; j++) {             image.set(j, y, color); \/\/ attention, due to int casts t0.y+i != A.y         }     }     for (int y=t1.y; y&lt;=t2.y; y++) {         int segment_height =  t2.y-t1.y+1;         float alpha = (float)(y-t0.y)\/total_height;         float beta  = (float)(y-t1.y)\/segment_height; \/\/ be careful with divisions by zero         Vec2i A = t0 + (t2-t0)*alpha;         Vec2i B = t1 + (t2-t1)*beta;         if (A.x&gt;B.x) std::swap(A, B);         for (int j=A.x; j&lt;=B.x; j++) {             image.set(j, y, color); \/\/ attention, due to int casts t0.y+i != A.y         }     } } <\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/dda\/7b2\/516\/dda7b251616a80f1cb65690de02e3851.png\"\/><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u0432\u0430\u0440\u0435\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u044f \u0434\u0432\u0430\u0436\u0434\u044b \u0432\u0438\u0436\u0443 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434, \u0434\u0430 \u0435\u0449\u0451 \u0442\u0430\u043a \u0440\u044f\u0434\u043e\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c, \u0437\u0430\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u043b\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439.<\/p>\n<pre> void triangle(Vec2i t0, Vec2i t1, Vec2i t2, TGAImage &amp;image, TGAColor color) {     if (t0.y==t1.y && t0.y==t2.y) return; \/\/ i dont care about degenerate triangles     \/\/ sort the vertices, t0, t1, t2 lower-to-upper (bubblesort yay!)     if (t0.y&gt;t1.y) std::swap(t0, t1);     if (t0.y&gt;t2.y) std::swap(t0, t2);     if (t1.y&gt;t2.y) std::swap(t1, t2);     int total_height = t2.y-t0.y;     for (int i=0; i&lt;total_height; i++) {         bool second_half = i&gt;t1.y-t0.y || t1.y==t0.y;         int segment_height = second_half ? t2.y-t1.y : t1.y-t0.y;         float alpha = (float)i\/total_height;         float beta  = (float)(i-(second_half ? t1.y-t0.y : 0))\/segment_height; \/\/ be careful: with above conditions no division by zero here         Vec2i A =               t0 + (t2-t0)*alpha;         Vec2i B = second_half ? t1 + (t2-t1)*beta : t0 + (t1-t0)*beta;         if (A.x&gt;B.x) std::swap(A, B);         for (int j=A.x; j&lt;=B.x; j++) {             image.set(j, t0.y+i, color); \/\/ attention, due to int casts t0.y+i != A.y         }     } } <\/pre>\n<p>  <a href=\"https:\/\/github.com\/ssloy\/tinyrenderer\/tree\/024ad4619b824f9179c86dc144145e2b8b155f52\">\u041e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043e\u0434\u0430<\/a> \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 2d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<\/p>\n<h1>\u0420\u0438\u0441\u0443\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c<\/h1>\n<p>  \u041c\u044b \u0443\u043c\u0435\u0435\u043c \u0443\u0436\u0435 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u0437\u0430\u043b\u044c\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043c\u044b \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412\u043e\u0442 <a href=\"https:\/\/github.com\/ssloy\/tinyrenderer\/tree\/9afc1e163a6d1e9e4f302637a860cc42b9e2b482\">\u043a\u043e\u0434<\/a>.<\/p>\n<pre>     for (int i=0; i&lt;model-&gt;nfaces(); i++) {         std::vector&lt;int&gt; face = model-&gt;face(i);         Vec2i screen_coords[3];         for (int j=0; j&lt;3; j++) {             Vec3f world_coords = model-&gt;vert(face[j]);             screen_coords[j] = Vec2i((world_coords.x+1.)*width\/2., (world_coords.y+1.)*height\/2.);         }         triangle(screen_coords[0], screen_coords[1], screen_coords[2], image, TGAColor(rand()%255, rand()%255, rand()%255, 255));     } <\/pre>\n<p>  \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u043e \u0432\u0441\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c, \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0438\u0440\u043e\u0432\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0435 \u0438 \u0440\u0438\u0441\u0443\u0435\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445. \u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u0447\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/aad\/06f\/ead\/aad06feadf75e37142b7d4e9bfa212cd.png\"\/><\/p>\n<h1>\u041f\u043b\u043e\u0441\u043a\u0430\u044f \u0442\u043e\u043d\u0438\u0440\u043e\u0432\u043a\u0430.<\/h1>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0431\u0438\u0440\u0430\u0442\u044c \u044d\u0442\u0438 \u043a\u043b\u043e\u0443\u043d\u0441\u043a\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u0438 \u043e\u0441\u0432\u0435\u0449\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c.<br \/>  \u041a\u0430\u043f\u0438\u0442\u0430\u043d \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c: \u00ab\u041f\u0440\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0438\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u0435\u0442\u0430 \u043f\u043e\u043b\u0438\u0433\u043e\u043d \u043e\u0441\u0432\u0435\u0449\u0451\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u044f\u0440\u043a\u043e, \u0435\u0441\u043b\u0438 \u0441\u0432\u0435\u0442 \u0435\u043c\u0443 \u043f\u0435\u0440\u043f\u0435\u043d\u0434\u0438\u043a\u0443\u043b\u044f\u0440\u0435\u043d\u00bb.<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/4d1\/454\/771\/4d145477141e08ea0b0ab8310bcc38f7.jpg\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/5fa\/04a\/e76\/5fa04ae761ef0f4975bde6145bc94df5.jpg\"\/><\/p>\n<p>  \u041d\u0443\u043b\u0435\u0432\u0443\u044e \u043e\u0441\u0432\u0435\u0449\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0435\u043d \u0432\u0435\u043a\u0442\u043e\u0440\u0443 \u0441\u0432\u0435\u0442\u0430.<br \/>  \u041f\u0435\u0440\u0435\u0444\u0440\u0430\u0437\u0438\u0440\u0443\u0435\u043c: \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0432\u0435\u0449\u0451\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0432\u043d\u0430 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u0432\u0435\u0442\u0430 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0443.<br \/>  \u041d\u043e\u0440\u043c\u0430\u043b\u044c \u043a \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0443 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0435\u0433\u043e \u0440\u0451\u0431\u0435\u0440. <\/p>\n<pre>     for (int i=0; i&lt;model-&gt;nfaces(); i++) {         std::vector&lt;int&gt; face = model-&gt;face(i);         Vec2i screen_coords[3];         Vec3f world_coords[3];         for (int j=0; j&lt;3; j++) {             Vec3f v = model-&gt;vert(face[j]);             screen_coords[j] = Vec2i((v.x+1.)*width\/2., (v.y+1.)*height\/2.);             world_coords[j]  = v;         }         Vec3f n = (world_coords[2]-world_coords[0])^(world_coords[1]-world_coords[0]);         n.normalize();         float intensity = n*light_dir;         if (intensity&gt;0) {             triangle(screen_coords[0], screen_coords[1], screen_coords[2], image, TGAColor(intensity*255, intensity*255, intensity*255, 255));         }     } <\/pre>\n<p>  \u041d\u043e \u0432\u0435\u0434\u044c \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442? \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0432\u0435\u0442 \u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e\u0437\u0430\u0434\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430. \u0415\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f (\u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u0430 \u0437\u0430\u0431\u043e\u0442\u0430, \u0430 3\u0434 \u043c\u043e\u0434\u0435\u043b\u0435\u0440\u043e\u0432), \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u043d\u0435 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u0412 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"http:\/\/en.wikipedia.org\/wiki\/Back-face_culling\">Back-face culling<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/a3a\/f41\/137\/a3af4113710b41eb09ed4b935891da80.png\"\/><br \/>  \u041c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0435\u0439 \u0433\u043e\u043b\u043e\u0432\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435? \u041d\u0443 \u0442\u0430\u043a \u0432 \u043d\u0435\u0439 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041d\u0438\u0447\u0435\u0433\u043e, \u0434\u0435\u0442\u0430\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u0437\u0436\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0434\u0430\u043b \u0434\u043b\u044f \u0437\u0430\u0442\u0440\u0430\u0432\u043a\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043f\u043e\u043b\u043e\u0441\u0442\u044c \u0440\u0442\u0430 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u043f\u043e\u0432\u0435\u0440\u0445 \u0433\u0443\u0431. \u041d\u0443 \u0430 \u0447\u0442\u043e, \u0442\u0430\u043a\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0451 \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0432\u044b\u043f\u0443\u043a\u043b\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u042d\u0442\u0438 \u043e\u0433\u0440\u0435\u0445\u0438 \u043c\u044b \u0443\u0431\u0435\u0440\u0451\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437, \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0432 z-buffer.<br \/>  <a href=\"https:\/\/github.com\/ssloy\/tinyrenderer\/tree\/e1a3f2b0f9638fa6db9e0437c621132e1baa3fb1\">\u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/a> \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440\u0430.      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/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=\"http:\/\/habrahabr.ru\/post\/248159\/\"> http:\/\/habrahabr.ru\/post\/248159\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f, \u044d\u0442\u043e \u044f.<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b58\/d5f\/0e8\/b58d5f0e8f7de59bcad1354b0fc92a35.png\"\/><br \/>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0435\u0439 \u0431\u0430\u0448\u043a\u0438, \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0435 \u0447\u0430\u0441-\u0434\u0432\u0430.<\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u043b\u043e\u0447\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0437\u0430\u043b\u044c\u0451\u043c \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u044b. \u0422\u043e\u0447\u043d\u0435\u0435, \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a OpenGL \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u043b\u0438\u0433\u043e\u043d \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f <i>\u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e<\/i> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u0440\u0435\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u042d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0441 \u043d\u0443\u043b\u044f. \u041c\u043e\u0439 \u043a\u043e\u0434 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0432\u0430\u0448 (\u0440\u0430\u0431\u043e\u0447\u0438\u0439) \u043a\u043e\u0434 \u0441 \u043c\u043e\u0438\u043c. \u042f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u0448 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0435\u0433\u043e. \u041b\u044e\u0431\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f, \u043b\u044e\u0431\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c \u0440\u0430\u0434.<\/p>\n<p>  <b>\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0435 \u044d\u0442\u043e\u043c\u0443 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443 \u0438 \u043f\u0438\u0448\u0435\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434, \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u043d\u0430 github.com\/code.google.com \u0438 \u0438\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445! \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043c\u043e\u0447\u044c \u043a\u0430\u043a \u0438 \u0432\u0430\u043c (\u0434\u0440\u0443\u0433\u0438\u0435 \u043b\u044e\u0434\u0438 \u043c\u043e\u0433\u0443\u0442 \u0447\u0435\u0433\u043e \u043f\u043e\u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u0442\u044c), \u0442\u0430\u043a \u0438 \u0431\u0443\u0434\u0443\u0449\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c.<\/b><\/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-248159","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/248159","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=248159"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/248159\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=248159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=248159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=248159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}