%% examples/mechanics-block-pulley.tex
%%
%% Demonstrates block and pulley from tikzphysics.mechanics,
%% composed with a wedge 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[wedge,
        wedge angle=30,
        wedge width=6]
    (W) at (0,0) {};

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

  %% The pulley centre is exactly the wedge top. The default 1cm pulley
  %% diameter matches the 1cm block height, so B.east is one radius above the
  %% slope and the approaching tangent is exactly parallel to the incline.
  \node[pulley] (P) at (W.top) {};

  %% hanging block on the other side
  \node[block,
        block width=0.8,
        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}
