\input regression-test.tex
\documentclass{article}
\usepackage{tikzphysics}

\newdimen\tikzphysicssolidtestx
\newdimen\tikzphysicssolidtesty
\newdimen\tikzphysicssolidexpected
\newdimen\tikzphysicssoliddiff

\newcommand{\solidpoint}[2]{%
  \pgfextractx{\tikzphysicssolidtestx}{\pgfpointanchor{#1}{#2}}%
  \pgfextracty{\tikzphysicssolidtesty}{\pgfpointanchor{#1}{#2}}%
}
\newcommand{\solidassertdim}[3]{%
  \tikzphysicssolidexpected=#2\relax
  \tikzphysicssoliddiff=#1\relax
  \advance\tikzphysicssoliddiff by -\tikzphysicssolidexpected
  \ifdim\tikzphysicssoliddiff<0pt \tikzphysicssoliddiff=-\tikzphysicssoliddiff\fi
  \ifdim\tikzphysicssoliddiff<0.04pt
    \TYPE{PASS: #3}%
  \else
    \TYPE{FAIL: #3 (got \the#1, expected \the\tikzphysicssolidexpected)}%
  \fi
}
\newcommand{\solidassertpoint}[5]{%
  \solidpoint{#1}{#2}%
  \tikzphysicssolidexpected=\tikzphysicssolidtestx
  \solidpoint{#3}{#4}%
  \solidassertdim{\tikzphysicssolidexpected}{\tikzphysicssolidtestx}{#5 x}%
}

\begin{document}
\START

\setbox3=\hbox{\begin{tikzpicture}
  \node[rectangular element,element width=8mm,element height=6mm] (A) {};
  \solidassertdim{\geometryvalue{A}{width}}{8mm}{rectangular element width}
  \solidassertdim{\geometryvalue{A}{height}}{6mm}{rectangular element height}
  \solidassertpoint{A}{bottom-0}{A}{south west}{rectangle bottom family starts at south west}
  \solidassertpoint{A}{top-100}{A}{north west}{rectangle top family ends at north west}

  \node[rectangular strip] (B) at (0,-2) {};
  \solidassertdim{\geometryvalue{B}{width}}{4cm}{rectangular strip default width}
  \solidassertdim{\geometryvalue{B}{height}}{2mm}{rectangular strip default thickness}

  \node[spherical shell,element inner radius=1cm,
    element radial thickness=1.5mm] (S) at (5,0) {};
  \solidassertdim{\geometryvalue{S}{outer radius}}{1.15cm}{spherical shell outer radius}
  \solidassertdim{\geometryvalue{S}{radial thickness}}{1.5mm}{spherical shell thickness}

  \node[hollow sphere,element inner radius=9mm,
    element outer radius=2cm] (H) at (9,0) {};
  \solidassertdim{\geometryvalue{H}{inner radius}}{9mm}{hollow sphere cavity radius}
  \solidassertdim{\geometryvalue{H}{outer radius}}{2cm}{hollow sphere body radius}
\end{tikzpicture}}

\setbox0=\hbox{\begin{tikzpicture}
  \pic (SS) {sphere shell diagram};
  \solidpoint{SS-shell}{center}
  \solidassertdim{\tikzphysicssolidtestx}{0pt}{sphere shell component centre x}
  \pic (SX) at (5,0) {sphere slice diagram};
  \solidpoint{SX-slice}{center}
  \solidassertdim{\tikzphysicssolidtestx}{5.7cm}{sphere slice normalized position}
  \pic (HS) at (10,0) {hollow sphere diagram};
  \solidassertdim{\geometryvalue{HS-wall}{inner radius}}{9mm}{hollow sphere diagram wall node}
\end{tikzpicture}}

\setbox1=\hbox{\begin{tikzpicture}
  \pic (CS) {cylinder shell diagram};
  \solidpoint{CS-shell}{center}
  \solidassertdim{\tikzphysicssolidtestx}{0pt}{cylinder shell component centre x}
  \pic (CX) at (5,0) {cylinder slice diagram};
  \solidpoint{CX-slice}{center}
  \solidassertdim{\tikzphysicssolidtesty}{1.7mm}{cylinder slice normalized position}
  \pic (KX) at (10,0) {cone slice diagram};
  \solidpoint{KX-slice}{center}
  \solidassertdim{\tikzphysicssolidtesty}{-4.2mm}{cone slice midpoint position}
  \solidpoint{KX-slice}{north}
  \solidassertdim{\tikzphysicssolidtesty}{-3.2mm}{cone slice top face position}
  \solidpoint{KX-slice}{south}
  \solidassertdim{\tikzphysicssolidtesty}{-5.2mm}{cone slice bottom face position}
\end{tikzpicture}}

\setbox2=\hbox{\begin{tikzpicture}
  \pic (AE) {sheet element diagram};
  \solidpoint{AE-element}{center}
  \solidassertdim{\tikzphysicssolidtestx}{3.36mm}{sheet element x position}
  \solidassertdim{\tikzphysicssolidtesty}{1.92mm}{sheet element y position}
  \node[rectangular element,show anchors,show keys,
    physics debug/anchor list={center,north east,south west}] (Debug) at (7,0) {};
  \physicshelp[at={(12,0)}]{cylinder slice diagram}
\end{tikzpicture}}
\TYPE{PASS: solid-element debug overlays and reference card compile}

\END
\end{document}
