4

How would I make the following diagram and label the values? I would prefer it if instead of a box, there were a ball rolling down the ramp and the horizontal ground displacement were labeled as well. The force arrow is not necessary. Thank you. ![Diagram

6
\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}

enter image description here

7

A nice one to do with the basic shapes in Metapost and the "Pythagorean minus" operator...

enter image description here

\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}

Notes

  • Compile with lualatex.

  • The units of measurement are PostScript points: 72 = 1in, 28.35 = 1cm

  • Move the ball by picking a different point along the ramp.

  • A unitsquare path has four points numbered anticlockwise from the lower left.

  • Add more labels as desired.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.