\input regression-test.tex \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzphysics} \newdimen\tikzphysicstestx \newdimen\tikzphysicstesty \newdimen\tikzphysicstestxx \newdimen\tikzphysicstestyy \newdimen\tikzphysicstestdiff \newdimen\tikzphysicstestexpected \newcommand{\tikzphysicsgetpoint}[2]{% \pgfextractx{\tikzphysicstestx}{\pgfpointanchor{#1}{#2}}% \pgfextracty{\tikzphysicstesty}{\pgfpointanchor{#1}{#2}}% } \newcommand{\tikzphysicsassertdim}[3]{% \tikzphysicstestexpected=#2\relax \tikzphysicstestdiff=#1\relax \advance\tikzphysicstestdiff by -\tikzphysicstestexpected\relax \ifdim\tikzphysicstestdiff<0pt \tikzphysicstestdiff=-\tikzphysicstestdiff\fi \ifdim\tikzphysicstestdiff<0.02pt \TYPE{PASS: #3}% \else \TYPE{FAIL: #3 (got \the#1, expected \the\tikzphysicstestexpected)}% \fi } \newcommand{\tikzphysicsassertpoint}[5]{% \tikzphysicsgetpoint{#1}{#2}% \tikzphysicstestxx=\tikzphysicstestx \tikzphysicstestyy=\tikzphysicstesty \tikzphysicsgetpoint{#3}{#4}% \tikzphysicsassertdim{\tikzphysicstestxx}{\tikzphysicstestx}{#5 x}% \tikzphysicsassertdim{\tikzphysicstestyy}{\tikzphysicstesty}{#5 y}% } \newcommand{\tikzphysicsassertnumber}[3]{% \pgfmathparse{abs((#1)-(#2))}% \ifdim\pgfmathresult pt<0.001pt \TYPE{PASS: #3}% \else \TYPE{FAIL: #3 (difference \pgfmathresult)}% \fi } \begin{document} \START \begin{tikzpicture} \node[physicsplatform-left, physics platform width=5, physics platform depth=2, physics wall angle=-90, anchor=surface-0] (Ldown) at (0,0) {}; \node[physicsplatform-left, physics platform width=5, physics platform depth=2, physics wall angle=45, anchor=surface-0] (Lup) at (0,0) {}; \node[physicsplatform-right, physics platform width=5, physics platform depth=2, physics wall angle=-90, anchor=surface-100] (Rdown) at (0,0) {}; \node[physicsplatform-left, physics platform width=5, physics platform depth=2, physics strip width=0.3, physics wall angle=135, anchor=surface-0] (Lmiter) at (0,0) {}; \node[physicsplatform-right, physics platform width=5, physics platform depth=2, physics strip width=0.3, physics wall angle=45, anchor=surface-100] (Rmiter) at (0,0) {}; \node[platform-left, anchor=surface-0] (DefaultStrip) at (0,0) {}; \tikzphysicsassertpoint{Ldown}{pulley-center}{Ldown}{surface-0}{left corner at -90 degrees} \tikzphysicsassertpoint{Lup}{pulley-center}{Lup}{surface-0}{left corner at 45 degrees} \tikzphysicsassertpoint{Rdown}{pulley-center}{Rdown}{surface-100}{right corner at -90 degrees} \tikzphysicsassertpoint{Ldown}{wall-surface-0}{Ldown}{surface-0}{default left wall A equals floor top-left} \tikzphysicsassertpoint{Lup}{wall-surface-0}{Lup}{surface-0}{bent left wall stays continuous at corner} \tikzphysicsgetpoint{Ldown}{wall-surface-100} \tikzphysicsassertdim{\tikzphysicstestx}{0pt}{default left wall D x} \tikzphysicsassertdim{\tikzphysicstesty}{-2cm}{default left wall spans platform depth} \tikzphysicsgetpoint{Lmiter}{wall-back-0} \tikzphysicsassertdim{\tikzphysicstestx}{-0.124264cm}{left wall B is exact 135-degree miter} \tikzphysicsassertdim{\tikzphysicstesty}{-0.3cm}{left miter meets floor inner edge} \tikzphysicsgetpoint{Rmiter}{wall-back-0} \tikzphysicsassertdim{\tikzphysicstestx}{0.124264cm}{right wall B is exact 45-degree miter} \tikzphysicsassertdim{\tikzphysicstesty}{-0.3cm}{right miter meets floor inner edge} \tikzphysicsgetpoint{DefaultStrip}{bottom-0} \tikzphysicsassertdim{\tikzphysicstesty}{-0.25cm}{default platform strip width is 0.25cm} \tikzphysicsassertpoint{Ldown}{surface-50}{Ldown}{surface}{platform surface midpoint} \tikzphysicsassertpoint{Ldown}{bottom-0}{Ldown}{left-0}{platform bottom-left corner} \tikzphysicsassertpoint{Ldown}{bottom-100}{Ldown}{right-0}{platform bottom-right corner} \tikzphysicsassertpoint{Ldown}{surface-0}{Ldown}{left-100}{platform top-left corner} \tikzphysicsassertpoint{Ldown}{surface-100}{Ldown}{right-100}{platform top-right corner} \tikzphysicsgetpoint{Ldown}{surface-25} \tikzphysicsassertdim{\tikzphysicstestx}{1.25cm}{platform surface-25 increases left to right} \tikzphysicsassertpoint{Lup}{wall-surface-0}{Lup}{wall-root}{wall contact starts at root} \tikzphysicsassertpoint{Lup}{wall-surface-0}{Lup}{wall-base-0}{wall outer root corner} \tikzphysicsassertpoint{Lup}{wall-back-0}{Lup}{wall-base-100}{wall inner root corner} \tikzphysicsassertpoint{Lup}{wall-surface-100}{Lup}{wall-tip-0}{wall outer tip corner} \tikzphysicsassertpoint{Lup}{wall-back-100}{Lup}{wall-tip-100}{wall inner tip corner} \tikzphysicsgetpoint{Ldown}{wall-surface-50} \tikzphysicsassertdim{\tikzphysicstesty}{-1cm}{wall contact midpoint} \end{tikzpicture} \begin{tikzpicture} \node[platform-left, pulley edge, platform width=5, platform depth=2, anchor=surface-0] (LInset) at (0,0) {}; \node[platform-right, pulley edge, platform width=5, platform depth=2, anchor=surface-100] (RInset) at (0,0) {}; \tikzphysicsassertpoint{LInset}{pulley-center}{LInset}{surface-0} {left pulley centre stays at projecting floor tip} \tikzphysicsassertpoint{RInset}{pulley-center}{RInset}{surface-100} {right pulley centre stays at projecting floor tip} \tikzphysicsgetpoint{LInset}{wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{0.5cm}{left preset wall inset} \tikzphysicsassertdim{\tikzphysicstesty}{-0.5cm}{left preset wall drop} \tikzphysicsgetpoint{LInset}{wall-back-0} \tikzphysicsassertdim{\tikzphysicstestx}{0.75cm}{left inset inner miter x} \tikzphysicsassertdim{\tikzphysicstesty}{-0.25cm}{left inset inner miter y} \tikzphysicsgetpoint{RInset}{wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{-0.5cm}{right preset wall inset} \tikzphysicsassertdim{\tikzphysicstesty}{-0.5cm}{right preset wall drop} \tikzphysicsgetpoint{RInset}{wall-back-0} \tikzphysicsassertdim{\tikzphysicstestx}{-0.75cm}{right inset inner miter x} \tikzphysicsassertdim{\tikzphysicstesty}{-0.25cm}{right inset inner miter y} \tikzphysicsassertpoint{LInset}{transition-0}{LInset}{pulley-center} {left transition starts at pulley centre} \tikzphysicsassertpoint{LInset}{transition-100}{LInset}{wall-root} {left transition ends at wall root} \tikzphysicsassertpoint{RInset}{transition-0}{RInset}{pulley-center} {right transition starts at pulley centre} \tikzphysicsassertpoint{RInset}{transition-100}{RInset}{wall-root} {right transition ends at wall root} \node[platform, platform width=5, platform depth=2, left wall inset=0.4, left wall drop=0.3, right wall inset=0.7, right wall drop=0.2, anchor=surface] (BothInset) at (0,-4) {}; \tikzphysicsgetpoint{BothInset}{left-wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{-2.1cm}{independent left wall inset} \tikzphysicsassertdim{\tikzphysicstesty}{-4.3cm}{independent left wall drop} \tikzphysicsgetpoint{BothInset}{right-wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{1.8cm}{independent right wall inset} \tikzphysicsassertdim{\tikzphysicstesty}{-4.2cm}{independent right wall drop} \tikzphysicsassertpoint{BothInset}{left-pulley-center}{BothInset}{surface-0} {both platform left pulley centre} \tikzphysicsassertpoint{BothInset}{right-pulley-center}{BothInset}{surface-100} {both platform right pulley centre} \tikzphysicsassertpoint{BothInset}{left-wall-surface-0}{BothInset}{left-wall-root} {left wall contact starts at root} \tikzphysicsassertpoint{BothInset}{right-wall-surface-0}{BothInset}{right-wall-root} {right wall contact starts at root} \tikzphysicsassertpoint{BothInset}{left-wall-surface-100}{BothInset}{left-wall-tip-0} {left wall outer tip corner} \tikzphysicsassertpoint{BothInset}{right-wall-back-100}{BothInset}{right-wall-tip-100} {right wall inner tip corner} \tikzphysicsassertpoint{BothInset}{left-transition-100}{BothInset}{left-wall-root} {both platform left transition endpoint} \tikzphysicsassertpoint{BothInset}{right-transition-100}{BothInset}{right-wall-root} {both platform right transition endpoint} \node[platform, pulley edges, platform width=5, platform depth=2, anchor=surface] (BothPreset) at (0,-8) {}; \tikzphysicsgetpoint{BothPreset}{left-wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{-2cm}{both preset left wall inset} \tikzphysicsassertdim{\tikzphysicstesty}{-8.5cm}{both preset left wall drop} \tikzphysicsgetpoint{BothPreset}{right-wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{2cm}{both preset right wall inset} \tikzphysicsassertdim{\tikzphysicstesty}{-8.5cm}{both preset right wall drop} \end{tikzpicture} \begin{tikzpicture} \node[physicswedge, physics wedge width=4, physics wedge angle=30, anchor=bl] (W) at (0,0) {}; \tikzphysicsassertpoint{W}{base-0}{W}{bl}{wedge base-0 endpoint} \tikzphysicsassertpoint{W}{base-100}{W}{br}{wedge base-100 endpoint} \tikzphysicsassertpoint{W}{slope-0}{W}{top}{wedge slope-0 endpoint} \tikzphysicsassertpoint{W}{slope-100}{W}{bl}{wedge slope-100 endpoint} \tikzphysicsassertpoint{W}{right-mid}{W}{right-50}{wedge right midpoint follows boundary} \tikzphysicsassertpoint{W}{slope-mid}{W}{surface-50}{wedge slope midpoint follows contact face} \tikzphysicsgetpoint{W}{centroid} \tikzphysicsassertdim{\tikzphysicstestx}{2.6667cm}{plain wedge retains triangle centroid x} \tikzphysicsassertdim{\tikzphysicstesty}{0.7698cm}{plain wedge retains triangle centroid y} \node[wedge, wedge width=4, wedge angle=40, wedge right angle at=bl] (WBL) at (0,-4) {}; \node[wedge, wedge width=4, wedge angle=25, wedge right angle at=top] (WTOP) at (0,-8) {}; \tikzphysicsassertpoint{WBL}{right-mid}{WBL}{right-50}{left-mode right midpoint follows boundary} \tikzphysicsassertpoint{WBL}{slope-mid}{WBL}{surface-50}{left-mode slope midpoint follows contact face} \tikzphysicsassertpoint{WTOP}{right-mid}{WTOP}{right-50}{top-mode right midpoint is on boundary} \tikzphysicsassertpoint{WTOP}{slope-mid}{WTOP}{surface-50}{top-mode left slope midpoint follows contact face} \tikzphysicsassertpoint{WTOP}{slope-right-mid}{WTOP}{right-surface-50}{top-mode right slope midpoint follows contact face} \node[block, rotate=\geometryvalue{W}{slope angle}] at (W.slope-mid) {}; \tikzphysicsassertnumber{\geometryvalue{W}{left angle}}{30} {named wedge retains left interior angle} \tikzphysicsassertnumber{\geometryvalue{W}{right angle}}{90} {named wedge reports right interior angle} \tikzphysicsassertnumber{\geometryvalue{W}{top angle}}{60} {named wedge reports top interior angle} \tikzphysicsassertnumber{\geometryvalue{W}{slope angle}}{30} {named wedge slope angle is directly usable by rotate} \tikzphysicsassertnumber{\geometryvalue{WBL}{left angle}}{90} {bottom-left mode reports its right angle} \tikzphysicsassertnumber{\geometryvalue{WBL}{right angle}}{40} {bottom-left mode reports opposite base angle} \tikzphysicsassertnumber{\geometryvalue{WBL}{right edge direction}}{140} {bottom-left mode reports rising right-edge direction} \tikzphysicsassertnumber{\geometryvalue{WBL}{left edge direction}}{90} {bottom-left mode reports its vertical left edge} \tikzphysicsassertnumber{\geometryvalue{WBL}{slope angle}}{-40} {bottom-left mode reports the slope-mid placement angle} \tikzphysicsassertnumber{\geometryvalue{WTOP}{left angle}}{25} {top mode reports left base angle} \tikzphysicsassertnumber{\geometryvalue{WTOP}{right angle}}{65} {top mode reports right base angle} \tikzphysicsassertnumber{\geometryvalue{WTOP}{top angle}}{90} {top mode reports apex right angle} \tikzphysicsassertnumber{\geometryvalue{WTOP}{slope angle}}{25} {top mode reports the slope-mid placement angle} \tikzphysicsassertnumber{\geometryvalue{WTOP}{right slope angle}}{-65} {top mode reports the slope-right-mid placement angle} \tikzphysicsassertnumber{\tikzphysicsgeometryvalue{WTOP}{right edge angle}}{115} {collision-safe accessor reports right-edge direction} \tikzphysicsassertdim{\geometryvalue{W}{width}}{4cm} {named wedge reports resolved width} \pgfmathsetlength{\tikzphysicstestexpected}{4cm*tan(30)} \tikzphysicsassertdim{\geometryvalue{W}{height}}{\tikzphysicstestexpected} {named wedge reports resolved height} \edef\tikzphysicstestmode{\geometryvalue{WTOP}{right angle at}} \def\tikzphysicstestexpectedmode{top} \ifx\tikzphysicstestmode\tikzphysicstestexpectedmode \TYPE{PASS: named wedge reports right-angle vertex}% \else \TYPE{FAIL: named wedge reports wrong right-angle vertex}% \fi \end{tikzpicture} \setbox0=\hbox{\begin{tikzpicture} \node[wedge,pulley edge,wedge width=7,wedge angle=30,anchor=bl] (WEdge) at (0,0) {}; \tikzphysicsassertpoint{WEdge}{pulley-center}{WEdge}{top} {wedge pulley centre remains at top} \tikzphysicsgetpoint{WEdge}{br} \tikzphysicsassertdim{\tikzphysicstestx}{6.5cm} {wedge pulley edge moves base corner inward} \tikzphysicsgetpoint{WEdge}{wall-root} \tikzphysicsassertdim{\tikzphysicstestx}{6.5cm} {wedge preset top inset} \pgfmathsetlength{\tikzphysicstestexpected}{7cm*tan(30)-1cm} \tikzphysicsassertdim{\tikzphysicstesty}{\tikzphysicstestexpected} {wedge preset top drop} \tikzphysicsassertpoint{WEdge}{transition-0}{WEdge}{pulley-center} {wedge transition starts at pulley centre} \tikzphysicsassertpoint{WEdge}{transition-100}{WEdge}{wall-root} {wedge transition ends at wall root} \tikzphysicsassertdim{\geometryvalue{WEdge}{top inset}}{0.5cm} {named wedge reports pulley-edge inset} \tikzphysicsassertdim{\geometryvalue{WEdge}{top drop}}{1cm} {named wedge reports pulley-edge drop} \tikzphysicsassertnumber{\geometryvalue{WEdge}{top angle}}{33.434949} {named wedge reports visible pulley-tip angle} \tikzphysicsassertnumber{\geometryvalue{WEdge}{wall root angle}}{206.565051} {named wedge reports reflex wall-root angle} \tikzphysicsassertpoint{WEdge}{right-0}{WEdge}{br} {wedge right boundary starts at shifted base corner} \tikzphysicsassertpoint{WEdge}{right-100}{WEdge}{top} {wedge right boundary ends at top} \tikzphysicsgetpoint{WEdge}{right-50} \tikzphysicsassertdim{\tikzphysicstestx}{6.5cm} {wedge right boundary midpoint follows vertical wall} \tikzphysicsassertpoint{WEdge}{right-mid}{WEdge}{right-50} {wedge pulley-edge right midpoint follows full boundary} \tikzphysicsassertpoint{WEdge}{slope-mid}{WEdge}{surface-50} {wedge pulley-edge slope midpoint follows incline} \tikzphysicsgetpoint{WEdge}{centroid} \tikzphysicsassertdim{\tikzphysicstestx}{4.3669cm} {wedge pulley-edge centroid follows filled polygon x} \tikzphysicsassertdim{\tikzphysicstesty}{1.2849cm} {wedge pulley-edge centroid follows filled polygon y} \tikzphysicsassertpoint{WEdge}{mid}{WEdge}{centroid} {wedge mid follows area centroid} \end{tikzpicture}} \setbox0=\hbox{\begin{tikzpicture} \node[wedge,pulley edge,wedge width=7,wedge angle=30, wedge right angle at=bl,anchor=br] (WEdgeLeft) at (0,-6) {}; \tikzphysicsassertpoint{WEdgeLeft}{pulley-center}{WEdgeLeft}{top} {mirrored wedge pulley centre remains at top} \tikzphysicsgetpoint{WEdgeLeft}{bl} \tikzphysicsassertdim{\tikzphysicstestx}{-6.5cm} {mirrored wedge moves base corner inward} \tikzphysicsassertpoint{WEdgeLeft}{slope-0}{WEdgeLeft}{top} {mirrored wedge slope boundary starts at top} \tikzphysicsassertpoint{WEdgeLeft}{slope-100}{WEdgeLeft}{bl} {mirrored wedge slope boundary ends at shifted base corner} \tikzphysicsgetpoint{WEdgeLeft}{slope-50} \tikzphysicsassertdim{\tikzphysicstestx}{-6.5cm} {mirrored wedge boundary midpoint follows vertical wall} \tikzphysicsassertpoint{WEdgeLeft}{right-mid}{WEdgeLeft}{right-50} {mirrored wedge right midpoint follows incline} \tikzphysicsassertpoint{WEdgeLeft}{slope-mid}{WEdgeLeft}{surface-50} {mirrored wedge slope midpoint follows contact face} \tikzphysicsgetpoint{WEdgeLeft}{centroid} \tikzphysicsassertdim{\tikzphysicstestx}{-4.3669cm} {mirrored wedge pulley-edge centroid follows filled polygon x} \tikzphysicsassertdim{\tikzphysicstesty}{-4.7151cm} {mirrored wedge pulley-edge centroid follows filled polygon y} \end{tikzpicture}} \begin{tikzpicture} \node[ramp, minimum width=8.6cm, ramp run=2.6cm, ramp rise=1.5cm] (Ramp) at (0,0) {}; \tikzphysicsassertpoint{Ramp}{surface-0}{Ramp}{surface-start} {straight ramp surface-0 endpoint} \tikzphysicsassertpoint{Ramp}{surface-100}{Ramp}{surface-end} {straight ramp surface-100 endpoint} \tikzphysicsassertpoint{Ramp}{50}{Ramp}{surface-50} {straight ramp shorthand 50 uses contact surface} \tikzphysicsassertpoint{Ramp}{floor-0}{Ramp}{floor-start}{straight ramp floor starts at contact start} \tikzphysicsassertpoint{Ramp}{floor-100}{Ramp}{ramp-foot}{straight ramp floor reaches incline} \tikzphysicsassertpoint{Ramp}{incline-0}{Ramp}{ramp-foot}{straight ramp incline begins at foot} \tikzphysicsassertpoint{Ramp}{incline-100}{Ramp}{ramp-top}{straight ramp incline reaches top} \tikzphysicsassertpoint{Ramp}{wall-surface-0}{Ramp}{wall-bottom}{straight ramp wall contact begins at floor} \tikzphysicsassertpoint{Ramp}{wall-surface-100}{Ramp}{wall-top}{straight ramp wall contact reaches top} \tikzphysicsassertpoint{Ramp}{wall-back-0}{Ramp}{base-start}{straight ramp wall back begins at base} \tikzphysicsassertpoint{Ramp}{wall-tip-100}{Ramp}{wall-top}{straight ramp wall tip meets contact face} \tikzphysicsassertpoint{Ramp}{base-0}{Ramp}{base-start}{straight ramp base starts behind wall} \tikzphysicsassertpoint{Ramp}{base-100}{Ramp}{base-end}{straight ramp base reaches far end} \tikzphysicsassertpoint{Ramp}{end-0}{Ramp}{base-end}{straight ramp end begins at base} \tikzphysicsassertpoint{Ramp}{end-100}{Ramp}{ramp-top}{straight ramp end reaches incline top} \tikzphysicsgetpoint{Ramp}{floor-end} \tikzphysicsassertdim{\tikzphysicstestx}{6cm}{straight ramp flat length} \tikzphysicsassertdim{\tikzphysicstesty}{0pt}{straight ramp floor is horizontal} \tikzphysicsgetpoint{Ramp}{ramp-top} \tikzphysicsassertdim{\tikzphysicstestx}{8.6cm}{straight ramp overall width} \tikzphysicsassertdim{\tikzphysicstesty}{1.5cm}{straight ramp explicit rise} \tikzphysicsgetpoint{Ramp}{normal-0} \tikzphysicsassertdim{\tikzphysicstestx}{0pt}{straight ramp start normal x} \tikzphysicsassertdim{\tikzphysicstesty}{0.5cm}{straight ramp start normal y} \physicsrampangle{Ramp}{$30^\circ$} \TYPE{PASS: straight ramp angle marker compiles} \node[ramp-left, minimum width=8.6cm, ramp run=2.6cm, ramp rise=1.5cm] (RampLeft) at (0,-2) {}; \tikzphysicsgetpoint{RampLeft}{surface-end} \tikzphysicsassertdim{\tikzphysicstestx}{-8.6cm}{left straight ramp mirrors x} \tikzphysicsassertdim{\tikzphysicstesty}{-0.5cm}{left straight ramp retains rise} \tikzphysicsassertpoint{RampLeft}{floor-100}{RampLeft}{ramp-foot} {mirrored straight ramp floor reaches incline} \tikzphysicsassertpoint{RampLeft}{end-100}{RampLeft}{ramp-top} {mirrored straight ramp end reaches incline top} \node[ramp, minimum width=8.6cm, ramp run=2.6cm, ramp rise=1.5cm, ramp wall height=3cm] (RampTallWall) at (0,-5) {}; \tikzphysicsgetpoint{RampTallWall}{center} \tikzphysicsassertdim{\tikzphysicstestx}{4.175cm}{tall-wall ramp center follows body width} \tikzphysicsassertdim{\tikzphysicstesty}{-3.625cm}{tall-wall ramp center follows highest point} \node[ramp-left, minimum width=8.6cm, ramp run=2.6cm, ramp rise=1.5cm, ramp wall height=3cm] (RampTallWallLeft) at (0,-5) {}; \tikzphysicsgetpoint{RampTallWallLeft}{center} \tikzphysicsassertdim{\tikzphysicstestx}{-4.175cm}{mirrored tall-wall ramp center follows body width} \tikzphysicsassertdim{\tikzphysicstesty}{-3.625cm}{mirrored tall-wall ramp center follows highest point} \end{tikzpicture} \begin{tikzpicture} \node[curved-ramp, curved ramp floor length=2cm, curved ramp radius=4cm, curved ramp angle=90, curved ramp back extension=1cm] (Curve) at (0,0) {}; \tikzphysicsassertpoint{Curve}{surface-0}{Curve}{surface-start} {curved ramp surface-0 endpoint} \tikzphysicsassertpoint{Curve}{surface-100}{Curve}{surface-end} {curved ramp surface-100 endpoint} \tikzphysicsassertpoint{Curve}{80}{Curve}{surface-80} {curved ramp shorthand 80 uses contact surface} \tikzphysicsassertpoint{Curve}{floor-0}{Curve}{floor-start}{curved ramp floor begins at contact start} \tikzphysicsassertpoint{Curve}{floor-100}{Curve}{curve-start}{curved ramp floor reaches arc} \tikzphysicsassertpoint{Curve}{start-0}{Curve}{base-start}{curved ramp start cap begins at base} \tikzphysicsassertpoint{Curve}{start-100}{Curve}{surface-start}{curved ramp start cap reaches contact} \tikzphysicsassertpoint{Curve}{base-0}{Curve}{base-start}{curved ramp base begins at start cap} \tikzphysicsassertpoint{Curve}{base-100}{Curve}{base-end}{curved ramp base reaches back} \tikzphysicsassertpoint{Curve}{back-0}{Curve}{back-bottom}{curved ramp back begins at base} \tikzphysicsassertpoint{Curve}{back-100}{Curve}{back-top}{curved ramp back reaches top} \tikzphysicsassertpoint{Curve}{top-0}{Curve}{curve-end}{curved ramp top begins at arc end} \tikzphysicsassertpoint{Curve}{top-100}{Curve}{back-top}{curved ramp top reaches back} \tikzphysicsgetpoint{Curve}{surface-end} \tikzphysicsassertdim{\tikzphysicstestx}{6cm}{quarter-circle ramp end x} \tikzphysicsassertdim{\tikzphysicstesty}{4cm}{quarter-circle ramp end y} \tikzphysicsgetpoint{Curve}{surface-start} \tikzphysicsassertdim{\tikzphysicstestx}{0cm}{curved ramp floor starts at node position} \tikzphysicsassertdim{\tikzphysicstesty}{0pt}{curved ramp floor remains horizontal} \tikzphysicstestxx=\tikzphysicstestx \tikzphysicsgetpoint{Curve}{curve-start} \advance\tikzphysicstestx by -\tikzphysicstestxx \tikzphysicsassertdim{\tikzphysicstestx}{2cm}{curved ramp floor length} \tikzphysicsassertpoint{Curve}{floor-end}{Curve}{curve-start} {curved ramp floor meets circular arc continuously} \tikzphysicsgetpoint{Curve}{curve-50} \tikzphysicsassertdim{\tikzphysicstestx}{4.828427cm}{curved ramp arc midpoint x} \tikzphysicsassertdim{\tikzphysicstesty}{1.171573cm}{curved ramp arc midpoint y} \tikzphysicsassertpoint{Curve}{curve-0}{Curve}{curve-start} {curved ramp curve-0 endpoint} \tikzphysicsassertpoint{Curve}{curve-100}{Curve}{curve-end} {curved ramp curve-100 endpoint} \tikzphysicsgetpoint{Curve}{normal-100} \tikzphysicsassertdim{\tikzphysicstestx}{5.5cm}{curved ramp top outward normal x} \tikzphysicsassertdim{\tikzphysicstesty}{4cm}{curved ramp top outward normal y} \node[curved-ramp-left, curved ramp radius=4cm, curved ramp angle=90] (CurveLeft) at (0,-5) {}; \tikzphysicsgetpoint{CurveLeft}{floor-end} \tikzphysicsassertdim{\tikzphysicstestx}{-3.75cm}{left curved ramp default floor is 50 percent longer} \tikzphysicsgetpoint{CurveLeft}{surface-end} \tikzphysicsassertdim{\tikzphysicstestx}{-7.75cm}{left curved ramp uses 3.75cm default floor and mirrors x} \tikzphysicsassertdim{\tikzphysicstesty}{-1cm}{left curved ramp retains rise} \tikzphysicsassertpoint{CurveLeft}{floor-100}{CurveLeft}{curve-start} {mirrored curved ramp floor reaches arc} \tikzphysicsassertpoint{CurveLeft}{top-100}{CurveLeft}{back-top} {mirrored curved ramp top reaches back} \end{tikzpicture} \begin{tikzpicture}[scale=0.2,every node/.append style={transform shape}] \node[concave-mirror, mirror radius=5, mirror thickness=0.25, mirror aperture angle=30] (Mirror) at (0,0) {}; \tikzphysicsassertpoint{Mirror}{surface-0}{Mirror}{surface-bottom} {concave mirror surface-0 endpoint} \tikzphysicsassertpoint{Mirror}{surface-100}{Mirror}{surface-top} {concave mirror surface-100 endpoint} \tikzphysicsassertpoint{Mirror}{back-0}{Mirror}{back-bottom} {concave mirror back-0 endpoint} \tikzphysicsassertpoint{Mirror}{back-100}{Mirror}{back-top} {concave mirror back-100 endpoint} \tikzphysicsassertpoint{Mirror}{80}{Mirror}{surface-80} {concave mirror shorthand 80 uses reflecting surface} \node[convex-mirror, mirror radius=5, mirror thickness=0.25, mirror aperture angle=30] (ConvexMirror) at (0,-5) {}; \tikzphysicsgetpoint{ConvexMirror}{surface-mid} \ifdim\tikzphysicstestx<0pt \TYPE{PASS: convex mirror reflecting arc is on the left} \else \TYPE{FAIL: convex mirror reflecting arc is not on the left} \fi \TYPE{PASS: concave and convex mirror styles compile} \end{tikzpicture} \begin{tikzpicture}[scale=0.2,every node/.append style={transform shape}] \node[convex-lens, convex lens radius=5, convex lens thickness=0.2, convex lens aperture angle=25] (Convex) at (0,0) {}; \tikzphysicsassertpoint{Convex}{front-0}{Convex}{front-bottom} {convex lens front-0 endpoint} \tikzphysicsassertpoint{Convex}{front-100}{Convex}{front-top} {convex lens front-100 endpoint} \tikzphysicsassertpoint{Convex}{back-0}{Convex}{back-bottom} {convex lens back-0 endpoint} \tikzphysicsassertpoint{Convex}{back-100}{Convex}{back-top} {convex lens back-100 endpoint} \tikzphysicsassertpoint{Convex}{50}{Convex}{front-50} {convex lens shorthand 50 uses front surface} \node[concave-lens, concave lens radius=5, concave lens thickness=0.2, concave lens aperture angle=25] (Concave) at (2,0) {}; \tikzphysicsassertpoint{Concave}{front-0}{Concave}{front-bottom} {concave lens front-0 endpoint} \tikzphysicsassertpoint{Concave}{front-100}{Concave}{front-top} {concave lens front-100 endpoint} \tikzphysicsassertpoint{Concave}{back-0}{Concave}{back-bottom} {concave lens back-0 endpoint} \tikzphysicsassertpoint{Concave}{back-100}{Concave}{back-top} {concave lens back-100 endpoint} \tikzphysicsassertpoint{Concave}{80}{Concave}{front-80} {concave lens shorthand 80 uses front surface} \node[slab, slab width=1.2, slab height=3] (Slab) at (4,0) {}; \tikzphysicsassertpoint{Slab}{front-0}{Slab}{front-bottom} {slab front-0 endpoint} \tikzphysicsassertpoint{Slab}{front-100}{Slab}{front-top} {slab front-100 endpoint} \tikzphysicsassertpoint{Slab}{back-0}{Slab}{back-bottom} {slab back-0 endpoint} \tikzphysicsassertpoint{Slab}{back-100}{Slab}{back-top} {slab back-100 endpoint} \tikzphysicsassertpoint{Slab}{50}{Slab}{front-50} {slab shorthand 50 uses front surface} \node[prism, prism width=3, prism apex angle=60] (Prism) at (8,0) {}; \tikzphysicsassertpoint{Prism}{base-0}{Prism}{base-left} {prism base-0 endpoint} \tikzphysicsassertpoint{Prism}{base-100}{Prism}{base-right} {prism base-100 endpoint} \tikzphysicsassertpoint{Prism}{right-100}{Prism}{apex} {prism right-100 endpoint} \tikzphysicsassertpoint{Prism}{left-0}{Prism}{apex} {prism left-0 endpoint} \tikzphysicsassertpoint{Prism}{80}{Prism}{left-80} {prism shorthand 80 uses left entry face} \end{tikzpicture} \begin{tikzpicture} \node[physicsblock, physics block width=1, physics block height=10mm] (Block) at (0,0) {}; \tikzphysicsgetpoint{Block}{east} \tikzphysicsassertdim{\tikzphysicstestx}{0.5cm}{bare block width is centimetres} \tikzphysicsgetpoint{Block}{north} \tikzphysicsassertdim{\tikzphysicstesty}{5mm}{explicit block height unit is preserved} \end{tikzpicture} \begin{tikzpicture} \coordinate (SpringA) at (0,0); \coordinate (SpringB) at (4,0); \draw[spring, pre length=5mm, post length=7mm, amplitude=4.5pt, segment length=4.5pt] (SpringA) -- node[above] {$k$} (SpringB); \draw[physicsspring, physics spring amplitude=3pt] (0,-1) -- (3,-1); \TYPE{PASS: spring is a configurable path style in concise and collision-safe forms} \end{tikzpicture} \begin{tikzpicture} \coordinate (StringA) at (-3,-1); \coordinate (StringB) at (3,-1); \node[physicspulley, physics pulley diameter=1] (StringPulley) at (0,0) {}; \physicsstringoverpulley{StringA}{StringPulley}{StringB} \physicsstringoverpulley[ physics string start solution=1, physics string end solution=2, physics string wrap=shortest, dashed] {StringA}{StringPulley}{StringB} \physicsstringoverpulley[string route=over]{StringA}{StringPulley}{StringB} \physicsstringoverpulley[string route=under]{StringA}{StringPulley}{StringB} \physicsstringoverpulley[string route=shortest]{StringA}{StringPulley}{StringB} \TYPE{PASS: tangent pulley string default, explicit, and named routes compile} \end{tikzpicture} \begin{tikzpicture}[scale=0.5,every node/.append style={transform shape}] \node[platform, minimum width=5cm, minimum height=2cm, left wall angle=135, right wall angle=45] (ShortPlatform) at (0,0) {}; \node[physicsplatform-both, minimum width=5cm, minimum height=2cm, physics left wall angle=135, physics right wall angle=45] (LongPlatform) at (0,0) {}; \tikzphysicsassertpoint{ShortPlatform}{left-pulley-center}{LongPlatform}{left-pulley-center} {short platform matches collision-safe platform} \tikzphysicsassertpoint{ShortPlatform}{right-pulley-center}{LongPlatform}{right-pulley-center} {short platform right corner matches collision-safe platform} \node[platform-left-up, minimum width=3cm, minimum height=1.5cm] (UpShort) at (0,-9) {}; \node[physicsplatform-left, minimum width=3cm, minimum height=1.5cm, physics wall angle=90] (UpLong) at (0,-9) {}; \tikzphysicsassertpoint{UpShort}{wall-surface-100}{UpLong}{wall-surface-100} {platform-left-up equals a 90-degree left wall} \node[platform-right-up, minimum width=3cm, minimum height=1.5cm] (RightUpShort) at (5,-9) {}; \node[physicsplatform-right, minimum width=3cm, minimum height=1.5cm, physics wall angle=90] (RightUpLong) at (5,-9) {}; \tikzphysicsassertpoint{RightUpShort}{wall-surface-100}{RightUpLong}{wall-surface-100} {platform-right-up equals a 90-degree right wall} \node[wedge, wedge width=4cm, wedge angle=30] (ShortWedge) at (0,-3) {}; \node[physicswedge, physics wedge width=4cm, physics wedge angle=30] (LongWedge) at (0,-3) {}; \tikzphysicsassertpoint{ShortWedge}{slope-mid}{LongWedge}{slope-mid} {concise wedge keys match collision-safe aliases} \node[wedge, wedge width=4cm, wedge height=2cm] (ShortHeightWedge) at (0,-6) {}; \TYPE{PASS: wedge height concise key compiles} \node[block, minimum width=1cm, minimum height=8mm] (ShortBlock) at (5,-3) {}; \draw[spring] (4,-5) -- (6,-5); \node[pulley, minimum size=1cm, pulley axle radius=1.5pt] (ShortPulley) at (7,-3) {}; \node[concave-mirror, mirror radius=5cm] at (10,-3) {}; \node[convex-mirror, mirror radius=5cm] at (10,-3) {}; \node[convex-lens, convex lens radius=5cm] at (10,-3) {}; \node[concave-lens, concave lens radius=5cm] at (10,-3) {}; \node[slab, minimum width=1cm, minimum height=2cm] at (10,-3) {}; \node[prism, minimum width=2cm, minimum height=1.7cm] at (10,-3) {}; \node[ground, ground width=2cm] at (0,-6) {}; \node[ceiling, ceiling width=2cm] at (3,-6) {}; \node[wall-left, wall height=2cm] at (6,-6) {}; \node[wall-right, wall height=2cm] at (9,-6) {}; \TYPE{PASS: all concise public styles compile, including optics components} \end{tikzpicture} \begin{tikzpicture} \node[ground, ground width=4cm] (Ground) at (0,0) {}; \node[ceiling, ceiling width=4cm] (Ceiling) at (0,2) {}; \node[wall-left, wall height=4cm] (WallLeft) at (3,0) {}; \node[wall-right, wall height=4cm] (WallRight) at (5,0) {}; \tikzphysicsassertpoint{Ground}{surface-0}{Ground}{top-left}{ground contact starts at left} \tikzphysicsassertpoint{Ground}{surface-100}{Ground}{top-right}{ground contact ends at right} \tikzphysicsassertpoint{Ground}{surface-50}{Ground}{surface}{ground contact midpoint} \tikzphysicsassertpoint{Ground}{bottom-0}{Ground}{bottom-left}{ground bottom-left} \tikzphysicsassertpoint{Ground}{bottom-100}{Ground}{bottom-right}{ground bottom-right} \tikzphysicsassertpoint{Ground}{left-0}{Ground}{bottom-left}{ground left side starts below} \tikzphysicsassertpoint{Ground}{right-100}{Ground}{top-right}{ground right side ends above} \tikzphysicsassertpoint{Ceiling}{surface-0}{Ceiling}{bottom-left}{ceiling contact starts at left} \tikzphysicsassertpoint{Ceiling}{surface-100}{Ceiling}{bottom-right}{ceiling contact ends at right} \tikzphysicsassertpoint{Ceiling}{surface-50}{Ceiling}{surface}{ceiling contact midpoint} \tikzphysicsassertpoint{Ceiling}{top-0}{Ceiling}{top-left}{ceiling top-left} \tikzphysicsassertpoint{Ceiling}{top-100}{Ceiling}{top-right}{ceiling top-right} \tikzphysicsassertpoint{WallLeft}{surface-0}{WallLeft}{bottom-right}{left wall contact starts below} \tikzphysicsassertpoint{WallLeft}{surface-100}{WallLeft}{top-right}{left wall contact ends above} \tikzphysicsassertpoint{WallLeft}{surface-50}{WallLeft}{surface}{left wall contact midpoint} \tikzphysicsassertpoint{WallLeft}{left-0}{WallLeft}{bottom-left}{left wall back starts below} \tikzphysicsassertpoint{WallLeft}{left-100}{WallLeft}{top-left}{left wall back ends above} \tikzphysicsassertpoint{WallRight}{surface-0}{WallRight}{bottom-left}{right wall contact starts below} \tikzphysicsassertpoint{WallRight}{surface-100}{WallRight}{top-left}{right wall contact ends above} \tikzphysicsassertpoint{WallRight}{surface-50}{WallRight}{surface}{right wall contact midpoint} \tikzphysicsassertpoint{WallRight}{right-0}{WallRight}{bottom-right}{right wall back starts below} \tikzphysicsassertpoint{WallRight}{right-100}{WallRight}{top-right}{right wall back ends above} \end{tikzpicture} \END \end{document}