我绘制了下图,显示半径为 R 的球体与底面半径为 2R、高为 2R 的圆锥体,距离枢轴距离为 2R,与底面半径和高均为 2R 的圆柱体旋转平衡。
长度如上图所示,红点代表物体的质心。
这是 MWE:
\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{3d,calc}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
%Wall
\draw [fill,pattern=north east lines,draw=none] (-3,3) rectangle (3,3.25);
\draw (-3,3)--(3,3);
%Segment
\draw[|<->|] (-2,2.45) -- (0.67,2.45) node[midway,fill=white] {$2R$};
\draw[|<->|] (0.67,2.45) -- (2,2.45) node[midway,fill=white] {$R$};
\draw[|<->|] (4,1) -- (4,-0.5) node[midway,fill=white] {$2R$};
\draw[|<->|] (-0.5,1) -- (-0.5,-1) node[midway,fill=white] {$2R$};
\draw[|<->|] (-0.5,-2) -- (-0.5,-4) node[midway,fill=white] {$2R$};
\draw[|<->|] (4,1) -- (4,-0.5) node[midway,fill=white] {$2R$};
\draw[|<->|] (1,1.25) -- (2,1.25) node[midway,fill=white] {$R$};
\draw[|<->|] (3,1.25) -- (2,1.25) node[midway,fill=white] {$R$};
%Fulcrum
\draw[thick, fill=yellow, yellow] (-2.01,2) rectangle (2.01,2.25);
%Lines hanging objects
\draw[thick] (-2,2)--(-2,1) (0.67,2.25)--(0.67,3) (-2,-1)--(-2,-2) (2,1)--(2,2);
%Sphere
\draw (-3,0) arc (180:360:1cm and 0.5cm);
\draw[dashed] (-3,0) arc (180:0:1cm and 0.5cm);
\draw (-2,1) arc (90:270:0.5cm and 1cm);
\draw[dashed] (-2,1) arc (90:-90:0.5cm and 1cm);
\draw (-2,0) circle (1cm);
\shade[ball color=blue!10!white,opacity=0.20] (-2,0) circle (1cm);
\tkzDefPoint(-2,0){A}
\tkzDrawPoints[color=red, fill=red](A)
%Cone
\draw (-3,-4) arc (180:360:1cm and 0.5cm) -- (-2,-2) -- cycle;
\draw[dashed] (-3,-4) arc (180:0:1cm and 0.5cm);
\shade[left color=blue!5!white,right color=blue!40!white,opacity=0.3] (-3,-4) arc (180:360:1cm and 0.5cm) -- (-2,-2) -- cycle;
\draw (-2,-4)--(-1,-4);
\node at (-1.5,-3.7) {$2R$};
\tkzDefPoint(-2,-3){B}
\tkzDrawPoints[color=red, fill=red](B)
%Cylinder
\draw (1,1) arc (90:270:0.75cm and 1.5cm);
\draw[dashed] (1,1) arc (90:-90:0.75cm and 1.5cm);
\draw (3,1) arc (90:270:0.75cm and 1.5cm);
\draw (3,1) arc (90:-90:0.75cm and 1.5cm);
\draw (1,1)--(3,1) (1,-2)--(3,-2);
\shade[left color=green!5!white,right color=green!40!white,opacity=0.3] (1,1) arc (90:270:0.75cm and 1.5cm)--(1,-2)--(3,-2)--(3,-2) arc (-90:90:0.75cm and 1.5cm)--cycle;
\tkzDefPoint(2,-0.5){C}
\tkzDrawPoints[color=red, fill=red](C)
\end{tikzpicture}
\end{document}
另一方面,我想取无穷小厚度 Δx,距离 x(蓝色),如下所示:
对于球体来说,取 Δx 的无穷小厚度似乎很难,因为很难明确计算一小部分的高度。有没有什么方法可以很好地绘制它?
答案1
你可以尝试这个代码
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}% https://github.com/marmotghost/tikz-3dtools
\begin{document}
\begin{tikzpicture}[3d/install view={phi=110,theta=70},line join = round, line cap = round,declare function={R=3;r=R;h=R;}]
\path
(0,0,0) coordinate (O)
(0,0,R) coordinate (N)
(0,0,-R) coordinate (S)
(0,0,3) coordinate (T);
\begin{scope}[3d/install view={phi=120,psi=0,
theta=70}]
\draw[3d/screen coords] (O) circle[radius=R];
\path pic{3d/circle on sphere={R=R,C={(0,0,0)},n={(0,0,1)}}}
;
\path pic{3d/circle on sphere={R=R,C={(O)}}};
\path pic{3d/circle on sphere={R=R,C={(O)},P={(O)}, n={(1,-5,0)}}};
\end{scope}
\begin{scope}
\path (0,0,-4*R)
pic{3d/cone={r=R,h/.evaluated=2*R}};
\draw[3d/hidden] (N) -- (0,0,-4*R);
\end{scope}
\begin{scope}[xshift=5cm,3d/install view={phi=10,theta=70,psi=0}]
\path[3d/record physical components]
(1,0,0) coordinate (ez')
(0,1,0) coordinate (ex')
(0,0,1) coordinate (ey');
\begin{scope}[x={(ex')},y={(ey')},z={(ez')}]
\pic{3d/frustum={r=r,R=r,h=2*R}};
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}