Typica is a free program for professional coffee roasters. https://typica.us
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

shiftoff.mp 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. %% shiftoff.mp
  2. %% Copyright 2006 Henrik Tidefelt
  3. %
  4. % This work may be distributed and/or modified under the
  5. % conditions of the LaTeX Project Public License, either version 1.3
  6. % of this license or (at your option) any later version.
  7. % The latest version of this license is in
  8. % http://www.latex-project.org/lppl.txt
  9. % and version 1.3 or later is part of all distributions of LaTeX
  10. % version 2005/12/01 or later.
  11. %
  12. % This work has the LPPL maintenance status `maintained´.
  13. %
  14. % The Current Maintainer of this work is Henrik Tidefelt,
  15. % tidefelt@isy.liu.se.
  16. %
  17. % This work, referred to as blockdraw.mp, consists of the files
  18. % shiftoff.mp
  19. % blockdraw.mp
  20. % bondgraph.mp
  21. % blockdraw_mp.pdf
  22. numeric to_lft;
  23. to_lft = 0;
  24. numeric to_llft;
  25. to_llft = 1;
  26. numeric to_bot;
  27. to_bot = 2;
  28. numeric to_lrt;
  29. to_lrt = 3;
  30. numeric to_rt;
  31. to_rt = 4;
  32. numeric to_urt;
  33. to_urt = 5;
  34. numeric to_top;
  35. to_top = 6;
  36. numeric to_ulft;
  37. to_ulft = 7;
  38. numeric to_center;
  39. to_center = 8;
  40. def to_dir(expr z ) =
  41. if (xpart z) > 0:
  42. if (ypart z) > 0:
  43. if abs(xpart z) > 2*abs(ypart z):
  44. to_rt
  45. elseif abs(ypart z) > 2*abs(xpart z):
  46. to_top
  47. else:
  48. to_urt
  49. fi
  50. else:
  51. if abs(xpart z) > 2*abs(ypart z):
  52. to_rt
  53. elseif abs(ypart z) > 2*abs(xpart z):
  54. to_bot
  55. else:
  56. to_lrt
  57. fi
  58. fi
  59. else:
  60. if (ypart z) > 0:
  61. if abs(xpart z) > 2*abs(ypart z):
  62. to_lft
  63. elseif abs(ypart z) > 2*abs(xpart z):
  64. to_top
  65. else:
  66. to_ulft
  67. fi
  68. else:
  69. if abs(xpart z) > 2*abs(ypart z):
  70. to_lft
  71. elseif abs(ypart z) > 2*abs(xpart z):
  72. to_bot
  73. else:
  74. to_llft
  75. fi
  76. fi
  77. fi
  78. enddef;
  79. def dir_to(expr d ) =
  80. dir( 180 + d * 45 )
  81. enddef;
  82. def shiftoff(expr pic, corner ) =
  83. if corner = to_lft:
  84. (pic shifted ((-center pic)+((xpart llcorner pic)-(xpart center pic),0)))
  85. elseif corner = to_llft:
  86. (pic shifted ((-center pic)+(llcorner pic)-(center pic)))
  87. elseif corner = to_bot:
  88. (pic shifted ((-center pic)+(0,(ypart llcorner pic)-(ypart center pic))))
  89. elseif corner = to_lrt:
  90. (pic shifted ((-center pic)+(lrcorner pic)-(center pic)))
  91. elseif corner = to_rt:
  92. (pic shifted ((-center pic)+((xpart lrcorner pic)-(xpart center pic),0)))
  93. elseif corner = to_urt:
  94. (pic shifted ((-center pic)+(urcorner pic)-(center pic)))
  95. elseif corner = to_top:
  96. (pic shifted ((-center pic)+(0,(ypart ulcorner pic)-(ypart center pic))))
  97. elseif corner = to_ulft:
  98. (pic shifted ((-center pic)+(ulcorner pic)-(center pic)))
  99. else:
  100. (pic shifted (-center pic))
  101. fi
  102. enddef;
  103. numeric shiftofflabelmargin;
  104. shiftofflabelmargin := bboxmargin;
  105. def shiftoffwlm(expr pic, corner ) =
  106. if corner = to_lft:
  107. (pic shifted ((-center pic)+((xpart llcorner pic)-(xpart center pic),0)+(-shiftofflabelmargin,0)))
  108. elseif corner = to_llft:
  109. (pic shifted ((-center pic)+(llcorner pic)-(center pic)+(-shiftofflabelmargin,-shiftofflabelmargin)))
  110. elseif corner = to_bot:
  111. (pic shifted ((-center pic)+(0,(ypart llcorner pic)-(ypart center pic))+(0,-shiftofflabelmargin)))
  112. elseif corner = to_lrt:
  113. (pic shifted ((-center pic)+(lrcorner pic)-(center pic)+(shiftofflabelmargin,-shiftofflabelmargin)))
  114. elseif corner = to_rt:
  115. (pic shifted ((-center pic)+((xpart lrcorner pic)-(xpart center pic),0)+(shiftofflabelmargin,0)))
  116. elseif corner = to_urt:
  117. (pic shifted ((-center pic)+(urcorner pic)-(center pic)+(shiftofflabelmargin,shiftofflabelmargin)))
  118. elseif corner = to_top:
  119. (pic shifted ((-center pic)+(0,(ypart ulcorner pic)-(ypart center pic))+(0,shiftofflabelmargin)))
  120. elseif corner = to_ulft:
  121. (pic shifted ((-center pic)+(ulcorner pic)-(center pic)+(-shiftofflabelmargin,shiftofflabelmargin)))
  122. else:
  123. (pic shifted (-center pic))
  124. fi
  125. enddef;