如果您觉得这个问题更多的是关于绘画而不是技术问题,我提前向您表示歉意。
我相信我已经完成了大部分工作,除了子弹。子弹有一个圆形的尖端,我发现很难画出来。红线是我想要与尖端连接的子弹侧面。
有人能建议从这里出发该怎么做吗?
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{arrows}
\usepackage{mathtools}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\tikzset{cross/.style={cross out, draw=black, fill=none, minimum size=5*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt}, cross/.default={2pt}}
\text{}\\
\begin{tikzpicture}[x=0.5cm,y=0.5cm,z=0.3cm,>=stealth,scale=0.8]
% The axes
\draw[ultra thick,->] (xyz cs:x=-18.5,y=+2) -- (xyz cs:x=18.5,y=-2);
\draw[ultra thick,->] (xyz cs:y=-18.5) -- (xyz cs:y=18.5);
%\draw[ultra thick,dashed,->] (xyz cs:x=13,z=+10.5) -- (xyz cs:x=-13,z=-10.5);
\draw[ultra thick,dashed,opacity=0.4] (xyz cs:x=0,z=0) -- (xyz cs:x=9.2,z=+7.3);
\draw[ultra thick,dashed] (xyz cs:x=9.2,z=7.3) -- (xyz cs:x=13,z=+10.5);
\draw[ultra thick,dashed,->] (xyz cs:x=0,z=0) -- (xyz cs:x=-13,z=-10.5);
%%
%rectangle
\draw[draw=none,ultra thick,fill=gray!50,opacity=0.5]
(xyz cs:x=-12,y=+12)
-- (xyz cs:x=+12,y=9.5)
-- (xyz cs:x=+12,y=-12.5)
-- (xyz cs:x=-12,y=-10)
-- (xyz cs:x=-12,y=+12);
%
%Thickness of the sample
\draw[draw=none,ultra thick,fill=gray!50,opacity=0.3]
(xyz cs:x=-12,y=+12)
-- (xyz cs:x=-10.5,y=12.5)
-- (xyz cs:x=+13.5-0.25,y=10)
-- (xyz cs:x=+12,y=9.5)
%-- (xyz cs:x=-12,y=+12)
;
%
\draw[draw=none,ultra thick,fill=gray!90,opacity=0.5]
%(xyz cs:x=12,y=9.5)
(xyz cs:x=+13.5-0.05,y=+10+0.02)
-- (xyz cs:x=+13.5-0.051,y=-12)
%-- (xyz cs:x=+12.5,y=+9.5-22+0.5)
-- (xyz cs:x=+12,y=-12.5)
-- (xyz cs:x=+12,y=9.5)
;
%\draw[fill=black](xyz cs:x=0,y=0,z=0) circle (3pt);
%draw a cross
\draw[ultra thick] (xyz cs:x=-0.75,y=+0.75) -- (xyz cs:x=+0.75,y=-0.75);
\draw[ultra thick] (xyz cs:x=-0.75,y=-0.75) -- (xyz cs:x=+0.75,y=+0.75);
%
%Labels
\node [below,scale=2] at (xyz cs:x=+1.5,y=-1) {$O$};
\node [below,scale=2] at (xyz cs:x=+18,y=-2.3) {$x$};
\node [above,scale=2] at (xyz cs:y=+18.5) {$y$};
\node [below,scale=2] at (xyz cs:z=-11,x=-12) {$z$};
%
\node [below,scale=2] at (xyz cs:x=-30,z=27) {\text{Sample}};
%
%Bullet
\draw[draw=none,fill=gray!50,opacity=0.5] (xyz cs:x=-14,y=-4.5) circle [x radius=5.5mm, y radius=7mm];
\draw[red] (xyz cs:x=-14,y=-3.12) -- (xyz cs:x=-11,y=-2.12);
\draw[red] (xyz cs:x=-14,y=-3.12-2.8) -- (xyz cs:x=-9.5,y=-4.49);
%\draw[blue] (xyz cs:x=-11,y=-2.12) parabola (xyz cs:x=-9.5,y=-4.49);
\end{tikzpicture}
\end{document}
谢谢你!
答案1
这里有一个建议。我把你的图片翻译成了,在tikz-3dplots
我看来,这样画这些东西就容易多了。特别是,你可以免费获得正交投影。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,shadings,calc,arrows.meta}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
\makeatletter
\tikzoption{canvas is xy plane at z}[]{%
\def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
\def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
\def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
\tikz@canvas@is@plane}
\makeatother
\begin{document}
\tdplotsetmaincoords{70}{-230}
\tdplotsetrotatedcoords{0}{90}{90}
\tikzset{cross/.style={cross out, draw=black, fill=none, minimum size=5*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt}, cross/.default={2pt}}
\begin{tikzpicture}[font=\sffamily]
\begin{scope}[tdplot_rotated_coords,>=stealth,scale=0.6,local bounding box=3d]
% z axis in background
\draw[ultra thick,dotted] (0,0,-24) -- (0,0,0) coordinate (O);
%rectangle
\fill[gray!50,opacity=0.5]
(12,12,0) coordinate(tr) --
(12,-12,0) coordinate(br) --
(-12,-12,0) coordinate(bl) --
(-12,12,0) coordinate(tl) -- cycle;
\fill[gray!90,opacity=0.5]
(tr) -- ++(0,0,-2) -- ++(0,-24,0) -- (br) -- cycle;
\fill[gray!50,opacity=0.3]
(tr) -- ++(0,0,-2) -- ++(-24,0,0) -- (tl) -- cycle;
% The axes
\draw[ultra thick,->] (-18.5,0,0) -- (18.5,0,0) node[below,scale=2]{$x$};
\draw[ultra thick,->] (xyz cs:y=-18.5) -- (xyz cs:y=18.5) node[above,scale=2]{$y$};
\draw[ultra thick,dotted,->] (0,0,0) --(0,0,10);
%draw a cross
\draw[ultra thick] (xyz cs:x=-0.75,y=+0.75) -- (xyz cs:x=+0.75,y=-0.75);
\draw[ultra thick] (xyz cs:x=-0.75,y=-0.75) -- (xyz cs:x=+0.75,y=+0.75);
%
%Labels
\node [below,scale=2] at (xyz cs:x=+1.5,y=-1) {$O$};
%
%Bullet
\begin{scope}[canvas is xy plane at z=10]
\coordinate (c1) at (120:1);
\coordinate (c2) at (-60:1);
\end{scope}
\begin{scope}[canvas is xy plane at z=16]
\fill[gray!50,opacity=0.5] circle (1);
\coordinate (b1) at (120:1);
\coordinate (b2) at (-60:1);
\coordinate (z0) at (0,0);
\shade let \p1=($(c1)-(b1)$),\n1={atan2(\y1,\x1)} in
[top color=black!60,bottom color=black,middle color=gray!30,
shading angle=\n1] (b1) -- (c1) to[out=30,in=30,looseness=3] (c2) -- (b2)
arc(-60:120:1);
\end{scope}
\draw[ultra thick,dotted,->] (z0) -- (0,0,24) node[below,scale=2]{$z$};
\coordinate (a1) at (-8,8,0);
\end{scope}
\begin{scope}[every node/.append style={scale=2},shorten >=2mm]
\node[anchor=north west] (sample) at (3d.north west) {sample};
\node[anchor=south west] (bullet) at (3d.south west) {bullet};
\node[anchor=south east] (origin) at (3d.south east) {origin};
\draw [-{Stealth[length=2mm]}] (sample)-- (a1);
\draw [-{Stealth[length=2mm]}] (bullet)-- (z0);
\draw [-{Stealth[length=2mm]}] (origin)-- (O);
\end{scope}
\end{tikzpicture}
\end{document}
我差点忘记了动画。(一些细节也发生了变化,子弹有点透明等等。)
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,shadings,calc,arrows.meta}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
\makeatletter
\tikzoption{canvas is xy plane at z}[]{%
\def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
\def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
\def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
\tikz@canvas@is@plane}
\makeatother
\begin{document}
\foreach \X in {0,...,18}
{
\pgfmathsetmacro{\zbullet}{1+18-\X}
\tdplotsetmaincoords{70}{-250+2*\X}
\tdplotsetrotatedcoords{0}{90}{90}
\begin{tikzpicture}[font=\sffamily]
\draw (-15,-12) rectangle (15,12);
\begin{scope}[tdplot_rotated_coords,>=stealth,scale=0.6,local bounding box=3d]
% z axis in background
\draw[ultra thick,dotted] (0,0,-24) -- (0,0,0) coordinate (O);
%rectangle
\fill[gray!50,opacity=0.5]
(12,12,0) coordinate(tr) --
(12,-12,0) coordinate(br) --
(-12,-12,0) coordinate(bl) --
(-12,12,0) coordinate(tl) -- cycle;
\fill[gray!90,opacity=0.5]
(tr) -- ++(0,0,-2) -- ++(0,-24,0) -- (br) -- cycle;
\fill[gray!50,opacity=0.3]
(tr) -- ++(0,0,-2) -- ++(-24,0,0) -- (tl) -- cycle;
% The axes
\draw[ultra thick,->] (-18.5,0,0) -- (18.5,0,0) node[below,scale=2]{$x$};
\draw[ultra thick,->] (0,-18.5,0) -- (0,18.5,0) node[above,scale=2]{$y$};
\draw[ultra thick,dotted] (O) --(0,0,\zbullet+6);
%draw a cross
\begin{scope}[canvas is xy plane at z=0]
\draw[ultra thick] (-0.75,0.75) -- (0.75,-0.75);
\draw[ultra thick] (-0.75,-0.75) -- (0.75,0.75);
\end{scope}
%
%Labels
\node [below,scale=2] at (xyz cs:x=+1.5,y=-1) {$O$};
%
%Bullet
\begin{scope}[canvas is xy plane at z=\zbullet]
\coordinate (c1) at (120:1);
\coordinate (c2) at (-60:1);
\end{scope}
\begin{scope}[canvas is xy plane at z=\zbullet+6,opacity=0.8]
\fill[gray!50] circle (1);
\coordinate (b1) at (120:1);
\coordinate (b2) at (-60:1);
\coordinate (z0) at (0,0);
\shade let \p1=($(c1)-(b1)$),\n1={atan2(\y1,\x1)} in
[top color=black!60,bottom color=black,middle color=gray!30,
shading angle=\n1] (b1) -- (c1) to[out=\n1,in=\n1,looseness=3] (c2) -- (b2)
arc(-60:120:1);
\end{scope}
\draw[ultra thick,dotted,->] (z0) -- (0,0,30) node[below,scale=2]{$z$};
\coordinate (a1) at (-8,8,0);
\end{scope}
\begin{scope}[every node/.append style={scale=2},shorten >=2mm]
\node[anchor=north west] (sample) at (3d.north west) {sample};
\node[anchor=south west] (bullet) at (3d.south west) {bullet};
\node[anchor=south east] (origin) at (3d.south east) {origin};
\draw [-{Stealth[length=2mm]}] (sample)-- (a1);
\draw [-{Stealth[length=2mm]}] (bullet)-- (z0);
\draw [-{Stealth[length=2mm]}] (origin)-- (O);
\end{scope}
\end{tikzpicture}
}
\end{document}