%% examples/mechanics-block-pulley.tex
%%
%% Demonstrates physicsblock and physicspulley from tikzphysics.mechanics,
%% composed with a physicswedge from tikzphysics.surface.  A classic
%% inclined-plane-with-pulley setup.

\documentclass[tikz, border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{tikzphysics.surface, tikzphysics.mechanics}

\begin{document}

\begin{tikzpicture}
  %% wedge (inclined plane)
  \node[physicswedge,
        physics wedge angle=30,
        physics wedge width=6]
    (W) at (0,0) {};

  %% block sitting on the slope, at the mid-point of the hypotenuse
  \node[physicsblock,
        physics block width=1,
        physics block height=1,
        rotate=30,
        anchor=south]
    (B) at (W.slope-mid) {$m$};

  %% Put the pulley just beyond the right end of the slope. Its centre is
  %% offset normally by half the block height minus the pulley radius
  %% (0.5 - 0.3 cm), so the parallel string touches the upper rim.
  \coordinate (pulley-center) at ($(W.top)+(30:0.5)+(120:0.2)$);
  \node[physicspulley,
        physics pulley diameter=0.6]
    (P) at (pulley-center) {};

  %% hanging block on the other side
  \node[physicsblock,
        physics block width=0.8,
        physics block height=0.8]
    (H) at ($(P.east)+(0,-2.5)$) {$M$};

  %% One physical string: both straight portions are computed tangents,
  %% joined by the exact circular contact arc around the pulley.
  \physicsstringoverpulley{B.east}{P}{H.north}
\end{tikzpicture}

\end{document}
