# Spring nodes and two-point paths Use the same `spring` style in either drawing API. Both forms use TikZ's coil decoration and share `pre length`, `post length`, `amplitude`, `segment length`, `aspect`, and the `every spring` hook. ## Connect two attachment points ```latex \draw[spring,pre length=3mm,post length=5mm] (A) -- node[midway,above=3mm] {$k$} (B.west); ``` The endpoints determine the spring's total length and direction. This is convenient when the two bodies are already positioned. The path has no private node anchors; name its endpoint coordinates if needed. ## Position a named spring ```latex \node[spring,minimum width=3cm,rotate=30,anchor=start] (S) at (A) {}; \node[block,anchor=west] (B) at (S.end) {$m$}; ``` The default node is horizontal and 3 cm long, centred at its placement coordinate. `spring length` is a unit-aware alias of `minimum width`; `rotate` rotates both the coil and its anchors. Use `anchor=start` when placing it at its first attachment. Native TikZ transformations and styles work as usual. The collision-safe `physicsspring` and `physics spring` spellings support both forms too. | Node anchor | Meaning | | --- | --- | | `start`, `end` | Exact axis attachment points, excluding outer separation | | `center` | Midpoint of the complete spring axis | | `coil-start`, `coil-end` | Axis positions after the first lead and before the last lead | | `axis-0..100` | Integer percentages along the full straight axis; 0=start, 50=center, 100=end | | Compass anchors | Coil envelope, enlarged by `minimum height` and outer separation | `axis-*` samples the axis, not the helical wire. `minimum height` reserves space without changing coil amplitude. Both lead lengths may be zero; their sum must be smaller than the node's length. Amplitude and segment length must be positive. Set labels above or below the node to keep them off the coil. Prefer `start` and `end` for physical connections. ## Inspect anchors and keys ```latex \node[spring,minimum width=4cm,show anchors,show keys, physics debug/anchor families={axis}, physics debug/anchor samples={0,25,50,75,100}] (S) {}; ``` The numbered marker table and key card also work on unnamed and rotated spring nodes. `show keys` lists documented defaults, not the applied node values. For either API, use `\physicshelp{spring}` inside a `tikzpicture`. Debug overlays stay off in finished diagrams. The [four-page visual gallery](spring-node-path.pdf) compares horizontal, vertical, and inclined paths with nodes, shows both debug panels, and connects a spring node directly to a wall and block. Its [copy-ready source](../examples/spring-node-path.tex) compiles with: ```sh pdflatex -interaction=nonstopmode -halt-on-error -output-directory=output/pdf \ examples/spring-node-path.tex ```