答案1
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% \draw [help lines] (0,0) grid (10,10);
\draw (0,0) rectangle (1,4);
\draw [rotate around={-25:(1,4)}] (0,4) rectangle ({4/sin(25)+1},4+0.2);
\draw [rotate around={-25:(1,4)}] (4,4+0.2+0.5) circle (0.5);
\draw (-1,0) -- (10.3,0);
\draw [latex-latex] (-0.2,0) -- ++ (0,{4+tan(25)}) node [midway,align=left,xshift=-0.7cm]{height\\of ramp};
\draw [latex-latex] (1.1,3.7) -- ++ (-25:{8.5}) node [rotate=-25,midway,yshift=-0.3cm]{length of ramp};
\end{tikzpicture}
\end{document}
答案2
一个与基本形状有关的好东西元帖子以及“毕达哥拉斯减法”运算符......
\documentclass[border=5mm]{standalone}
\usepackage{fontspec}
\setmainfont{Helvetica}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path ground, wall, ramp, ball;
w = 21; h = 3w; r = 200; a = angle(r+-+h,-h);
ground = (left -- right) scaled 140;
wall = unitsquare xscaled w yscaled h shifted 110 left;
ramp = unitsquare xscaled (r+w) yscaled 5
shifted point 3 of wall
rotatedabout(point 2 of wall, a);
ball = fullcircle scaled 2 shifted up rotated a
scaled 10 shifted point 2.7 of ramp;
draw ground;
fill wall withcolor .7[red+1/2green,white]; draw wall;
fill ramp withcolor .7[red,white]; draw ramp;
fill ball withcolor .7[blue,white]; draw ball;
path mark[];
mark1 = (point 1 of wall -- point 1 of ramp) shifted 7 down;
drawdblarrow mark1;
draw (down--up) scaled 2 shifted point 0 of mark1;
draw (down--up) scaled 2 shifted point 1 of mark1;
label.bot("Displacement", point 0.5 of mark1);
endfig;
\end{mplibcode}
\end{document}
笔记
用 编译
lualatex
。测量单位为 PostScript 点:72 = 1 英寸,28.35 = 1 厘米
通过选择斜坡上的不同点来移动球。
一条
unitsquare
路径有四个点,从左下角按逆时针方向编号。根据需要添加更多标签。