Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. divert(-1)
  2. changecom(`%')
  3.  
  4. % SQUAREANGLE(point, dir_point1, dir_point2, prefix)
  5. % Draws a square angle mark at 'point', with sides pointing to
  6. % 'dir_point1' and 'dir_point2'. 'prefix' must be a unique string.
  7. define(`SQUAREANGLE',
  8. `% square angle sign
  9. def $4a sqsz * unit($2-$1)
  10. def $4b sqsz * unit($3-$1)
  11. def P$4`'1 $1+[$4a]
  12. def P$4`'2 $1+[$4a]+[$4b]
  13. def P$4`'3 $1+[$4b]
  14. line(P$4`'1)(P$4`'2)(P$4`'3)')
  15.  
  16.  
  17. % ARCANGLE(point, dir_point1, dir_point2, prefix, radius, cfac)
  18. % Draws an angle arc mark at 'point', with sides pointing from
  19. % 'dir_point1' to 'dir_point2'. 'prefix' must be a unique string.
  20. % 'radius' is the arc radius. 'cfac' is a spline control point
  21. % distance factor (experiment with it).
  22. define(`ARCANGLE',
  23. `% angle arc
  24. def $4a unit($2-$1)
  25. def $4b unit($3-$1)
  26. def $4c [$4b] - [$4a] * ([$4a] . [$4b])
  27. def $4d [$4a] - [$4b] * ([$4a] . [$4b])
  28. def $4Pa $1 + $5 * [$4a]
  29. def $4Pb $1 + $5 * [$4b]
  30. def $4Pc ($4Pa) + $6 * [$4c]
  31. def $4Pd ($4Pb) + $6 * [$4d]
  32. def $4Pmid $1 + $5 * unit([$4a]+[$4b])
  33. special |\draw[->] #1 .. controls #2 and #3 .. #4;|
  34. ($4Pa)($4Pc)($4Pd)($4Pb)')
  35. divert(0)dnl
  36.  
  37. def axn -0.4
  38. def axp 0.9
  39. def sqsz 0.1
  40. def P (0.8,-1.0,0.7)
  41. def O (0,0,0)
  42.  
  43. def axes {
  44. line[arrows=->](axn,0,0)(axp,0,0)
  45. line[arrows=->](0,axn,0)(0,axp,0)
  46. line[arrows=->](0,0,axn)(0,0,axp)
  47. special |\node[anchor=east] at #1 {$x$};| (axp,0,0)
  48. special |\node[anchor=west] at #1 {$y$};| (0,axp,0)
  49. special |\node[anchor=north] at #1 {$z$};| (0,0,axp)
  50. }
  51.  
  52. def pict {
  53. line[arrows=->,line width=1.0pt](0,0,0)(P)
  54. special |\node[anchor=east] at #1 {$\vec{v}$};|(P)
  55.  
  56. def Pxz scale([1,0,1]) * (P)
  57. def Pz scale([0,0,1]) * (P)
  58. def Px scale([1,0,0]) * (P)
  59. line[line style=dotted](P)(Pxz)
  60. line[line style=dotted](0,0,0)(Pxz)
  61. line[line style=dotted](Pxz)(Pz)
  62. line[line style=dotted](Pxz)(Px)
  63.  
  64. SQUAREANGLE((Pz),(Pxz),(O),a)
  65. SQUAREANGLE((Px),(Pxz),(O),e)
  66. SQUAREANGLE((Pxz),(P),(O),b)
  67.  
  68. ARCANGLE((O),(0,0,1),(Pxz),c,0.4,0.15)
  69. special |\node[anchor=west] at #1 {$\theta$};|(cPmid)
  70.  
  71. ARCANGLE((O),(Pxz),(P),d,0.3,0.1)
  72. special |\node[anchor=west] at #1 {$\phi$};|(dPb)
  73. }
  74.  
  75. def off -10
  76. def pers 20
  77. def eye (pers,off,5)
  78. def lookat (0,off,5)
  79. def up [0,-1,0]
  80. put { view((eye),(lookat), [up]) then perspective(pers*3) } {
  81. {axes}
  82. {pict}
  83. }
  84.  
  85. global {
  86. language tikz
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement