File:Transformation example in MetaPost.svg

Summary

Description
Русский: Пример использования линейных преобразований в MetaPost. Сначала создаётся простой рисунок, затем он масштабируется и наклоняется для имитации трёхмерии. Исходный код для создания SVG-рисунка:
Date
Source Own work
Author Evgeny Baldin
SVG development
InfoField
Source code
InfoField

PostScript code

defaultfont := "cmr12";
 defaultscale := 12pt /fontsize defaultfont;
 prologues := 3;
 outputformat := "svg";
 %пример использования slanted
 beginfig(1) ;
  numeric u;
  u = 0.8mm;
  cutdraw (0u,0u)--(20u,0u)--(20u,30u){dir 90}..
      {dir -90}(17u,30u)--(17u,3u)--(0u,3u)
  withpen pencircle scaled 0.5u;
  drawdblarrow (23u,10u)--(23u,1u);
  label.rt("h",1/2[(23u,10u),(23u,1u)]);
  drawdblarrow (30u,30u)--(30u,1u);
  label.lft("H",1/2[(30u,30u),(30u,1u)]);
  picture Base;
  Base:=currentpicture;
  clearit;
  fill (15u,0u)--(20u,0u)--(20u,20u)--(17u,20u)--(17u,3u)--(15u,3u)--cycle
   withcolor 0.7white;
  draw Base;
  draw ((12u,20u)--(20u,20u));
  draw ((12u,10u)--(20u,10u));
  drawdblarrow ((14u,20u)--(14u,10u));
  label.lft("d",(14u,16u));
  picture Slant;
  Slant=currentpicture;
  clearit;
  fill (5u,0u)--(20u,0u)--(20u,10u)--(17u,10u)--(17u,3u)--(5u,3u)--cycle
  withcolor 0.7white;
  draw Base;
 % Собственно говоря, приер линейных преобразований здесь.
  draw Slant yscaled 2/3 slanted 1/2 shifted (40u,0u);
 endfig;

Affine transformations example usage in MetaPost code

defaultfont := "cmr12";
 defaultscale := 12pt /fontsize defaultfont;
 prologues := 3;
 outputformat := "svg";
 beginfig(1) ;
  numeric u;
  u = 0.8mm;
  cutdraw (0u,0u)--(20u,0u)--(20u,30u){dir 90}..
      {dir -90}(17u,30u)--(17u,3u)--(0u,3u)
  withpen pencircle scaled 0.5u;
  drawdblarrow (23u,10u)--(23u,1u);
  label.rt("h",1/2[(23u,10u),(23u,1u)]);
  drawdblarrow (30u,30u)--(30u,1u);
  label.lft("H",1/2[(30u,30u),(30u,1u)]);
  picture Base;
  Base:=currentpicture;
  clearit;
  fill (15u,0u)--(20u,0u)--(20u,20u)--(17u,20u)--(17u,3u)--(15u,3u)--cycle
   withcolor 0.7white;
  draw Base;
  draw ((12u,20u)--(20u,20u));
  draw ((12u,10u)--(20u,10u));
  drawdblarrow ((14u,20u)--(14u,10u));
  label.lft("d",(14u,16u));
  picture Slant;
  Slant=currentpicture;
  clearit;
  fill (5u,0u)--(20u,0u)--(20u,10u)--(17u,10u)--(17u,3u)--(5u,3u)--cycle
  withcolor 0.7white;
  draw Base;
 % here it is transformation example
  draw Slant yscaled 2/3 slanted 1/2 shifted (40u,0u);
 endfig ;

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-3.0#Transformation%20example%20in%20MetaPost.svg
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
Category:License migration redundant#Transformation%20example%20in%20MetaPost.svgCategory:GFDL#Transformation%20example%20in%20MetaPost.svg
You may select the license of your choice.
Category:Self-published work
Category:Affine transformation
Category:Affine transformation Category:CC-BY-SA-3.0 Category:GFDL Category:License migration redundant Category:Self-published work Category:Valid SVG created with MetaPost code