\input regression-test.tex
\documentclass{article}
\usepackage{tikzphysics}
\newdimen\actual
\newdimen\error
\newcommand{\assertcoord}[5]{%
 \pgfextractx{\actual}{\pgfpointanchor{#1}{#2}}\error=\actual\advance\error by-#3\relax
 \ifdim\error<0pt\error=-\error\fi
 \ifdim\error<.04pt\TYPE{PASS: #5 x}\else\TYPE{FAIL: #5 x got \the\actual}\fi
 \pgfextracty{\actual}{\pgfpointanchor{#1}{#2}}\error=\actual\advance\error by-#4\relax
 \ifdim\error<0pt\error=-\error\fi
 \ifdim\error<.04pt\TYPE{PASS: #5 y}\else\TYPE{FAIL: #5 y got \the\actual}\fi}

\newdimen\expectedx
\newdimen\expectedy
\newcommand{\sameanchor}[4]{%
 \pgfextractx{\expectedx}{\pgfpointanchor{#1}{#3}}%
 \pgfextracty{\expectedy}{\pgfpointanchor{#1}{#3}}%
 \assertcoord{#1}{#2}{\expectedx}{\expectedy}{#4}}
\begin{document}\START
\setbox0=\hbox{\begin{tikzpicture}
\node[concave-mirror,rotate=23,scale=1.3] (N0) at (0,0) {};
\node[convex-mirror,rotate=23,scale=1.3] (N1) at (1,0) {};
\node[convex-lens,rotate=23,scale=1.3] (N2) at (2,0) {};
\node[concave-lens,rotate=23,scale=1.3] (N3) at (3,0) {};
\node[slab,rotate=23,scale=1.3] (N4) at (4,0) {};
\node[prism,rotate=23,scale=1.3] (N5) at (5,0) {};
\node[convex-lens,convex lens radius=8cm] (Later) {};
\sameanchor{N0}{surface-0}{0}{shape 0 primary 0}
\sameanchor{N0}{surface-17}{17}{shape 0 primary 17}
\sameanchor{N0}{surface-50}{50}{shape 0 primary 50}
\sameanchor{N0}{surface-83}{83}{shape 0 primary 83}
\sameanchor{N0}{surface-100}{100}{shape 0 primary 100}
\sameanchor{N0}{top-50}{top}{shape 0 top midpoint}
\sameanchor{N0}{bottom-50}{bottom}{shape 0 bottom midpoint}
\sameanchor{N1}{surface-0}{0}{shape 1 primary 0}
\sameanchor{N1}{surface-17}{17}{shape 1 primary 17}
\sameanchor{N1}{surface-50}{50}{shape 1 primary 50}
\sameanchor{N1}{surface-83}{83}{shape 1 primary 83}
\sameanchor{N1}{surface-100}{100}{shape 1 primary 100}
\sameanchor{N1}{top-50}{top}{shape 1 top midpoint}
\sameanchor{N1}{bottom-50}{bottom}{shape 1 bottom midpoint}
\sameanchor{N2}{surface-0}{0}{shape 2 primary 0}
\sameanchor{N2}{surface-17}{17}{shape 2 primary 17}
\sameanchor{N2}{surface-50}{50}{shape 2 primary 50}
\sameanchor{N2}{surface-83}{83}{shape 2 primary 83}
\sameanchor{N2}{surface-100}{100}{shape 2 primary 100}
\sameanchor{N2}{top-50}{top}{shape 2 top midpoint}
\sameanchor{N2}{bottom-50}{bottom}{shape 2 bottom midpoint}
\sameanchor{N2}{top-0}{back-top}{shape 2 top endpoint 0}
\sameanchor{N2}{top-100}{front-top}{shape 2 top endpoint 100}
\sameanchor{N2}{bottom-0}{front-bottom}{shape 2 bottom endpoint 0}
\sameanchor{N2}{bottom-100}{back-bottom}{shape 2 bottom endpoint 100}
\sameanchor{N3}{surface-0}{0}{shape 3 primary 0}
\sameanchor{N3}{surface-17}{17}{shape 3 primary 17}
\sameanchor{N3}{surface-50}{50}{shape 3 primary 50}
\sameanchor{N3}{surface-83}{83}{shape 3 primary 83}
\sameanchor{N3}{surface-100}{100}{shape 3 primary 100}
\sameanchor{N3}{top-50}{top}{shape 3 top midpoint}
\sameanchor{N3}{bottom-50}{bottom}{shape 3 bottom midpoint}
\sameanchor{N3}{top-0}{back-top}{shape 3 top endpoint 0}
\sameanchor{N3}{top-100}{front-top}{shape 3 top endpoint 100}
\sameanchor{N3}{bottom-0}{front-bottom}{shape 3 bottom endpoint 0}
\sameanchor{N3}{bottom-100}{back-bottom}{shape 3 bottom endpoint 100}
\sameanchor{N4}{surface-0}{0}{shape 4 primary 0}
\sameanchor{N4}{surface-17}{17}{shape 4 primary 17}
\sameanchor{N4}{surface-50}{50}{shape 4 primary 50}
\sameanchor{N4}{surface-83}{83}{shape 4 primary 83}
\sameanchor{N4}{surface-100}{100}{shape 4 primary 100}
\sameanchor{N4}{top-50}{top}{shape 4 top midpoint}
\sameanchor{N4}{bottom-50}{bottom}{shape 4 bottom midpoint}
\sameanchor{N4}{top-0}{back-top}{shape 4 top endpoint 0}
\sameanchor{N4}{top-100}{front-top}{shape 4 top endpoint 100}
\sameanchor{N4}{bottom-0}{front-bottom}{shape 4 bottom endpoint 0}
\sameanchor{N4}{bottom-100}{back-bottom}{shape 4 bottom endpoint 100}
\sameanchor{N5}{surface-0}{0}{shape 5 primary 0}
\sameanchor{N5}{surface-17}{17}{shape 5 primary 17}
\sameanchor{N5}{surface-50}{50}{shape 5 primary 50}
\sameanchor{N5}{surface-83}{83}{shape 5 primary 83}
\sameanchor{N5}{surface-100}{100}{shape 5 primary 100}
\sameanchor{N5}{entry-0}{left-0}{prism entry 0}
\sameanchor{N5}{exit-0}{right-0}{prism exit 0}
\sameanchor{N5}{entry-17}{left-17}{prism entry 17}
\sameanchor{N5}{exit-17}{right-17}{prism exit 17}
\sameanchor{N5}{entry-50}{left-50}{prism entry 50}
\sameanchor{N5}{exit-50}{right-50}{prism exit 50}
\sameanchor{N5}{entry-100}{left-100}{prism entry 100}
\sameanchor{N5}{exit-100}{right-100}{prism exit 100}

\node[slab,minimum width=4cm,minimum height=2cm] (S) {};
\assertcoord{S}{top-25}{1cm}{1cm}{slab cap quarter direction}
\node[prism,minimum width=4cm,minimum height=2cm] (P) {};
\assertcoord{P}{entry-25}{-.5cm}{.5cm}{prism entry quarter direction}
\assertcoord{P}{exit-25}{1.5cm}{-.5cm}{prism exit quarter direction}
\end{tikzpicture}}
\END\end{document}
