-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeformedrod.tex
96 lines (68 loc) · 2.81 KB
/
deformedrod.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
\def\cameraangle{166}
\tdplotsetmaincoords{44}{\cameraangle} % orientation of camera
\def\rodheight{10}
\def\rodradius{.2}
\pgfmathsetmacro{\beginangle}{\cameraangle}
\pgfmathsetmacro{\endangle}{\cameraangle - 180}
\tikzset{pics/rod/.style={code={
% draw rod
\draw [line width=1pt, color=black, fill=yellow!50!white, opacity=.9]
plot [domain=\beginangle:\endangle]
( {\rodradius*cos(\x)}, {\rodradius*sin(\x)}, 0 )
-- plot [domain=\endangle:\beginangle]
( {\rodradius*cos(\x)}, {\rodradius*sin(\x)}, \rodheight )
-- cycle ;
\draw [line width=1pt, color=black, fill=yellow!50!white, opacity=.9, domain=0:360]
plot ( {-\rodradius*cos(\x)}, {-\rodradius*sin(\x)}, \rodheight ) ;
}}}
\tikzset{pics/dottedrod/.style={code={
% draw rod dotted
\draw [line width=1pt, color=black, line cap=round, dash pattern=on 0pt off 1.6\pgflinewidth]
plot [domain=\beginangle:\endangle]
( {\rodradius*cos(\x)}, {\rodradius*sin(\x)}, 0 )
-- plot [domain=\endangle:\beginangle]
( {\rodradius*cos(\x)}, {\rodradius*sin(\x)}, \rodheight )
-- cycle ;
\draw [line width=1pt, color=black, line cap=round, dash pattern=on 0pt off 1.6\pgflinewidth, opacity=.9, domain=0:360]
plot ( {-\rodradius*cos(\x)}, {-\rodradius*sin(\x)}, \rodheight ) ;
}}}
\tikzset{pics/rodaxis/.style={code={
% draw axis
\draw [line width=0.5pt, blue, line cap=round, dash pattern=on 12pt off 2pt on \the\pgflinewidth off 2pt]
( 0, 0, -0.4pt ) -- ( 0, 0, \rodheight + 0.4pt ) ;
}}}
\tikzset{pics/externalforce/.style={code={
% draw force
\def\forcelength{1.2}
\draw [line width=1.5pt, red, line cap=round, -{Triangle[round, length=3.6mm, width=2.4mm]}]
( 0, 0, \rodheight + \forcelength ) -- ( 0, 0, \rodheight )
node [ pos=0.4, left, inner sep=0, outer sep=4.4pt ]
{\scalebox{1.2}[1.2]{${\bm{F}}$}} ;
}}}
\begin{tikzpicture}[scale=1, tdplot_main_coords] % use 3dplot
\coordinate (O) at ( 0, 0, 0 ) ;
\coordinate (rodTopCenter) at ($ (O) + ( 0, 0, \rodheight ) $) ;
% draw circle
\def\circleradius{0.8}
\def\heightofhatch{0.5}
\pgfmathsetmacro{\stepangleforcircle}{\beginangle - 10}
\foreach \angle in { \beginangle, \stepangleforcircle, ..., \endangle }
\draw [line width=0.4pt, color=black]
( \angle:\circleradius ) -- ($ ( \angle:\circleradius ) - ( 0, 0, \heightofhatch ) $) ;
\draw [line width=1pt, color=black, fill=white] (O) circle ( \circleradius ) ;
% draw rod, axis and force
\pic (initial) {rod} ;
\pic (initial) {rodaxis} ;
\pic (initial) {externalforce} ;
% draw deformed rod
\scoped {
\pgfsetcurvilinearbeziercurve
{\pgfpointxyz{0}{0}{0}}
{\pgfpointxyz{0}{0}{0.5cm}}
{\pgfpointxyz{0.25cm}{0}{1cm}}
{\pgfpointxyz{1.25cm}{0}{1.25cm}}
\pgftransformnonlinear{\pgfgetlastxy\x\y\pgfpointcurvilinearbezierorthogonal{\y}{\x}}
\pic (deformed) {dottedrod} ;
\pic (deformed) {rodaxis} ;
}
\end{tikzpicture}