Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- divert(-1)
- changecom(`%')
- % SQUAREANGLE(point, dir_point1, dir_point2, prefix)
- % Draws a square angle mark at 'point', with sides pointing to
- % 'dir_point1' and 'dir_point2'. 'prefix' must be a unique string.
- define(`SQUAREANGLE',
- `% square angle sign
- def $4a sqsz * unit($2-$1)
- def $4b sqsz * unit($3-$1)
- def P$4`'1 $1+[$4a]
- def P$4`'2 $1+[$4a]+[$4b]
- def P$4`'3 $1+[$4b]
- line(P$4`'1)(P$4`'2)(P$4`'3)')
- % ARCANGLE(point, dir_point1, dir_point2, prefix, radius, cfac)
- % Draws an angle arc mark at 'point', with sides pointing from
- % 'dir_point1' to 'dir_point2'. 'prefix' must be a unique string.
- % 'radius' is the arc radius. 'cfac' is a spline control point
- % distance factor (experiment with it).
- define(`ARCANGLE',
- `% angle arc
- def $4a unit($2-$1)
- def $4b unit($3-$1)
- def $4c [$4b] - [$4a] * ([$4a] . [$4b])
- def $4d [$4a] - [$4b] * ([$4a] . [$4b])
- def $4Pa $1 + $5 * [$4a]
- def $4Pb $1 + $5 * [$4b]
- def $4Pc ($4Pa) + $6 * [$4c]
- def $4Pd ($4Pb) + $6 * [$4d]
- def $4Pmid $1 + $5 * unit([$4a]+[$4b])
- special |\draw[->] #1 .. controls #2 and #3 .. #4;|
- ($4Pa)($4Pc)($4Pd)($4Pb)')
- divert(0)dnl
- def axn -0.4
- def axp 0.9
- def sqsz 0.1
- def P (0.8,-1.0,0.7)
- def O (0,0,0)
- def axes {
- line[arrows=->](axn,0,0)(axp,0,0)
- line[arrows=->](0,axn,0)(0,axp,0)
- line[arrows=->](0,0,axn)(0,0,axp)
- special |\node[anchor=east] at #1 {$x$};| (axp,0,0)
- special |\node[anchor=west] at #1 {$y$};| (0,axp,0)
- special |\node[anchor=north] at #1 {$z$};| (0,0,axp)
- }
- def pict {
- line[arrows=->,line width=1.0pt](0,0,0)(P)
- special |\node[anchor=east] at #1 {$\vec{v}$};|(P)
- def Pxz scale([1,0,1]) * (P)
- def Pz scale([0,0,1]) * (P)
- def Px scale([1,0,0]) * (P)
- line[line style=dotted](P)(Pxz)
- line[line style=dotted](0,0,0)(Pxz)
- line[line style=dotted](Pxz)(Pz)
- line[line style=dotted](Pxz)(Px)
- SQUAREANGLE((Pz),(Pxz),(O),a)
- SQUAREANGLE((Px),(Pxz),(O),e)
- SQUAREANGLE((Pxz),(P),(O),b)
- ARCANGLE((O),(0,0,1),(Pxz),c,0.4,0.15)
- special |\node[anchor=west] at #1 {$\theta$};|(cPmid)
- ARCANGLE((O),(Pxz),(P),d,0.3,0.1)
- special |\node[anchor=west] at #1 {$\phi$};|(dPb)
- }
- def off -10
- def pers 20
- def eye (pers,off,5)
- def lookat (0,off,5)
- def up [0,-1,0]
- put { view((eye),(lookat), [up]) then perspective(pers*3) } {
- {axes}
- {pict}
- }
- global {
- language tikz
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement