{"id":164857,"date":"2013-01-06T13:10:03","date_gmt":"2013-01-06T09:10:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=164857"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=164857","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0442\u043e\u0440\u0430 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 WPF<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u0431\u0440\u044b\u0439 \u0432\u0435\u0447\u0435\u0440, \u0425\u0430\u0431\u0440. <br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0435\u043b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432 Windows Presentation Foundation. \u041f\u043e\u0441\u043b\u0435 \u0441\u0435\u043c\u0435\u0441\u0442\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 OpenGL, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 glut.h, \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0435\u0447\u0435\u0440 \u043d\u0430 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 WPF.\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0442\u043e\u0440.<br \/>  <a name=\"habracut\"><\/a>    <\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u044b WPF<\/h4>\n<p>   \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0431\u043b\u043e\u043a\u043e\u043c \u0432 WPF \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <i>mesh<\/i>, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0442\u0435\u0440\u043c\u0438\u043d\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b, \u043d\u043e \u0434\u0443\u043c\u0430\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u043a \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u0430 \u043d\u0435 \u043b\u0438\u043d\u0438\u044f?<br \/>  \u041f\u0443\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u2014 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c. \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438\u0437 \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0430 \u0442\u0440\u0435\u0445 \u0442\u043e\u0447\u043a\u0430\u0445 \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0443\u0434\u0430\u043b\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0438\u0437 \u0446\u0438\u043b\u0438\u043d\u0434\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"http:\/\/s4.hostingkartinok.com\/uploads\/images\/2013\/01\/59b84cc04b9e112d052bee1af0f386cc.png\" alt=\"image\"\/><\/div>\n<\/div>\n<p>  \u0421 \u043a\u0430\u0436\u0434\u044b\u043c \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438, \u043a\u0430\u043a \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c. \u0412\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0435\u043b\u043a\u0435 \u0438\u043b\u0438 \u043f\u0440\u043e\u0442\u0438\u0432, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0435\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0432\u0435), \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u0430. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u043f\u0440\u0430\u0432\u043e\u0439 \u0440\u0443\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u043e\u0434\u043d\u0438\u043c\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0430\u043b\u0435\u0446 \u043f\u0440\u0430\u0432\u043e\u0439 \u0440\u0443\u043a\u0438, \u043e\u043d \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435. \u041e\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0430\u043b\u0435\u0446 \u0432\u043d\u0438\u0437, \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u0443\u044e, \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0445\u043e\u0434\u0430.<br \/>  <img decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/3\/34\/Right-hand_grip_rule.svg\/220px-Right-hand_grip_rule.svg.png\" alt=\"image\"\/><\/div>\n<\/div>\n<p>  \u041d\u043e\u0440\u043c\u0430\u043b\u044c \u2014 \u044d\u0442\u043e \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u043f\u0435\u043d\u0434\u0438\u043a\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043a \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\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 \u0441\u0442\u043e\u0440\u043e\u043d \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"http:\/\/www.pm298.ru\/reshenie\/Math\/z01967.JPG\" alt=\"image\"\/><\/div>\n<\/div>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c<\/p>\n<ul>\n<li> Mesh Positions (\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438)<\/li>\n<li> Triangle Indeces (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435)<\/li>\n<li>Triangle Normals (\u043d\u043e\u0440\u043c\u0430\u043b\u0438)<\/li>\n<\/ul>\n<p>  \u041d\u0430\u0447\u0430\u043b\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 3D \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u0441\u0446\u0435\u043d\u044b, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 2D, \u0433\u0434\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u0432 \u043b\u0435\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443. \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u044b \u043a\u043b\u0430\u0441\u0441 <a href=\"http:\/\/msdn.microsoft.com\/ru-ru\/library\/system.windows.controls.viewport3d.aspx\">Viewport3D<\/a><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dynimg\/IC127979.png\" alt=\"image\"\/><\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 3D \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u044d\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u0432\u0438\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0412 WPF \u044d\u0442\u0443 \u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <a href=\"http:\/\/msdn.microsoft.com\/ru-ru\/library\/system.windows.media.media3d.camera.aspx\">camera<\/a><\/p>\n<h4>\u0422\u043e\u0440<\/h4>\n<p>  \u0422\u043e\u0440 \u2014 \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u0430\u044f \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043e\u0441\u0438, \u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0432 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438.<br \/>  <img decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/5\/54\/Torus_cycles.png\/220px-Torus_cycles.png\" alt=\"image\"\/><br \/>   \u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0438 \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0432\u0438\u0434\u0435, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<br \/>  \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c.<\/p>\n<p>  <i> x = (R + r * cos(a)) * cos(b) <br \/>  y = r * sin (a) <br \/>  z = -(R + r * cos(a))sin(b)<\/i>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u043e\u0440<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/6\/63\/Torus_3d.png\/220px-Torus_3d.png\" alt=\"image\"\/><\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u0440\u0430.<br \/>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u0447\u043a\u0443 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0440\u0430\u0434\u0438\u0443\u0441\u0430\u043c \u0438 \u0443\u0433\u043b\u0430\u043c:  <\/p>\n<pre><code class=\"cs\"> public Point3D getPositionTor(double R, double r, double a, double v){                          double sinB = Math.Sin(B * Math.PI \/ 180);             double cosB = Math.Cos(B * Math.PI \/ 180);             double sinA = Math.Sin(A * Math.PI \/ 180);             double cosA = Math.Cos(A * Math.PI \/ 180);                          Point3D point = new Point3D();             point.X = (R + r * cosA) * cosB;             point.Y = r * sinA;             point.Z = -(R + r * cosA) * sinB;              return point;  } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430  <\/p>\n<pre><code class=\"cs\">public static void drawTriangle(             Point3D p0, Point3D p1, Point3D p2, Color color, Viewport3D viewport) {             MeshGeometry3D mesh = new MeshGeometry3D();                          mesh.Positions.Add(p0);             mesh.Positions.Add(p1);             mesh.Positions.Add(p2);                         mesh.TriangleIndices.Add(0);             mesh.TriangleIndices.Add(1);             mesh.TriangleIndices.Add(2);              SolidColorBrush brush = new SolidColorBrush();             brush.Color = color;             Material material = new DiffuseMaterial(brush);              GeometryModel3D geometry = new GeometryModel3D(mesh, material);             ModelUIElement3D model = new ModelUIElement3D();             model.Model = geometry;              viewport.Children.Add(model); } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0442\u043e\u0440\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0435\u0433\u043c\u0435\u043d\u0442 \u0442\u043e\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"http:\/\/htmlimg4.scribdassets.com\/6g9hct8dfkwzmwb\/images\/488-e21a851dde.jpg\" alt=\"image\"\/><\/div>\n<\/div>\n<p>  \u0421\u0442\u0440\u043e\u0438\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u0432\u044b\u0448\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0434\u0432\u0443\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u0445.<\/p>\n<pre><code class=\"cs\">      public void drawTor(Point3D center, double R, double r, int N, int n, Color color){             if (n &lt; 2 || N &lt; 2){                 return;             }              Model3DGroup tor = new Model3DGroup();             Point3D[,] points = new Point3D[N, n];              for (int i  =  0; i  &lt;  N;  i++){                 for (int j  =  0; j  &lt;  n;  j++){                     points[i, j] = getPositionTor(R, r, i * 360\/(N - 1), j * 360\/(n - 1));                     points[i, j] += (Vector3D)center;                 }             }              Point3D[] p = new Point3D[4];             for (int i = 0; i &lt; N - 1; i++){                 for (int j = 0; j &lt; n - 1; j++){                     p[0] = points[i, j];                     p[1] = points[i + 1, j];                     p[2] = points[i + 1, j + 1];                     p[3] = points[i, j + 1];                     drawTriangle(p[0], p[1], p[2], color, mainViewport);                     drawTriangle(p[2], p[3], p[0], color, mainViewport);                                  }             }  }  <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0442\u043e\u0440\u0430  <\/p>\n<pre><code class=\"cs\">  drawTor(new Point3D(0, 0, 0), 1.0, 0.3, 20, 15, Colors.Tomato, false); <\/code><\/pre>\n<p>  \u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 XAML \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043b\u0438\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ViewPort3D  <\/p>\n<pre><code class=\"xml\">           &lt;Viewport3D Name=&quot;mainViewport&quot; ClipToBounds=&quot;True&quot; Height=&quot;374&quot;&gt;                 &lt;Viewport3D.Camera&gt;                     &lt;PerspectiveCamera                         FarPlaneDistance=&quot;100&quot;                         LookDirection=&quot;-11,-10,-9&quot;                         UpDirection=&quot;0,1,0&quot;                         NearPlaneDistance=&quot;1&quot;                         Position=&quot;11,10,9&quot;                         FieldOfView=&quot;70&quot;\/&gt;                 &lt;\/Viewport3D.Camera&gt;                 &lt;ModelVisual3D&gt;                     &lt;ModelVisual3D.Content&gt;                         &lt;DirectionalLight                             Color=&quot;White&quot;                             Direction=&quot;-2,-3,-1&quot;\/&gt;                     &lt;\/ModelVisual3D.Content&gt;                 &lt;\/ModelVisual3D&gt;            &lt;\/Viewport3D&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435:<br \/>  <img decoding=\"async\" src=\"http:\/\/s3.hostingkartinok.com\/uploads\/images\/2013\/01\/f37dc9c8eec001f85bf4a34fcbc3c1e8.png\" alt=\"image\"\/><br \/>  \u0418 \u0443\u0434\u0430\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<br \/>  <img decoding=\"async\" src=\"http:\/\/s4.hostingkartinok.com\/uploads\/images\/2013\/01\/1da0124d46c4b5215f8ad807ce9d3a98.png\" alt=\"image\"\/><\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \t\t\t \t\t\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\/164857\/\"> http:\/\/habrahabr.ru\/post\/164857\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u0431\u0440\u044b\u0439 \u0432\u0435\u0447\u0435\u0440, \u0425\u0430\u0431\u0440. <br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0435\u043b \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432 Windows Presentation Foundation. \u041f\u043e\u0441\u043b\u0435 \u0441\u0435\u043c\u0435\u0441\u0442\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 OpenGL, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 glut.h, \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0435\u0447\u0435\u0440 \u043d\u0430 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 WPF.\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0442\u043e\u0440.  <\/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-164857","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/164857","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=164857"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/164857\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}