%% tikzlibrarytikzphysics.elements.code.tex %% ----------------------------------------------------------- %% Differential area elements for mechanics and calculus diagrams. %% %% Public nodes: %% polar element, differential sector, differential ring, unwrapped ring, %% spherical shell, hollow sphere, rectangular element, rectangular strip, %% rectangular sheet %% Public pic: %% differential ring diagram, sphere shell diagram, sphere slice diagram, %% hollow sphere diagram, cylinder shell diagram, cylinder slice diagram, %% cone slice diagram, sheet element diagram %% %% Author : Vaibhav Blayer %% Version : v1.8.0 (2026-10-11) %% License : LPPL 1.3c %% ----------------------------------------------------------- \usetikzlibrary{patterns,calc,arrows.meta} \usetikzlibrary{tikzphysics.core} \makeatletter \tikzphysics@declarehook{polar element} \tikzphysics@declarehook{differential sector} \tikzphysics@declarehook{differential ring} \tikzphysics@declarehook{unwrapped ring} \tikzphysics@declarehook{spherical shell} \tikzphysics@declarehook{hollow sphere} \tikzphysics@declarehook{rectangular element} \tikzphysics@declarehook{rectangular strip} \tikzphysics@declarehook{rectangular sheet} \tikzphysics@declarehook{element dimension} \tikzphysics@declarehook{element label} \tikzphysics@declarehook{element body} \tikzphysics@declarehook{element center} \tikzphysics@declarehook{differential ring diagram} \tikzphysics@declarehook{sphere shell diagram} \tikzphysics@declarehook{sphere slice diagram} \tikzphysics@declarehook{hollow sphere diagram} \tikzphysics@declarehook{cylinder shell diagram} \tikzphysics@declarehook{cylinder slice diagram} \tikzphysics@declarehook{cone slice diagram} \tikzphysics@declarehook{sheet element diagram} %% ============================================================ %% STATE AND VALIDATED GEOMETRY %% ============================================================ \def\tikzphysics@elements@innervalue{1.8cm} \def\tikzphysics@elements@outervalue{2cm} \def\tikzphysics@elements@thicknessvalue{0.2cm} \def\tikzphysics@elements@thicknessflag{0} \def\tikzphysics@elements@startvalue{30} \def\tikzphysics@elements@deltavalue{30} \def\tikzphysics@elements@dimensionoffsetvalue{4mm} \def\tikzphysics@elements@diagramgapvalue{5mm} \def\tikzphysics@elements@bodyradiusvalue{2cm} \def\tikzphysics@elements@centerdotradiusvalue{1.2pt} \def\tikzphysics@elements@radiuslabel{$r$} \def\tikzphysics@elements@radiallabel{$d\!r$} \def\tikzphysics@elements@angularlabel{$d\!\theta$} \def\tikzphysics@elements@arclabel{$r\,d\!\theta$} \def\tikzphysics@elements@circumferencelabel{$2\pi r$} \def\tikzphysics@elements@widthvalue{8mm} \def\tikzphysics@elements@heightvalue{6mm} \def\tikzphysics@elements@bodywidthvalue{5cm} \def\tikzphysics@elements@bodyheightvalue{3cm} \def\tikzphysics@elements@axialthicknessvalue{2mm} \def\tikzphysics@elements@positionvalue{0.55} \def\tikzphysics@elements@transversepositionvalue{0.58} \def\tikzphysics@elements@projectionratiovalue{0.28} \def\tikzphysics@elements@widthlabel{$d\!x$} \def\tikzphysics@elements@heightlabel{$d\!y$} \def\tikzphysics@elements@axiallabel{$d\!x$} \def\tikzphysics@elements@bodyradiuslabel{$R$} \def\tikzphysics@elements@cavityradiuslabel{$a$} \def\tikzphysics@elements@formulalabel{} \newdimen\tikzphysics@elements@inner \newdimen\tikzphysics@elements@outer \newdimen\tikzphysics@elements@thickness \newdimen\tikzphysics@elements@mean \newdimen\tikzphysics@elements@centroidradius \newdimen\tikzphysics@elements@centroidx \newdimen\tikzphysics@elements@centroidy \newdimen\tikzphysics@elements@stripwidth \newdimen\tikzphysics@elements@striphalfwidth \newdimen\tikzphysics@elements@striphalfheight \newdimen\tikzphysics@elements@dimensionoffset \newdimen\tikzphysics@elements@diagramgap \newdimen\tikzphysics@elements@bodyradius \newdimen\tikzphysics@elements@centerdotradius \newdimen\tikzphysics@elements@rectwidth \newdimen\tikzphysics@elements@rectheight \newdimen\tikzphysics@elements@recthalfwidth \newdimen\tikzphysics@elements@recthalfheight \newdimen\tikzphysics@elements@bodywidth \newdimen\tikzphysics@elements@bodyheight \newdimen\tikzphysics@elements@axialthickness \def\tikzphysics@elements@start{30} \def\tikzphysics@elements@delta{30} \def\tikzphysics@elements@end{60} \def\tikzphysics@elements@mid{45} \newcommand{\tikzphysics@elements@setpolardims}{% \tikzphysics@resolve@nonnegative{\tikzphysics@elements@inner}% {\tikzphysics@elements@innervalue}% \ifnum\tikzphysics@elements@thicknessflag=1\relax \tikzphysics@resolve@length{\tikzphysics@elements@thickness}% {\tikzphysics@elements@thicknessvalue}% \tikzphysics@elements@outer=\tikzphysics@elements@inner \advance\tikzphysics@elements@outer by \tikzphysics@elements@thickness \else \tikzphysics@resolve@length{\tikzphysics@elements@outer}% {\tikzphysics@elements@outervalue}% \tikzphysics@elements@thickness=\tikzphysics@elements@outer \advance\tikzphysics@elements@thickness by -\tikzphysics@elements@inner \fi \ifdim\tikzphysics@elements@outer>\tikzphysics@elements@inner\relax\else \PackageError{tikzphysics}{element outer radius must exceed inner radius}% {Increase element outer radius or reduce element inner radius.}% \fi \tikzphysics@elements@mean=\tikzphysics@elements@inner \advance\tikzphysics@elements@mean by \tikzphysics@elements@outer \divide\tikzphysics@elements@mean by 2 \pgfmathparse{\tikzphysics@elements@startvalue}% \ifpgfmathunitsdeclared \PackageError{tikzphysics}{element start angle must be unitless}% {Give the angle in degrees without a TeX dimension.}% \fi \edef\tikzphysics@elements@start{\pgfmathresult}% \pgfmathparse{\tikzphysics@elements@deltavalue}% \ifpgfmathunitsdeclared \PackageError{tikzphysics}{element delta angle must be unitless}% {Give the angular width in degrees without a TeX dimension.}% \fi \edef\tikzphysics@elements@delta{\pgfmathresult}% \ifdim\tikzphysics@elements@delta pt>0pt\relax\else \PackageError{tikzphysics}{element delta angle must be greater than zero}% {Use an angle in the interval (0,360].}% \fi \ifdim\tikzphysics@elements@delta pt>360pt\relax \PackageError{tikzphysics}{element delta angle must not exceed 360 degrees}% {Use an angle in the interval (0,360].}% \fi \pgfmathsetmacro{\tikzphysics@elements@end}% {\tikzphysics@elements@start+\tikzphysics@elements@delta}% \pgfmathsetmacro{\tikzphysics@elements@mid}% {\tikzphysics@elements@start+0.5*\tikzphysics@elements@delta}% %% Normalize the radii before squaring: point-valued squares overflow %% PGF's fixed-point arithmetic even for ordinary 3 cm sectors. \ifdim\tikzphysics@elements@delta pt=360pt\relax \tikzphysics@elements@centroidradius=0pt \else \pgfmathsetmacro{\tikzphysics@elements@radiusratio}% {\tikzphysics@elements@inner/\tikzphysics@elements@outer}% %% sin(z)/z tends to one. Avoid division by a rounded-to-zero small z. \ifdim\tikzphysics@elements@delta pt<.1pt\relax \def\tikzphysics@elements@sinc{1}% \else \pgfmathsetmacro{\tikzphysics@elements@sinc}% {sin(.5*\tikzphysics@elements@delta)/ (.5*\tikzphysics@elements@delta*pi/180)}% \fi \pgfmathsetmacro{\tikzphysics@elements@centroidfactor}% {(2/3)*\tikzphysics@elements@sinc* (1+\tikzphysics@elements@radiusratio+\tikzphysics@elements@radiusratio^2)/ (1+\tikzphysics@elements@radiusratio)}% \pgfmathsetlength{\tikzphysics@elements@centroidradius}% {\tikzphysics@elements@centroidfactor*\tikzphysics@elements@outer}% \fi \pgfmathsetlength{\tikzphysics@elements@centroidx}% {\tikzphysics@elements@centroidradius*cos(\tikzphysics@elements@mid)}% \pgfmathsetlength{\tikzphysics@elements@centroidy}% {\tikzphysics@elements@centroidradius*sin(\tikzphysics@elements@mid)}% } \newcommand{\tikzphysics@elements@setstripdims}{% \tikzphysics@elements@setpolardims \ifdim\tikzphysics@elements@inner>0pt\relax\else \PackageError{tikzphysics}{unwrapped ring requires a positive inner radius}% {Use a positive reference radius before unwrapping the ring.}% \fi \pgfmathsetlength{\tikzphysics@elements@stripwidth}% {2*pi*\tikzphysics@elements@inner}% \tikzphysics@elements@striphalfwidth=.5\tikzphysics@elements@stripwidth \tikzphysics@elements@striphalfheight=.5\tikzphysics@elements@thickness } %% ============================================================ %% PARAMETRIC ARC AND RADIAL ANCHORS %% ============================================================ \def\tikzphysics@elements@declarearcanchors#1#2#3#4{% \tikzphysics@declareanchorfamily{#1}{#1-}{% \pgfmathsetmacro{\tikzphysics@elements@@angle}{(#3)+\tikzphysics@percent*((#4)-(#3))}% \pgfmathsetlength{\pgf@x}{(#2)*cos(\tikzphysics@elements@@angle)}% \pgfmathsetlength{\pgf@y}{(#2)*sin(\tikzphysics@elements@@angle)}% }% } \let\tikzphysics@elements@declareedgeanchors=\tikzphysics@declareedgeanchors %% ============================================================ %% POLAR ELEMENT SHAPE %% ============================================================ \pgfdeclareshape{physicspolarelement}{ \savedmacro\tikzphysics@elements@savedfont{% \def\tikzphysics@elements@savedfont{\unexpanded\expandafter{\tikz@textfont}}}% % \savedmacro\tikzphysics@elements@savedradiuslabel{% \def\tikzphysics@elements@savedradiuslabel{\unexpanded\expandafter{\tikzphysics@elements@radiuslabel}}}% \savedmacro\tikzphysics@elements@savedradiallabel{% \def\tikzphysics@elements@savedradiallabel{\unexpanded\expandafter{\tikzphysics@elements@radiallabel}}}% \savedmacro\tikzphysics@elements@savedangularlabel{% \def\tikzphysics@elements@savedangularlabel{\unexpanded\expandafter{\tikzphysics@elements@angularlabel}}}% \savedmacro\tikzphysics@elements@savedarclabel{% \def\tikzphysics@elements@savedarclabel{\unexpanded\expandafter{\tikzphysics@elements@arclabel}}}% \savedmacro{\tikzphysics@elements@p@inner}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@inner{\the\tikzphysics@elements@inner}% } \savedmacro{\tikzphysics@elements@p@outer}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@outer{\the\tikzphysics@elements@outer}% } \savedmacro{\tikzphysics@elements@p@thickness}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@thickness{\the\tikzphysics@elements@thickness}% } \savedmacro{\tikzphysics@elements@p@start}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@start{\tikzphysics@elements@start}% } \savedmacro{\tikzphysics@elements@p@delta}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@delta{\tikzphysics@elements@delta}% } \savedmacro{\tikzphysics@elements@p@end}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@end{\tikzphysics@elements@end}% } \savedmacro{\tikzphysics@elements@p@mid}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@mid{\tikzphysics@elements@mid}% } \savedmacro{\tikzphysics@elements@p@cx}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@cx{\the\tikzphysics@elements@centroidx}% } \savedmacro{\tikzphysics@elements@p@cy}{% \tikzphysics@elements@setpolardims \edef\tikzphysics@elements@p@cy{\the\tikzphysics@elements@centroidy}% } %% Full-circle bounding anchors keep placement predictable for sectors too. \anchor{center}{\pgfpointorigin} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by .5\dp\pgfnodeparttextbox} \anchor{north}{\pgf@x=0pt \pgf@y=\tikzphysics@elements@p@outer} \anchor{south}{\pgf@x=0pt \pgf@y=-\tikzphysics@elements@p@outer} \anchor{east}{\pgf@x=\tikzphysics@elements@p@outer \pgf@y=0pt} \anchor{west}{\pgf@x=-\tikzphysics@elements@p@outer \pgf@y=0pt} \anchor{north east}{\pgf@x=\tikzphysics@elements@p@outer \pgf@y=\tikzphysics@elements@p@outer} \anchor{north west}{\pgf@x=-\tikzphysics@elements@p@outer \pgf@y=\tikzphysics@elements@p@outer} \anchor{south east}{\pgf@x=\tikzphysics@elements@p@outer \pgf@y=-\tikzphysics@elements@p@outer} \anchor{south west}{\pgf@x=-\tikzphysics@elements@p@outer \pgf@y=-\tikzphysics@elements@p@outer} \anchor{centroid}{\pgf@x=\tikzphysics@elements@p@cx \pgf@y=\tikzphysics@elements@p@cy} \anchor{inner-start}{% \pgfmathsetlength{\pgf@x}{\tikzphysics@elements@p@inner*cos(\tikzphysics@elements@p@start)}% \pgfmathsetlength{\pgf@y}{\tikzphysics@elements@p@inner*sin(\tikzphysics@elements@p@start)}% } \anchor{inner-mid}{% \pgfmathsetlength{\pgf@x}{\tikzphysics@elements@p@inner*cos(\tikzphysics@elements@p@mid)}% \pgfmathsetlength{\pgf@y}{\tikzphysics@elements@p@inner*sin(\tikzphysics@elements@p@mid)}% } \anchor{inner-end}{% \pgfmathsetlength{\pgf@x}{\tikzphysics@elements@p@inner*cos(\tikzphysics@elements@p@end)}% \pgfmathsetlength{\pgf@y}{\tikzphysics@elements@p@inner*sin(\tikzphysics@elements@p@end)}% } \anchor{outer-start}{% \pgfmathsetlength{\pgf@x}{\tikzphysics@elements@p@outer*cos(\tikzphysics@elements@p@start)}% \pgfmathsetlength{\pgf@y}{\tikzphysics@elements@p@outer*sin(\tikzphysics@elements@p@start)}% } \anchor{outer-mid}{% \pgfmathsetlength{\pgf@x}{\tikzphysics@elements@p@outer*cos(\tikzphysics@elements@p@mid)}% \pgfmathsetlength{\pgf@y}{\tikzphysics@elements@p@outer*sin(\tikzphysics@elements@p@mid)}% } \anchor{outer-end}{% \pgfmathsetlength{\pgf@x}{\tikzphysics@elements@p@outer*cos(\tikzphysics@elements@p@end)}% \pgfmathsetlength{\pgf@y}{\tikzphysics@elements@p@outer*sin(\tikzphysics@elements@p@end)}% } \anchor{start-mid}{% \pgfmathsetlength{\pgf@x}{0.5*(\tikzphysics@elements@p@inner+\tikzphysics@elements@p@outer)*cos(\tikzphysics@elements@p@start)}% \pgfmathsetlength{\pgf@y}{0.5*(\tikzphysics@elements@p@inner+\tikzphysics@elements@p@outer)*sin(\tikzphysics@elements@p@start)}% } \anchor{end-mid}{% \pgfmathsetlength{\pgf@x}{0.5*(\tikzphysics@elements@p@inner+\tikzphysics@elements@p@outer)*cos(\tikzphysics@elements@p@end)}% \pgfmathsetlength{\pgf@y}{0.5*(\tikzphysics@elements@p@inner+\tikzphysics@elements@p@outer)*sin(\tikzphysics@elements@p@end)}% } \tikzphysics@elements@declarearcanchors{inner} {\tikzphysics@elements@p@inner}{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@end} \tikzphysics@elements@declarearcanchors{outer} {\tikzphysics@elements@p@outer}{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@end} \tikzphysics@elements@declareedgeanchors{start} {\tikzphysics@elements@p@inner*cos(\tikzphysics@elements@p@start)} {\tikzphysics@elements@p@inner*sin(\tikzphysics@elements@p@start)} {\tikzphysics@elements@p@outer*cos(\tikzphysics@elements@p@start)} {\tikzphysics@elements@p@outer*sin(\tikzphysics@elements@p@start)} \tikzphysics@elements@declareedgeanchors{end} {\tikzphysics@elements@p@inner*cos(\tikzphysics@elements@p@end)} {\tikzphysics@elements@p@inner*sin(\tikzphysics@elements@p@end)} {\tikzphysics@elements@p@outer*cos(\tikzphysics@elements@p@end)} {\tikzphysics@elements@p@outer*sin(\tikzphysics@elements@p@end)} \anchorborder{% \@tempdima=\pgf@x \@tempdimb=\pgf@y \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}% {\pgfqpoint{\tikzphysics@elements@p@outer}{\tikzphysics@elements@p@outer}}% } \backgroundpath{% \ifdim\tikzphysics@elements@p@delta pt=360pt\relax %% Separate, oppositely wound closed circles avoid a visible radial seam. \pgfpathmoveto{\pgfpointpolar{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@outer}}% \pgfpatharc{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@outer}% \pgfpathclose \ifdim\tikzphysics@elements@p@inner=0pt\relax\else \pgfpathmoveto{\pgfpointpolar{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@inner}}% \pgfpatharc{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@inner}% \pgfpathclose \fi \else\ifdim\tikzphysics@elements@p@inner=0pt\relax \pgfpathmoveto{\pgfpointorigin}% \pgfpathlineto{\pgfpointpolar{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@outer}}% \pgfpatharc{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@outer}% \pgfpathclose \else \pgfpathmoveto{\pgfpointpolar{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@inner}}% \pgfpathlineto{\pgfpointpolar{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@outer}}% \pgfpatharc{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@outer}% \pgfpathlineto{\pgfpointpolar{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@inner}}% \pgfpatharc{\tikzphysics@elements@p@end}{\tikzphysics@elements@p@start}{\tikzphysics@elements@p@inner}% \pgfpathclose \fi \fi } } %% ============================================================ %% UNWRAPPED RING SHAPE %% ============================================================ \pgfdeclareshape{physicsunwrappedring}{ \savedmacro\tikzphysics@elements@savedfont{% \def\tikzphysics@elements@savedfont{\unexpanded\expandafter{\tikz@textfont}}}% % \savedmacro\tikzphysics@elements@savedradiallabel{% \def\tikzphysics@elements@savedradiallabel{\unexpanded\expandafter{\tikzphysics@elements@radiallabel}}}% \savedmacro\tikzphysics@elements@savedcircumferencelabel{% \def\tikzphysics@elements@savedcircumferencelabel{\unexpanded\expandafter{\tikzphysics@elements@circumferencelabel}}}% \savedmacro{\tikzphysics@elements@u@inner}{% \tikzphysics@elements@setstripdims \edef\tikzphysics@elements@u@inner{\the\tikzphysics@elements@inner}% } \savedmacro{\tikzphysics@elements@u@outer}{% \tikzphysics@elements@setstripdims \edef\tikzphysics@elements@u@outer{\the\tikzphysics@elements@outer}% } \savedmacro{\tikzphysics@elements@u@mean}{% \tikzphysics@elements@setstripdims \edef\tikzphysics@elements@u@mean{\the\tikzphysics@elements@mean}% } \savedmacro{\tikzphysics@elements@u@thickness}{% \tikzphysics@elements@setstripdims \edef\tikzphysics@elements@u@thickness{\the\tikzphysics@elements@thickness}% } \savedmacro{\tikzphysics@elements@u@hx}{% \tikzphysics@elements@setstripdims \edef\tikzphysics@elements@u@hx{\the\tikzphysics@elements@striphalfwidth}% } \savedmacro{\tikzphysics@elements@u@hy}{% \tikzphysics@elements@setstripdims \edef\tikzphysics@elements@u@hy{\the\tikzphysics@elements@striphalfheight}% } \anchor{center}{\pgfpointorigin} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by .5\dp\pgfnodeparttextbox} \anchor{centroid}{\pgfpointorigin} \anchor{north}{\pgf@x=0pt \pgf@y=\tikzphysics@elements@u@hy} \anchor{south}{\pgf@x=0pt \pgf@y=-\tikzphysics@elements@u@hy} \anchor{east}{\pgf@x=\tikzphysics@elements@u@hx \pgf@y=0pt} \anchor{west}{\pgf@x=-\tikzphysics@elements@u@hx \pgf@y=0pt} \anchor{north east}{\pgf@x=\tikzphysics@elements@u@hx \pgf@y=\tikzphysics@elements@u@hy} \anchor{north west}{\pgf@x=-\tikzphysics@elements@u@hx \pgf@y=\tikzphysics@elements@u@hy} \anchor{south east}{\pgf@x=\tikzphysics@elements@u@hx \pgf@y=-\tikzphysics@elements@u@hy} \anchor{south west}{\pgf@x=-\tikzphysics@elements@u@hx \pgf@y=-\tikzphysics@elements@u@hy} \anchor{top-left}{\pgf@x=-\tikzphysics@elements@u@hx \pgf@y=\tikzphysics@elements@u@hy} \anchor{top-right}{\pgf@x=\tikzphysics@elements@u@hx \pgf@y=\tikzphysics@elements@u@hy} \anchor{bottom-left}{\pgf@x=-\tikzphysics@elements@u@hx \pgf@y=-\tikzphysics@elements@u@hy} \anchor{bottom-right}{\pgf@x=\tikzphysics@elements@u@hx \pgf@y=-\tikzphysics@elements@u@hy} \tikzphysics@declareedgeanchors{bottom} {-\tikzphysics@elements@u@hx}{-\tikzphysics@elements@u@hy} {\tikzphysics@elements@u@hx}{-\tikzphysics@elements@u@hy} \tikzphysics@declareedgeanchors{right} {\tikzphysics@elements@u@hx}{-\tikzphysics@elements@u@hy} {\tikzphysics@elements@u@hx}{\tikzphysics@elements@u@hy} \tikzphysics@declareedgeanchors{top} {\tikzphysics@elements@u@hx}{\tikzphysics@elements@u@hy} {-\tikzphysics@elements@u@hx}{\tikzphysics@elements@u@hy} \tikzphysics@declareedgeanchors{left} {-\tikzphysics@elements@u@hx}{\tikzphysics@elements@u@hy} {-\tikzphysics@elements@u@hx}{-\tikzphysics@elements@u@hy} \anchorborder{% \@tempdima=\pgf@x \@tempdimb=\pgf@y \pgfpointborderrectangle{\pgfqpoint{\@tempdima}{\@tempdimb}}% {\pgfqpoint{\tikzphysics@elements@u@hx}{\tikzphysics@elements@u@hy}}% } \backgroundpath{% \pgfpathrectanglecorners {\pgfpoint{-\tikzphysics@elements@u@hx}{-\tikzphysics@elements@u@hy}}% {\pgfpoint{\tikzphysics@elements@u@hx}{\tikzphysics@elements@u@hy}}% } } %% ============================================================ %% RECTANGULAR DIFFERENTIAL ELEMENT SHAPE %% ============================================================ \newcommand{\tikzphysics@elements@setrectdims}{% \tikzphysics@resolve@length{\tikzphysics@elements@rectwidth}% {\tikzphysics@elements@widthvalue}% \tikzphysics@resolve@length{\tikzphysics@elements@rectheight}% {\tikzphysics@elements@heightvalue}% \tikzphysics@elements@recthalfwidth=.5\tikzphysics@elements@rectwidth \tikzphysics@elements@recthalfheight=.5\tikzphysics@elements@rectheight } \pgfdeclareshape{physicsrectangularelement}{ \savedmacro\tikzphysics@elements@savedfont{% \def\tikzphysics@elements@savedfont{\unexpanded\expandafter{\tikz@textfont}}}% % \savedmacro\tikzphysics@elements@savedwidthlabel{% \def\tikzphysics@elements@savedwidthlabel{\unexpanded\expandafter{\tikzphysics@elements@widthlabel}}}% \savedmacro\tikzphysics@elements@savedheightlabel{% \def\tikzphysics@elements@savedheightlabel{\unexpanded\expandafter{\tikzphysics@elements@heightlabel}}}% \savedmacro{\tikzphysics@elements@re@width}{% \tikzphysics@elements@setrectdims \edef\tikzphysics@elements@re@width{\the\tikzphysics@elements@rectwidth}% } \savedmacro{\tikzphysics@elements@re@height}{% \tikzphysics@elements@setrectdims \edef\tikzphysics@elements@re@height{\the\tikzphysics@elements@rectheight}% } \savedmacro{\tikzphysics@elements@re@hx}{% \tikzphysics@elements@setrectdims \edef\tikzphysics@elements@re@hx{\the\tikzphysics@elements@recthalfwidth}% } \savedmacro{\tikzphysics@elements@re@hy}{% \tikzphysics@elements@setrectdims \edef\tikzphysics@elements@re@hy{\the\tikzphysics@elements@recthalfheight}% } \anchor{center}{\pgfpointorigin} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by .5\dp\pgfnodeparttextbox} \anchor{centroid}{\pgfpointorigin} \anchor{north}{\pgf@x=0pt \pgf@y=\tikzphysics@elements@re@hy} \anchor{south}{\pgf@x=0pt \pgf@y=-\tikzphysics@elements@re@hy} \anchor{east}{\pgf@x=\tikzphysics@elements@re@hx \pgf@y=0pt} \anchor{west}{\pgf@x=-\tikzphysics@elements@re@hx \pgf@y=0pt} \anchor{north east}{\pgf@x=\tikzphysics@elements@re@hx \pgf@y=\tikzphysics@elements@re@hy} \anchor{north west}{\pgf@x=-\tikzphysics@elements@re@hx \pgf@y=\tikzphysics@elements@re@hy} \anchor{south east}{\pgf@x=\tikzphysics@elements@re@hx \pgf@y=-\tikzphysics@elements@re@hy} \anchor{south west}{\pgf@x=-\tikzphysics@elements@re@hx \pgf@y=-\tikzphysics@elements@re@hy} \anchor{top-left}{\pgf@x=-\tikzphysics@elements@re@hx \pgf@y=\tikzphysics@elements@re@hy} \anchor{top-right}{\pgf@x=\tikzphysics@elements@re@hx \pgf@y=\tikzphysics@elements@re@hy} \anchor{bottom-left}{\pgf@x=-\tikzphysics@elements@re@hx \pgf@y=-\tikzphysics@elements@re@hy} \anchor{bottom-right}{\pgf@x=\tikzphysics@elements@re@hx \pgf@y=-\tikzphysics@elements@re@hy} \tikzphysics@declareedgeanchors{bottom} {-\tikzphysics@elements@re@hx}{-\tikzphysics@elements@re@hy} {\tikzphysics@elements@re@hx}{-\tikzphysics@elements@re@hy} \tikzphysics@declareedgeanchors{right} {\tikzphysics@elements@re@hx}{-\tikzphysics@elements@re@hy} {\tikzphysics@elements@re@hx}{\tikzphysics@elements@re@hy} \tikzphysics@declareedgeanchors{top} {\tikzphysics@elements@re@hx}{\tikzphysics@elements@re@hy} {-\tikzphysics@elements@re@hx}{\tikzphysics@elements@re@hy} \tikzphysics@declareedgeanchors{left} {-\tikzphysics@elements@re@hx}{\tikzphysics@elements@re@hy} {-\tikzphysics@elements@re@hx}{-\tikzphysics@elements@re@hy} \anchorborder{% \@tempdima=\pgf@x \@tempdimb=\pgf@y \pgfpointborderrectangle{\pgfqpoint{\@tempdima}{\@tempdimb}}% {\pgfqpoint{\tikzphysics@elements@re@hx}{\tikzphysics@elements@re@hy}}% } \backgroundpath{% \pgfpathrectanglecorners {\pgfpoint{-\tikzphysics@elements@re@hx}{-\tikzphysics@elements@re@hy}}% {\pgfpoint{\tikzphysics@elements@re@hx}{\tikzphysics@elements@re@hy}}% } } %% ============================================================ %% PER-NODE GEOMETRY VALUES %% ============================================================ \newcommand{\tikzphysics@elements@recordpolar}[1]{% \begingroup \csname pgf@sh@ma@#1\endcsname \tikzphysics@storegeometryvalue{#1}{inner radius}{\tikzphysics@elements@p@inner}% \tikzphysics@storegeometryvalue{#1}{outer radius}{\tikzphysics@elements@p@outer}% \tikzphysics@storegeometryvalue{#1}{radial thickness}{\tikzphysics@elements@p@thickness}% \tikzphysics@storegeometryvalue{#1}{start angle}{\tikzphysics@elements@p@start}% \tikzphysics@storegeometryvalue{#1}{delta angle}{\tikzphysics@elements@p@delta}% \tikzphysics@storegeometryvalue{#1}{end angle}{\tikzphysics@elements@p@end}% \pgfmathsetlength{\@tempdima}{0.5*(\tikzphysics@elements@p@inner+\tikzphysics@elements@p@outer)}% \tikzphysics@storegeometryvalue{#1}{mean radius}{\the\@tempdima}% \endgroup } \newcommand{\tikzphysics@elements@recordunwrapped}[1]{% \begingroup \csname pgf@sh@ma@#1\endcsname \tikzphysics@storegeometryvalue{#1}{inner radius}{\tikzphysics@elements@u@inner}% \tikzphysics@storegeometryvalue{#1}{outer radius}{\tikzphysics@elements@u@outer}% \tikzphysics@storegeometryvalue{#1}{radial thickness}{\tikzphysics@elements@u@thickness}% \tikzphysics@storegeometryvalue{#1}{mean radius}{\tikzphysics@elements@u@mean}% \pgfmathsetlength{\@tempdima}{2*\tikzphysics@elements@u@hx}% \tikzphysics@storegeometryvalue{#1}{circumference}{\the\@tempdima}% \endgroup } \newcommand{\tikzphysics@elements@recordrectangle}[1]{% \begingroup \csname pgf@sh@ma@#1\endcsname \tikzphysics@storegeometryvalue{#1}{width}{\tikzphysics@elements@re@width}% \tikzphysics@storegeometryvalue{#1}{height}{\tikzphysics@elements@re@height}% \endgroup } \tikzphysics@registergeometryrecorder{physicspolarelement}{\tikzphysics@elements@recordpolar} \tikzphysics@registergeometryrecorder{physicsunwrappedring}{\tikzphysics@elements@recordunwrapped} \tikzphysics@registergeometryrecorder{physicsrectangularelement}{\tikzphysics@elements@recordrectangle} %% ============================================================ %% KEYS, STYLES, AND DIMENSION OVERLAYS %% ============================================================ \tikzset{ physics element inner radius/.code={\def\tikzphysics@elements@innervalue{#1}}, physics element outer radius/.code={% \def\tikzphysics@elements@outervalue{#1}% \def\tikzphysics@elements@thicknessflag{0}}, physics element radial thickness/.code={% \def\tikzphysics@elements@thicknessvalue{#1}% \def\tikzphysics@elements@thicknessflag{1}}, physics element start angle/.code={\def\tikzphysics@elements@startvalue{#1}}, physics element delta angle/.code={\def\tikzphysics@elements@deltavalue{#1}}, physics element dimension offset/.code={\def\tikzphysics@elements@dimensionoffsetvalue{#1}}, physics element diagram gap/.code={\def\tikzphysics@elements@diagramgapvalue{#1}}, physics element body radius/.code={\def\tikzphysics@elements@bodyradiusvalue{#1}}, physics element center dot radius/.code={\def\tikzphysics@elements@centerdotradiusvalue{#1}}, physics element width/.code={\def\tikzphysics@elements@widthvalue{#1}}, physics element height/.code={\def\tikzphysics@elements@heightvalue{#1}}, physics element body width/.code={\def\tikzphysics@elements@bodywidthvalue{#1}}, physics element body height/.code={\def\tikzphysics@elements@bodyheightvalue{#1}}, physics element axial thickness/.code={\def\tikzphysics@elements@axialthicknessvalue{#1}}, physics element position/.code={\def\tikzphysics@elements@positionvalue{#1}}, physics element transverse position/.code={\def\tikzphysics@elements@transversepositionvalue{#1}}, physics element projection ratio/.code={\def\tikzphysics@elements@projectionratiovalue{#1}}, physics element radius label/.code={\def\tikzphysics@elements@radiuslabel{#1}}, physics element radial label/.code={\def\tikzphysics@elements@radiallabel{#1}}, physics element angular label/.code={\def\tikzphysics@elements@angularlabel{#1}}, physics element arc label/.code={\def\tikzphysics@elements@arclabel{#1}}, physics element circumference label/.code={\def\tikzphysics@elements@circumferencelabel{#1}}, physics element width label/.code={\def\tikzphysics@elements@widthlabel{#1}}, physics element height label/.code={\def\tikzphysics@elements@heightlabel{#1}}, physics element axial label/.code={\def\tikzphysics@elements@axiallabel{#1}}, physics element body radius label/.code={\def\tikzphysics@elements@bodyradiuslabel{#1}}, physics element cavity radius label/.code={\def\tikzphysics@elements@cavityradiuslabel{#1}}, physics element formula label/.code={\def\tikzphysics@elements@formulalabel{#1}}, physics element source/.code={% \ifcsname tikzphysics@geometry@value@#1@inner radius\endcsname \edef\tikzphysics@elements@innervalue{% \csname tikzphysics@geometry@value@#1@inner radius\endcsname}% \edef\tikzphysics@elements@outervalue{% \csname tikzphysics@geometry@value@#1@outer radius\endcsname}% \def\tikzphysics@elements@thicknessflag{0}% \else \PackageError{tikzphysics}{element source `#1' has no radial geometry}% {Name a polar element or differential ring before using it as a source.}% \fi}, element inner radius/.style={physics element inner radius={#1}}, element outer radius/.style={physics element outer radius={#1}}, element radial thickness/.style={physics element radial thickness={#1}}, element start angle/.style={physics element start angle={#1}}, element delta angle/.style={physics element delta angle={#1}}, element dimension offset/.style={physics element dimension offset={#1}}, element diagram gap/.style={physics element diagram gap={#1}}, element body radius/.style={physics element body radius={#1}}, element center dot radius/.style={physics element center dot radius={#1}}, element width/.style={physics element width={#1}}, element height/.style={physics element height={#1}}, element body width/.style={physics element body width={#1}}, element body height/.style={physics element body height={#1}}, element axial thickness/.style={physics element axial thickness={#1}}, element position/.style={physics element position={#1}}, element transverse position/.style={physics element transverse position={#1}}, element projection ratio/.style={physics element projection ratio={#1}}, element radius label/.style={physics element radius label={#1}}, element radial label/.style={physics element radial label={#1}}, element angular label/.style={physics element angular label={#1}}, element arc label/.style={physics element arc label={#1}}, element circumference label/.style={physics element circumference label={#1}}, element width label/.style={physics element width label={#1}}, element height label/.style={physics element height label={#1}}, element axial label/.style={physics element axial label={#1}}, element body radius label/.style={physics element body radius label={#1}}, element cavity radius label/.style={physics element cavity radius label={#1}}, element formula label/.style={physics element formula label={#1}}, source element/.style={physics element source={#1}}, physics element defaults/.style={ physics element inner radius=1.8cm, physics element outer radius=2cm, physics element start angle=30, physics element delta angle=30, physics element dimension offset=4mm, physics element diagram gap=5mm, physics element body radius=2cm, physics element center dot radius=1.2pt, physics element width=8mm, physics element height=6mm, physics element body width=5cm, physics element body height=3cm, physics element axial thickness=2mm, physics element position=0.55, physics element transverse position=0.58, physics element projection ratio=0.28, physics element radius label={$r$}, physics element radial label={$d\!r$}, physics element angular label={$d\!\theta$}, physics element arc label={$r\,d\!\theta$}, physics element circumference label={$2\pi r$}, physics element width label={$d\!x$}, physics element height label={$d\!y$}, physics element axial label={$d\!x$}, physics element body radius label={$R$}, physics element cavity radius label={$a$}, physics element formula label={}, }, physics polar element base/.style={ physics element defaults, shape=physicspolarelement, physics geometry shape=physicspolarelement, draw=black,fill=white,pattern=north east lines,pattern color=black, inner sep=0pt,outer sep=0pt, physics debug setup,every physics object, }, physicspolarelement/.style={ physics polar element base, physics logical shape=physicspolarelement, every polar element, }, physicsdifferentialsector/.style={ physics polar element base, physics element inner radius=0cm, physics logical shape=physicsdifferentialsector, every polar element,every differential sector, }, physicsdifferentialring/.style={ physics polar element base, physics element delta angle=360, physics logical shape=physicsdifferentialring, every polar element,every differential ring, }, physicsunwrappedring/.style={ physics element defaults, shape=physicsunwrappedring, physics geometry shape=physicsunwrappedring, physics logical shape=physicsunwrappedring, draw=black,fill=white,pattern=north east lines,pattern color=black, inner sep=0pt,outer sep=0pt, physics debug setup,every physics object,every unwrapped ring, }, physicssphericalshell/.style={ physics polar element base, physics element inner radius=1cm, physics element radial thickness=1.5mm, physics element delta angle=360, physics logical shape=physicssphericalshell, every polar element,every spherical shell, }, physicshollowsphere/.style={ physics polar element base, physics element inner radius=1cm, physics element outer radius=2cm, physics element delta angle=360, physics logical shape=physicshollowsphere, every polar element,every hollow sphere, }, physics rectangular element base/.style={ physics element defaults, shape=physicsrectangularelement, physics geometry shape=physicsrectangularelement, draw=black,fill=white,pattern=north east lines,pattern color=black, inner sep=0pt,outer sep=0pt, physics debug setup,every physics object, }, physicsrectangularelement/.style={ physics rectangular element base, physics logical shape=physicsrectangularelement, every rectangular element, }, physicsrectangularstrip/.style={ physics rectangular element base, physics element width=4cm, physics element height=2mm, physics element width label={$b$}, physics element height label={$d\!x$}, physics logical shape=physicsrectangularstrip, every rectangular element,every rectangular strip, }, physicsrectangularsheet/.style={ physics element defaults, shape=physicsrectangularelement, physics geometry shape=physicsrectangularelement, physics element width=5cm, physics element height=3cm, physics logical shape=physicsrectangularsheet, draw=black,fill=white,inner sep=0pt,outer sep=0pt, physics debug setup,every physics object,every rectangular sheet, }, physics polar element/.style={physicspolarelement}, physics differential sector/.style={physicsdifferentialsector}, physics differential ring/.style={physicsdifferentialring}, physics unwrapped ring/.style={physicsunwrappedring}, physics spherical shell/.style={physicssphericalshell}, physics hollow sphere/.style={physicshollowsphere}, physics rectangular element/.style={physicsrectangularelement}, physics rectangular strip/.style={physicsrectangularstrip}, physics rectangular sheet/.style={physicsrectangularsheet}, polar element/.style={physicspolarelement}, differential sector/.style={physicsdifferentialsector}, differential ring/.style={physicsdifferentialring}, unwrapped ring/.style={physicsunwrappedring}, spherical shell/.style={physicssphericalshell}, hollow sphere/.style={physicshollowsphere}, rectangular element/.style={physicsrectangularelement}, rectangular strip/.style={physicsrectangularstrip}, rectangular sheet/.style={physicsrectangularsheet}, every physics element dimension/.style={/utils/exec={\tikz@textfont},draw=black,>=latex}, every element dimension/.style={every physics element dimension}, every physics element label/.style={inner sep=.12em,fill=white}, every element label/.style={every physics element label}, every physics element body/.style={draw=black,fill=none}, every element body/.style={every physics element body}, every physics element center/.style={fill=black,draw=none}, every element center/.style={every physics element center}, physics element show dimensions/.style={ append after command={\pgfextra{% \edef\tikzphysics@elements@dimensionnode{\tikzlastnode}% \ifx\tikzphysics@elements@dimensionnode\@empty\else \expandafter\tikzphysics@elements@drawdimensions \expandafter{\tikzphysics@elements@dimensionnode}% \fi }}}, show dimensions/.style={physics element show dimensions}, } \def\tikzphysics@elements@drawpolyarc#1#2#3{% \draw[every element dimension] ($(#1.center)!#3!(#1.#2-0)$)-- ($(#1.center)!#3!(#1.#2-10)$)-- ($(#1.center)!#3!(#1.#2-20)$)-- ($(#1.center)!#3!(#1.#2-30)$)-- ($(#1.center)!#3!(#1.#2-40)$)-- ($(#1.center)!#3!(#1.#2-50)$)-- ($(#1.center)!#3!(#1.#2-60)$)-- ($(#1.center)!#3!(#1.#2-70)$)-- ($(#1.center)!#3!(#1.#2-80)$)-- ($(#1.center)!#3!(#1.#2-90)$)-- ($(#1.center)!#3!(#1.#2-100)$);% } \def\tikzphysics@elements@drawdimensions#1{% \begingroup \csname pgf@sh@ma@#1\endcsname \let\tikz@textfont\tikzphysics@elements@savedfont \tikz@textfont \edef\tikzphysics@elements@actualshape{\csname pgf@sh@ns@#1\endcsname}% \def\tikzphysics@elements@unwrappedshape{physicsunwrappedring}% \def\tikzphysics@elements@rectangleshape{physicsrectangularelement}% \ifx\tikzphysics@elements@actualshape\tikzphysics@elements@unwrappedshape \tikzphysics@elements@drawstripdimensions{#1}% \else\ifx\tikzphysics@elements@actualshape\tikzphysics@elements@rectangleshape \tikzphysics@elements@drawrectdimensions{#1}% \else \tikzphysics@elements@drawpolardimensions{#1}% \fi \fi \endgroup } \def\tikzphysics@elements@drawpolardimensions#1{% \begingroup \@tempdima=\geometryvalue{#1}{inner radius}\relax \@tempdimb=\geometryvalue{#1}{outer radius}\relax \tikzphysics@resolve@nonnegative{\tikzphysics@elements@dimensionoffset}% {\tikzphysics@elements@dimensionoffsetvalue}% \pgfmathsetmacro{\tikzphysics@elements@outerfactor}% {1+\tikzphysics@elements@dimensionoffset/\@tempdimb}% \pgfmathparse{abs(\geometryvalue{#1}{delta angle}-360)<0.0001?1:0}% \ifnum\pgfmathresult=1\relax \draw[every element dimension,->] (#1.center)--(#1.inner-start) node[midway,above,sloped,every element label] {\tikzphysics@elements@savedradiuslabel};% \coordinate (tikzphysics-element-dr-label) at ($(#1.inner-start)!2.8!(#1.outer-start)$);% \draw[every element dimension,->] (tikzphysics-element-dr-label)--(#1.outer-start);% \node[every element label,anchor=south] at (tikzphysics-element-dr-label) {\tikzphysics@elements@savedradiallabel};% \else \ifdim\@tempdima=0pt\relax \draw[every element dimension,->] (#1.center)--(#1.outer-start) node[midway,below,sloped,every element label] {\tikzphysics@elements@savedradiuslabel};% \def\tikzphysics@elements@anglefactor{0.5}% \else \draw[every element dimension,->] (#1.center)--(#1.inner-start) node[midway,below,sloped,every element label] {\tikzphysics@elements@savedradiuslabel};% \coordinate (tikzphysics-element-dr-label) at ($(#1.inner-end)!2.8!(#1.outer-end)$);% \draw[every element dimension,->] (tikzphysics-element-dr-label)--(#1.outer-end);% \node[every element label,anchor=south] at (tikzphysics-element-dr-label) {\tikzphysics@elements@savedradiallabel};% %% Keep the angular label in the open centre rather than on the %% shaded annulus, even when the annulus is very thin. \pgfmathsetmacro{\tikzphysics@elements@anglefactor}% {0.46*\@tempdima/\@tempdimb}% \fi \tikzphysics@elements@drawpolyarc{#1}{outer}{\tikzphysics@elements@outerfactor}% \node[every element label] at ($(#1.center)!\tikzphysics@elements@outerfactor!(#1.outer-50)$) {\tikzphysics@elements@savedarclabel};% \pgfmathsetmacro{\tikzphysics@elements@anglearcfactor}{.6*\tikzphysics@elements@anglefactor}% \tikzphysics@elements@drawpolyarc{#1}{outer}{\tikzphysics@elements@anglearcfactor}% \node[every element label] at ($(#1.center)!\tikzphysics@elements@anglefactor!(#1.outer-50)$) {\tikzphysics@elements@savedangularlabel};% \fi \endgroup } %% External arrows point into the two measured boundaries: ->| |<-. %% A fixed-length lead remains legible even for differential thicknesses. \def\tikzphysics@elements@drawexternaldimension#1#2{% \draw[every element dimension,->|] ($(#1)!-4mm!(#2)$)--(#1);% \draw[every element dimension,|<-] (#2)--($(#2)!-4mm!(#1)$);% } \def\tikzphysics@elements@drawstripdimensions#1{% \tikzphysics@elements@drawexternaldimension {[yshift=-4mm]#1.south west}{[yshift=-4mm]#1.south east}% \node[below=4mm,every element label] at (#1.south) {\tikzphysics@elements@savedcircumferencelabel};% \tikzphysics@elements@drawexternaldimension {[xshift=4mm]#1.south east}{[xshift=4mm]#1.north east}% \node[right=5mm,every element label] at (#1.east) {\tikzphysics@elements@savedradiallabel};% } \def\tikzphysics@elements@drawrectdimensions#1{% \tikzphysics@elements@drawexternaldimension {[yshift=-4mm]#1.south west}{[yshift=-4mm]#1.south east}% \node[below=4mm,every element label] at (#1.south) {\tikzphysics@elements@savedwidthlabel};% \tikzphysics@elements@drawexternaldimension {[xshift=4mm]#1.south east}{[xshift=4mm]#1.north east}% \node[right=4mm,every element label] at (#1.east) {\tikzphysics@elements@savedheightlabel};% } %% ============================================================ %% SOLID-BODY TEACHING DIAGRAM HELPERS %% ============================================================ \newdimen\tikzphysics@elements@sliceradius \newdimen\tikzphysics@elements@sliceradiusb \newdimen\tikzphysics@elements@sliceposition \newdimen\tikzphysics@elements@projectionradius \newcommand{\tikzphysics@elements@setsoliddims}{% \tikzphysics@resolve@length{\tikzphysics@elements@bodyradius}% {\tikzphysics@elements@bodyradiusvalue}% \tikzphysics@resolve@length{\tikzphysics@elements@bodywidth}% {\tikzphysics@elements@bodywidthvalue}% \tikzphysics@resolve@length{\tikzphysics@elements@bodyheight}% {\tikzphysics@elements@bodyheightvalue}% \tikzphysics@resolve@length{\tikzphysics@elements@axialthickness}% {\tikzphysics@elements@axialthicknessvalue}% \pgfmathparse{\tikzphysics@elements@projectionratiovalue}% \ifpgfmathunitsdeclared \PackageError{tikzphysics}{element projection ratio must be unitless}% {Use a number greater than zero and at most one.}% \fi \edef\tikzphysics@elements@projectionratio{\pgfmathresult}% \ifdim\tikzphysics@elements@projectionratio pt>0pt\relax\else \PackageError{tikzphysics}{element projection ratio must be greater than zero}% {Use a number in the interval (0,1].}% \fi \ifdim\tikzphysics@elements@projectionratio pt>1pt\relax \PackageError{tikzphysics}{element projection ratio must not exceed one}% {Use a number in the interval (0,1].}% \fi } \newcommand{\tikzphysics@elements@setunitposition}{% \pgfmathparse{\tikzphysics@elements@positionvalue}% \ifpgfmathunitsdeclared \PackageError{tikzphysics}{element position must be unitless}% {Use a number in the interval [0,1].}% \fi \edef\tikzphysics@elements@position{\pgfmathresult}% \ifdim\tikzphysics@elements@position pt<0pt\relax \PackageError{tikzphysics}{element position must not be negative}% {Use a number in the interval [0,1].}% \fi \ifdim\tikzphysics@elements@position pt>1pt\relax \PackageError{tikzphysics}{element position must not exceed one}% {Use a number in the interval [0,1].}% \fi } \newcommand{\tikzphysics@elements@setsphereposition}{% \pgfmathparse{\tikzphysics@elements@positionvalue}% \ifpgfmathunitsdeclared \PackageError{tikzphysics}{sphere-slice position must be unitless}% {Use a number strictly between -1 and 1.}% \fi \edef\tikzphysics@elements@position{\pgfmathresult}% \pgfmathparse{abs(\tikzphysics@elements@position)<1?1:0}% \ifnum\pgfmathresult=1\relax\else \PackageError{tikzphysics}{sphere-slice position must lie between -1 and 1}% {The value is the signed axial position divided by the sphere radius.}% \fi } \newcommand{\tikzphysics@elements@drawformula}[2]{% \def\tikzphysics@elements@emptyformula{}% \ifx#2\tikzphysics@elements@emptyformula\else \node[every element label,anchor=north] at (#1) {#2};% \fi } \tikzset{ every physics solid hidden edge/.style={draw=black,dashed}, every solid hidden edge/.style={every physics solid hidden edge}, every physics solid element/.style={draw=black,fill=white, pattern=north east lines,pattern color=black}, every solid element/.style={every physics solid element}, } %% Projected horizontal circles use a dashed rear half and solid front half. %% Keeping these as paths preserves native TikZ styling through the two hooks. \def\tikzphysics@elements@drawprojectedbodyellipse#1#2#3{% \draw[every solid hidden edge] (#1,#2) arc[start angle=0,end angle=180,x radius=#1,y radius=#3];% \draw[every element body] (-#1,#2) arc[start angle=180,end angle=360,x radius=#1,y radius=#3];% } \def\tikzphysics@elements@drawprojectedelementellipse#1#2#3{% \draw[every solid hidden edge] (#1,#2) arc[start angle=0,end angle=180,x radius=#1,y radius=#3];% \draw[every element dimension] (-#1,#2) arc[start angle=180,end angle=360,x radius=#1,y radius=#3];% } %% Pic percentage coordinates follow the actual projected circle, not a %% rectangular component's placement box. Angles run counterclockwise from right. \def\tikzphysics@elements@picellipse#1#2#3#4#5{% \foreach \tikzphysics@elements@percent in {0,...,100}{% \pgfmathsetlength{\@tempdima}{(#2)+(#4)*cos(3.6*\tikzphysics@elements@percent)}% \edef\tikzphysics@elements@picx{\the\@tempdima}% \pgfmathsetlength{\@tempdima}{(#3)+(#5)*sin(3.6*\tikzphysics@elements@percent)}% \coordinate (-#1-\tikzphysics@elements@percent) at (\tikzphysics@elements@picx,\@tempdima);% }% } \def\tikzphysics@elements@picheight#1#2{% \coordinate (-height-start) at (0,#1);% \coordinate (-height-end) at (0,#2);% \foreach \tikzphysics@elements@percent in {0,...,100}{% \pgfmathsetmacro{\tikzphysics@elements@fraction}{\tikzphysics@elements@percent/100}% \coordinate (-height-\tikzphysics@elements@percent) at ($(-height-start)!\tikzphysics@elements@fraction!(-height-end)$);% }% } %% A named pic recreates the original ring-plus-unwrapped-strip teaching %% diagram while leaving both parts available as (name-ring) and (name-strip). \tikzset{ pics/differential ring diagram/.style args={#1}{code={% \tikzset{physics element defaults, element inner radius=1cm,element outer radius=1.2cm, element body radius=2cm,element diagram gap=5mm, every differential ring diagram,#1}% \edef\tikzphysics@elements@picinner{\tikzphysics@elements@innervalue}% \edef\tikzphysics@elements@picouter{\tikzphysics@elements@outervalue}% \edef\tikzphysics@elements@picthickness{\tikzphysics@elements@thicknessvalue}% \edef\tikzphysics@elements@picthicknessflag{\tikzphysics@elements@thicknessflag}% \edef\tikzphysics@elements@picradiuslabel{\unexpanded\expandafter{\tikzphysics@elements@radiuslabel}}% \edef\tikzphysics@elements@picradiallabel{\unexpanded\expandafter{\tikzphysics@elements@radiallabel}}% \edef\tikzphysics@elements@piccircumferencelabel{\unexpanded\expandafter{\tikzphysics@elements@circumferencelabel}}% \tikzphysics@elements@setpolardims \tikzphysics@resolve@length{\tikzphysics@elements@bodyradius}% {\tikzphysics@elements@bodyradiusvalue}% \ifdim\tikzphysics@elements@bodyradius>\tikzphysics@elements@outer\relax\else \PackageError{tikzphysics}{element body radius must exceed the ring outer radius}% {Increase element body radius or reduce the differential ring radius.}% \fi \tikzphysics@resolve@nonnegative{\tikzphysics@elements@centerdotradius}% {\tikzphysics@elements@centerdotradiusvalue}% \tikzphysics@resolve@length{\tikzphysics@elements@diagramgap}% {\tikzphysics@elements@diagramgapvalue}% \@tempdima=\tikzphysics@elements@bodyradius \advance\@tempdima by \tikzphysics@elements@diagramgap \edef\tikzphysics@elements@picy{\the\@tempdima}% \draw[every element body] (0,0) circle[radius=\tikzphysics@elements@bodyradius]; \fill[every element center] (0,0) circle[radius=\tikzphysics@elements@centerdotradius]; \coordinate (-center) at (0,0); \coordinate (-body-north) at (0,\tikzphysics@elements@bodyradius); \coordinate (-body-south) at (0,-\tikzphysics@elements@bodyradius); \coordinate (-body-east) at (\tikzphysics@elements@bodyradius,0); \coordinate (-body-west) at (-\tikzphysics@elements@bodyradius,0); \ifnum\tikzphysics@elements@picthicknessflag=1\relax \node[differential ring, element inner radius=\tikzphysics@elements@picinner, element radial thickness=\tikzphysics@elements@picthickness, element radius label={\tikzphysics@elements@picradiuslabel}, element radial label={\tikzphysics@elements@picradiallabel}, show dimensions] (-ring) {}; \node[unwrapped ring, element inner radius=\tikzphysics@elements@picinner, element radial thickness=\tikzphysics@elements@picthickness, element radial label={\tikzphysics@elements@picradiallabel}, element circumference label={\tikzphysics@elements@piccircumferencelabel}, show dimensions,anchor=north] (-strip) at (0,-\tikzphysics@elements@picy) {}; \else \node[differential ring, element inner radius=\tikzphysics@elements@picinner, element outer radius=\tikzphysics@elements@picouter, element radius label={\tikzphysics@elements@picradiuslabel}, element radial label={\tikzphysics@elements@picradiallabel}, show dimensions] (-ring) {}; \node[unwrapped ring, element inner radius=\tikzphysics@elements@picinner, element outer radius=\tikzphysics@elements@picouter, element radial label={\tikzphysics@elements@picradiallabel}, element circumference label={\tikzphysics@elements@piccircumferencelabel}, show dimensions,anchor=north] (-strip) at (0,-\tikzphysics@elements@picy) {}; \fi }}, pics/differential ring diagram/.default={}, pics/physics differential ring diagram/.style args={#1}{differential ring diagram={#1}}, pics/physics differential ring diagram/.default={}, } %% Complete solid-body constructions. The highlighted differential part is a %% named node whenever its 2-D section is rectangular or annular. \tikzset{ pics/sphere shell diagram/.style args={#1}{code={% \tikzset{physics element defaults, element inner radius=1cm,element radial thickness=1.5mm, element body radius=2cm, element formula label={$dV=4\pi r^2\,d\!r$}, every sphere shell diagram,#1}% \edef\tikzphysics@elements@picinner{\tikzphysics@elements@innervalue}% \edef\tikzphysics@elements@picthickness{\tikzphysics@elements@thicknessvalue}% \edef\tikzphysics@elements@picradiuslabel{\unexpanded\expandafter{\tikzphysics@elements@radiuslabel}}% \edef\tikzphysics@elements@picradiallabel{\unexpanded\expandafter{\tikzphysics@elements@radiallabel}}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \tikzphysics@elements@setpolardims \tikzphysics@resolve@length{\tikzphysics@elements@bodyradius}% {\tikzphysics@elements@bodyradiusvalue}% \ifdim\tikzphysics@elements@outer<\tikzphysics@elements@bodyradius\relax\else \PackageError{tikzphysics}{spherical shell must lie inside the sphere body}% {Reduce the shell radius or increase element body radius.}% \fi \@tempdima=2\tikzphysics@elements@bodyradius \edef\tikzphysics@elements@bodydiameter{\the\@tempdima}% \node[circle,minimum size=\tikzphysics@elements@bodydiameter, inner sep=0pt,outer sep=0pt,every element body] (-body) {}; \fill[every element center] (0,0) circle[radius=\tikzphysics@elements@centerdotradiusvalue]; \node[spherical shell, element inner radius=\tikzphysics@elements@picinner, element radial thickness=\tikzphysics@elements@picthickness, element radius label={\tikzphysics@elements@picradiuslabel}, element radial label={\tikzphysics@elements@picradiallabel}, show dimensions] (-shell) {}; \coordinate (-center) at (0,0); \coordinate (-formula-anchor) at ([yshift=-7mm]-body.south); \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/sphere shell diagram/.default={}, pics/physics sphere shell diagram/.style args={#1}{sphere shell diagram={#1}}, pics/physics sphere shell diagram/.default={}, pics/hollow sphere diagram/.style args={#1}{code={% \tikzset{physics element defaults, element inner radius=9mm,element outer radius=2cm, element formula label={$V={4\pi\over3}(R^3-a^3)$}, every hollow sphere diagram,#1}% \edef\tikzphysics@elements@picinner{\tikzphysics@elements@innervalue}% \edef\tikzphysics@elements@picouter{\tikzphysics@elements@outervalue}% \edef\tikzphysics@elements@picbodylabel{\unexpanded\expandafter{\tikzphysics@elements@bodyradiuslabel}}% \edef\tikzphysics@elements@piccavitylabel{\unexpanded\expandafter{\tikzphysics@elements@cavityradiuslabel}}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \node[hollow sphere, element inner radius=\tikzphysics@elements@picinner, element outer radius=\tikzphysics@elements@picouter] (-wall) {}; \fill[every element center] (0,0) circle[radius=\tikzphysics@elements@centerdotradiusvalue]; \draw[every element dimension,->] (-wall.center)--(-wall.inner-0) node[midway,above,sloped,every element label] {\tikzphysics@elements@piccavitylabel}; \draw[every element dimension,->] (-wall.center)--(-wall.outer-30) node[midway,above,sloped,every element label] {\tikzphysics@elements@picbodylabel}; \coordinate (-center) at (-wall.center); \coordinate (-body-north) at (-wall.north); \coordinate (-body-south) at (-wall.south); \coordinate (-formula-anchor) at ([yshift=-7mm]-wall.south); \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/hollow sphere diagram/.default={}, pics/physics hollow sphere diagram/.style args={#1}{hollow sphere diagram={#1}}, pics/physics hollow sphere diagram/.default={}, pics/sphere slice diagram/.style args={#1}{code={% \tikzset{physics element defaults, element body radius=2cm,element axial thickness=2mm, element position=.35,element projection ratio=.24, element formula label={$dV=\pi y^2\,d\!x$}, every sphere slice diagram,#1}% \edef\tikzphysics@elements@picaxiallabel{\unexpanded\expandafter{\tikzphysics@elements@axiallabel}}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \tikzphysics@elements@setsoliddims \tikzphysics@elements@setsphereposition \ifdim\tikzphysics@elements@axialthickness<\tikzphysics@elements@bodyradius\relax\else \PackageError{tikzphysics}{sphere-slice thickness is too large}% {Use an axial thickness smaller than the sphere radius.}% \fi \pgfmathparse{abs(\tikzphysics@elements@position)+ .5*\tikzphysics@elements@axialthickness/\tikzphysics@elements@bodyradius<1?1:0}% \ifnum\pgfmathresult=1\relax\else \PackageError{tikzphysics}{sphere slice extends beyond the sphere body}% {Move element position toward zero or reduce element axial thickness.}% \fi \pgfmathsetlength{\tikzphysics@elements@sliceposition}% {\tikzphysics@elements@position*\tikzphysics@elements@bodyradius}% \pgfmathsetlength{\tikzphysics@elements@sliceradius}% {sqrt(1-(\tikzphysics@elements@position)^2)*\tikzphysics@elements@bodyradius}% \pgfmathsetlength{\tikzphysics@elements@projectionradius}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@sliceradius}% \@tempdima=2\tikzphysics@elements@bodyradius \edef\tikzphysics@elements@bodydiameter{\the\@tempdima}% \@tempdima=2\tikzphysics@elements@sliceradius \edef\tikzphysics@elements@slicediameter{\the\@tempdima}% \node[circle,minimum size=\tikzphysics@elements@bodydiameter, inner sep=0pt,outer sep=0pt,every element body] (-body) {}; \node[rectangular element, element width=\tikzphysics@elements@axialthickness, element height=\tikzphysics@elements@slicediameter] (-slice) at (\tikzphysics@elements@sliceposition,0) {}; \begin{scope}[xshift=\tikzphysics@elements@sliceposition] %% A vertical disk hides its left half and shows its right half. \draw[every solid hidden edge] (0,\tikzphysics@elements@sliceradius) arc[start angle=90,end angle=270, x radius=\tikzphysics@elements@projectionradius, y radius=\tikzphysics@elements@sliceradius]; \draw[every element dimension] (0,-\tikzphysics@elements@sliceradius) arc[start angle=-90,end angle=90, x radius=\tikzphysics@elements@projectionradius, y radius=\tikzphysics@elements@sliceradius]; \end{scope} \draw[every element dimension,->] (0,0)--(\tikzphysics@elements@sliceposition,0) node[midway,above,every element label] {$x$}; \draw[every element dimension,->] (-slice.center)--(-slice.north) node[midway,left,every element label] {$y$}; \tikzphysics@elements@drawexternaldimension {[yshift=-4.5mm]-slice.south west}{[yshift=-4.5mm]-slice.south east}% \node[below=6mm,every element label] at (-slice.south) {\tikzphysics@elements@picaxiallabel}; \fill[every element center] (0,0) circle[radius=\tikzphysics@elements@centerdotradiusvalue]; \coordinate (-center) at (0,0); \coordinate (-formula-anchor) at ([yshift=-11mm]-body.south); \tikzphysics@elements@picellipse{disk-rim}{\tikzphysics@elements@sliceposition}{0pt} {\tikzphysics@elements@projectionradius}{\tikzphysics@elements@sliceradius} \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/sphere slice diagram/.default={}, pics/physics sphere slice diagram/.style args={#1}{sphere slice diagram={#1}}, pics/physics sphere slice diagram/.default={}, } \tikzset{ pics/cylinder shell diagram/.style args={#1}{code={% \tikzset{physics element defaults, element body radius=1.6cm,element body height=3.4cm, element inner radius=9mm,element radial thickness=1.5mm, element projection ratio=.25, element formula label={$dV=2\pi r h\,d\!r$}, every cylinder shell diagram,#1}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \edef\tikzphysics@elements@picradiuslabel{\unexpanded\expandafter{\tikzphysics@elements@radiuslabel}}% \edef\tikzphysics@elements@picradiallabel{\unexpanded\expandafter{\tikzphysics@elements@radiallabel}}% \tikzphysics@elements@setsoliddims \tikzphysics@elements@setpolardims \ifdim\tikzphysics@elements@outer<\tikzphysics@elements@bodyradius\relax\else \PackageError{tikzphysics}{cylindrical shell must lie inside the cylinder body}% {Reduce the shell radius or increase element body radius.}% \fi \pgfmathsetlength{\tikzphysics@elements@projectionradius}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@bodyradius}% \pgfmathsetlength{\@tempdima}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@inner}% \edef\tikzphysics@elements@innerprojection{\the\@tempdima}% \pgfmathsetlength{\@tempdima}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@outer}% \edef\tikzphysics@elements@outerprojection{\the\@tempdima}% \@tempdima=.5\tikzphysics@elements@bodyheight \edef\tikzphysics@elements@bodytop{\the\@tempdima}% \@tempdima=-.5\tikzphysics@elements@bodyheight \edef\tikzphysics@elements@bodybottom{\the\@tempdima}% \@tempdima=2\tikzphysics@elements@bodyradius \edef\tikzphysics@elements@bodydiameter{\the\@tempdima}% \@tempdima=\tikzphysics@elements@bodyheight \advance\@tempdima by 2\tikzphysics@elements@projectionradius \edef\tikzphysics@elements@bodytotalheight{\the\@tempdima}% \node[draw=none,inner sep=0pt,outer sep=0pt, minimum width=\tikzphysics@elements@bodydiameter, minimum height=\tikzphysics@elements@bodytotalheight] (-body) {}; \draw[every element body] (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodybottom)-- (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodytop) (\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodybottom)-- (\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodytop); \tikzphysics@elements@drawprojectedbodyellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@projectionradius} \tikzphysics@elements@drawprojectedbodyellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@bodybottom} {\tikzphysics@elements@projectionradius} \path[every solid element] (-\tikzphysics@elements@outer,\tikzphysics@elements@bodybottom) rectangle (-\tikzphysics@elements@inner,\tikzphysics@elements@bodytop) (\tikzphysics@elements@inner,\tikzphysics@elements@bodybottom) rectangle (\tikzphysics@elements@outer,\tikzphysics@elements@bodytop); \path[every solid element,draw=none,even odd rule] (0,\tikzphysics@elements@bodytop) ellipse[x radius=\tikzphysics@elements@outer, y radius=\tikzphysics@elements@outerprojection] (0,\tikzphysics@elements@bodytop) ellipse[x radius=\tikzphysics@elements@inner, y radius=\tikzphysics@elements@innerprojection]; \tikzphysics@elements@drawprojectedelementellipse {\tikzphysics@elements@outer}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@outerprojection} \tikzphysics@elements@drawprojectedelementellipse {\tikzphysics@elements@inner}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@innerprojection} \draw[every element dimension] (0,\tikzphysics@elements@bodybottom)--(\tikzphysics@elements@inner,\tikzphysics@elements@bodybottom) node[midway,below,every element label]{\tikzphysics@elements@picradiuslabel}; \pgfmathsetlengthmacro{\tikzphysics@elements@radialdimensiony} {\tikzphysics@elements@bodytop+\tikzphysics@elements@projectionradius+1mm}% \draw[every element dimension] (\tikzphysics@elements@inner,\tikzphysics@elements@bodytop)-- (\tikzphysics@elements@inner,\tikzphysics@elements@radialdimensiony) (\tikzphysics@elements@outer,\tikzphysics@elements@bodytop)-- (\tikzphysics@elements@outer,\tikzphysics@elements@radialdimensiony); \tikzphysics@elements@drawexternaldimension {\tikzphysics@elements@inner,\tikzphysics@elements@radialdimensiony} {\tikzphysics@elements@outer,\tikzphysics@elements@radialdimensiony}% \node[above=1mm,every element label] at ($ (\tikzphysics@elements@inner,\tikzphysics@elements@radialdimensiony)! .5!(\tikzphysics@elements@outer,\tikzphysics@elements@radialdimensiony) $) {\tikzphysics@elements@picradiallabel}; \tikzphysics@elements@picheight{\tikzphysics@elements@bodybottom}{\tikzphysics@elements@bodytop} \draw[every element dimension] (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodybottom) ++(-4mm,0)--++(-3mm,0) (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodytop) ++(-4mm,0)--++(-3mm,0) ($(-body.west)+(0,\tikzphysics@elements@bodybottom)+(-5.5mm,0)$)-- ($(-body.west)+(0,\tikzphysics@elements@bodytop)+(-5.5mm,0)$); \node[left=8mm,every element label] at (-body.west) {$h$}; \node[draw=none,inner sep=0pt,outer sep=0pt, minimum width=2\tikzphysics@elements@outer, minimum height=\tikzphysics@elements@bodyheight] (-shell) {}; \coordinate (-center) at (0,0); \coordinate (-formula-anchor) at ([yshift=-7mm]-body.south); \tikzphysics@elements@picellipse{body-rim}{0pt}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@projectionradius} \tikzphysics@elements@picellipse{shell-outer-rim}{0pt}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@outer}{\tikzphysics@elements@outerprojection} \tikzphysics@elements@picellipse{shell-inner-rim}{0pt}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@inner}{\tikzphysics@elements@innerprojection} \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/cylinder shell diagram/.default={}, pics/physics cylinder shell diagram/.style args={#1}{cylinder shell diagram={#1}}, pics/physics cylinder shell diagram/.default={}, pics/cylinder slice diagram/.style args={#1}{code={% \tikzset{physics element defaults, element body radius=1.6cm,element body height=3.4cm, element axial thickness=2mm,element position=.55, element projection ratio=.25,element axial label={$d\!z$}, element formula label={$dV=\pi R^2\,d\!z$}, every cylinder slice diagram,#1}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \edef\tikzphysics@elements@picaxiallabel{\unexpanded\expandafter{\tikzphysics@elements@axiallabel}}% \tikzphysics@elements@setsoliddims \tikzphysics@elements@setunitposition \ifdim\tikzphysics@elements@axialthickness<\tikzphysics@elements@bodyheight\relax\else \PackageError{tikzphysics}{cylinder-slice thickness must be smaller than body height}% {Reduce element axial thickness.}% \fi \pgfmathparse{\tikzphysics@elements@position- .5*\tikzphysics@elements@axialthickness/\tikzphysics@elements@bodyheight>=0 && \tikzphysics@elements@position+ .5*\tikzphysics@elements@axialthickness/\tikzphysics@elements@bodyheight<=1?1:0}% \ifnum\pgfmathresult=1\relax\else \PackageError{tikzphysics}{cylinder slice extends beyond the cylinder body}% {Move element position away from the end or reduce element axial thickness.}% \fi \pgfmathsetlength{\tikzphysics@elements@projectionradius}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@bodyradius}% \@tempdima=.5\tikzphysics@elements@bodyheight \edef\tikzphysics@elements@bodytop{\the\@tempdima}% \@tempdima=-.5\tikzphysics@elements@bodyheight \edef\tikzphysics@elements@bodybottom{\the\@tempdima}% \pgfmathsetlength{\tikzphysics@elements@sliceposition}% {-.5*\tikzphysics@elements@bodyheight+ \tikzphysics@elements@position*\tikzphysics@elements@bodyheight}% \@tempdima=\tikzphysics@elements@sliceposition \advance\@tempdima by .5\tikzphysics@elements@axialthickness \edef\tikzphysics@elements@slicetop{\the\@tempdima}% \@tempdima=\tikzphysics@elements@sliceposition \advance\@tempdima by -.5\tikzphysics@elements@axialthickness \edef\tikzphysics@elements@slicebottom{\the\@tempdima}% \@tempdima=2\tikzphysics@elements@bodyradius \edef\tikzphysics@elements@bodydiameter{\the\@tempdima}% \@tempdima=\tikzphysics@elements@bodyheight \advance\@tempdima by 2\tikzphysics@elements@projectionradius \edef\tikzphysics@elements@bodytotalheight{\the\@tempdima}% \node[draw=none,inner sep=0pt,outer sep=0pt, minimum width=\tikzphysics@elements@bodydiameter, minimum height=\tikzphysics@elements@bodytotalheight] (-body) {}; \draw[every element body] (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodybottom)-- (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodytop) (\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodybottom)-- (\tikzphysics@elements@bodyradius,\tikzphysics@elements@bodytop); \tikzphysics@elements@drawprojectedbodyellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@projectionradius} \tikzphysics@elements@drawprojectedbodyellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@bodybottom} {\tikzphysics@elements@projectionradius} \path[every solid element,draw=none] (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@slicebottom) rectangle (\tikzphysics@elements@bodyradius,\tikzphysics@elements@slicetop); \path[every solid element,draw=none] (0,\tikzphysics@elements@slicetop) ellipse[x radius=\tikzphysics@elements@bodyradius,y radius=\tikzphysics@elements@projectionradius]; \draw[every element dimension] (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@slicebottom)-- (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@slicetop) (\tikzphysics@elements@bodyradius,\tikzphysics@elements@slicebottom)-- (\tikzphysics@elements@bodyradius,\tikzphysics@elements@slicetop); \tikzphysics@elements@drawprojectedelementellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@slicetop} {\tikzphysics@elements@projectionradius} \tikzphysics@elements@drawprojectedelementellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@slicebottom} {\tikzphysics@elements@projectionradius} \node[draw=none,inner sep=0pt,outer sep=0pt, minimum width=\tikzphysics@elements@bodydiameter, minimum height=\tikzphysics@elements@axialthickness] (-slice) at (0,\tikzphysics@elements@sliceposition) {}; \tikzphysics@elements@drawexternaldimension {[xshift=4.5mm]-slice.south east}{[xshift=4.5mm]-slice.north east}% \node[right=7mm,every element label] at (-slice.east) {\tikzphysics@elements@picaxiallabel}; \draw[every element dimension,->] (-slice.center)--(-slice.east) node[midway,above,every element label]{\tikzphysics@elements@bodyradiuslabel}; \coordinate (-center) at (0,0); \coordinate (-formula-anchor) at ([yshift=-7mm]-body.south); \tikzphysics@elements@picheight{\tikzphysics@elements@bodybottom}{\tikzphysics@elements@bodytop} \tikzphysics@elements@picellipse{body-rim}{0pt}{\tikzphysics@elements@bodytop} {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@projectionradius} \tikzphysics@elements@picellipse{slice-top-rim}{0pt}{\tikzphysics@elements@slicetop} {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@projectionradius} \tikzphysics@elements@picellipse{slice-bottom-rim}{0pt}{\tikzphysics@elements@slicebottom} {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@projectionradius} \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/cylinder slice diagram/.default={}, pics/physics cylinder slice diagram/.style args={#1}{cylinder slice diagram={#1}}, pics/physics cylinder slice diagram/.default={}, } \tikzset{ pics/cone slice diagram/.style args={#1}{code={% \tikzset{physics element defaults, element body radius=1.8cm,element body height=4cm, element axial thickness=2mm,element position=.58, element projection ratio=.24, element formula label={$dV=\pi r(x)^2\,d\!x$}, every cone slice diagram,#1}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \edef\tikzphysics@elements@picaxiallabel{\unexpanded\expandafter{\tikzphysics@elements@axiallabel}}% \edef\tikzphysics@elements@picradiuslabel{\unexpanded\expandafter{\tikzphysics@elements@radiuslabel}}% \tikzphysics@elements@setsoliddims \tikzphysics@elements@setunitposition \ifdim\tikzphysics@elements@position pt>0pt\relax\else \PackageError{tikzphysics}{cone-slice position must be greater than zero}% {Use a number in the interval (0,1).}% \fi \ifdim\tikzphysics@elements@position pt<1pt\relax\else \PackageError{tikzphysics}{cone-slice position must be less than one}% {Use a number in the interval (0,1).}% \fi \pgfmathsetlength{\tikzphysics@elements@sliceposition}% {.5*\tikzphysics@elements@bodyheight- \tikzphysics@elements@position*\tikzphysics@elements@bodyheight}% \pgfmathsetlength{\tikzphysics@elements@sliceradius}% {\tikzphysics@elements@position*\tikzphysics@elements@bodyradius}% \pgfmathsetmacro{\tikzphysics@elements@positionb}% {\tikzphysics@elements@position+ \tikzphysics@elements@axialthickness/\tikzphysics@elements@bodyheight}% \ifdim\tikzphysics@elements@positionb pt<1pt\relax\else \PackageError{tikzphysics}{cone slice extends beyond the base}% {Reduce element axial thickness or element position.}% \fi \pgfmathsetlength{\tikzphysics@elements@sliceradiusb}% {\tikzphysics@elements@positionb*\tikzphysics@elements@bodyradius}% \pgfmathsetlength{\tikzphysics@elements@projectionradius}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@bodyradius}% \pgfmathsetlength{\@tempdima}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@sliceradius}% \edef\tikzphysics@elements@sliceprojection{\the\@tempdima}% \pgfmathsetlength{\@tempdima}% {\tikzphysics@elements@projectionratio*\tikzphysics@elements@sliceradiusb}% \edef\tikzphysics@elements@sliceprojectionb{\the\@tempdima}% \@tempdima=.5\tikzphysics@elements@bodyheight \edef\tikzphysics@elements@apexy{\the\@tempdima}% \@tempdima=-.5\tikzphysics@elements@bodyheight \edef\tikzphysics@elements@basey{\the\@tempdima}% \@tempdima=\tikzphysics@elements@sliceposition \advance\@tempdima by -\tikzphysics@elements@axialthickness \edef\tikzphysics@elements@slicebottom{\the\@tempdima}% \@tempdima=2\tikzphysics@elements@bodyradius \edef\tikzphysics@elements@bodydiameter{\the\@tempdima}% \@tempdima=\tikzphysics@elements@bodyheight \advance\@tempdima by 2\tikzphysics@elements@projectionradius \edef\tikzphysics@elements@bodytotalheight{\the\@tempdima}% \node[draw=none,inner sep=0pt,outer sep=0pt, minimum width=\tikzphysics@elements@bodydiameter, minimum height=\tikzphysics@elements@bodytotalheight] (-body) {}; \draw[every element body] (0,\tikzphysics@elements@apexy)-- (-\tikzphysics@elements@bodyradius,\tikzphysics@elements@basey) (0,\tikzphysics@elements@apexy)-- (\tikzphysics@elements@bodyradius,\tikzphysics@elements@basey); \tikzphysics@elements@drawprojectedbodyellipse {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@basey} {\tikzphysics@elements@projectionradius} \path[every solid element,draw=none] (-\tikzphysics@elements@sliceradius,\tikzphysics@elements@sliceposition)-- (-\tikzphysics@elements@sliceradiusb,\tikzphysics@elements@slicebottom)-- (\tikzphysics@elements@sliceradiusb,\tikzphysics@elements@slicebottom)-- (\tikzphysics@elements@sliceradius,\tikzphysics@elements@sliceposition)--cycle; \path[every solid element,draw=none] (0,\tikzphysics@elements@sliceposition) ellipse[x radius=\tikzphysics@elements@sliceradius, y radius=\tikzphysics@elements@sliceprojection]; \draw[every element dimension] (-\tikzphysics@elements@sliceradius,\tikzphysics@elements@sliceposition)-- (-\tikzphysics@elements@sliceradiusb,\tikzphysics@elements@slicebottom) (\tikzphysics@elements@sliceradius,\tikzphysics@elements@sliceposition)-- (\tikzphysics@elements@sliceradiusb,\tikzphysics@elements@slicebottom); \tikzphysics@elements@drawprojectedelementellipse {\tikzphysics@elements@sliceradius}{\tikzphysics@elements@sliceposition} {\tikzphysics@elements@sliceprojection} \tikzphysics@elements@drawprojectedelementellipse {\tikzphysics@elements@sliceradiusb}{\tikzphysics@elements@slicebottom} {\tikzphysics@elements@sliceprojectionb} \@tempdima=2\tikzphysics@elements@sliceradiusb \edef\tikzphysics@elements@slicediameter{\the\@tempdima}% \@tempdima=\tikzphysics@elements@sliceposition \advance\@tempdima by \tikzphysics@elements@slicebottom \divide\@tempdima by 2 \edef\tikzphysics@elements@slicecenter{\the\@tempdima}% \node[draw=none,inner sep=0pt,outer sep=0pt, minimum width=\tikzphysics@elements@slicediameter, minimum height=\tikzphysics@elements@axialthickness] (-slice) at (0,\tikzphysics@elements@slicecenter) {}; \draw[every element dimension,->] (0,\tikzphysics@elements@sliceposition)-- (\tikzphysics@elements@sliceradius,\tikzphysics@elements@sliceposition) node[midway,above,every element label]{\tikzphysics@elements@picradiuslabel}; \tikzphysics@elements@drawexternaldimension {[xshift=4.5mm]-slice.south east}{[xshift=4.5mm]-slice.north east}% \node[right=7mm,every element label] at (-slice.east) {\tikzphysics@elements@picaxiallabel}; \coordinate (-apex) at (0,\tikzphysics@elements@apexy); \coordinate (-base) at (0,\tikzphysics@elements@basey); \coordinate (-center) at (0,0); \coordinate (-formula-anchor) at ([yshift=-7mm]-body.south); \tikzphysics@elements@picheight{\tikzphysics@elements@basey}{\tikzphysics@elements@apexy} \tikzphysics@elements@picellipse{body-rim}{0pt}{\tikzphysics@elements@basey} {\tikzphysics@elements@bodyradius}{\tikzphysics@elements@projectionradius} \tikzphysics@elements@picellipse{slice-top-rim}{0pt}{\tikzphysics@elements@sliceposition} {\tikzphysics@elements@sliceradius}{\tikzphysics@elements@sliceprojection} \tikzphysics@elements@picellipse{slice-bottom-rim}{0pt}{\tikzphysics@elements@slicebottom} {\tikzphysics@elements@sliceradiusb}{\tikzphysics@elements@sliceprojectionb} \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/cone slice diagram/.default={}, pics/physics cone slice diagram/.style args={#1}{cone slice diagram={#1}}, pics/physics cone slice diagram/.default={}, pics/sheet element diagram/.style args={#1}{code={% \tikzset{physics element defaults, element body width=5cm,element body height=3cm, element width=8mm,element height=6mm, element position=.58,element transverse position=.58, element formula label={$dA=d\!x\,d\!y$}, every sheet element diagram,#1}% \edef\tikzphysics@elements@picwidth{\tikzphysics@elements@widthvalue}% \edef\tikzphysics@elements@picheight{\tikzphysics@elements@heightvalue}% \edef\tikzphysics@elements@picwidthlabel{\unexpanded\expandafter{\tikzphysics@elements@widthlabel}}% \edef\tikzphysics@elements@picheightlabel{\unexpanded\expandafter{\tikzphysics@elements@heightlabel}}% \edef\tikzphysics@elements@picformula{\unexpanded\expandafter{\tikzphysics@elements@formulalabel}}% \tikzphysics@elements@setsoliddims \tikzphysics@elements@setrectdims \tikzphysics@elements@setunitposition \pgfmathparse{\tikzphysics@elements@transversepositionvalue}% \ifpgfmathunitsdeclared \PackageError{tikzphysics}{element transverse position must be unitless}% {Use a number in the interval [0,1].}% \fi \edef\tikzphysics@elements@transverseposition{\pgfmathresult}% \ifdim\tikzphysics@elements@transverseposition pt<0pt\relax \PackageError{tikzphysics}{element transverse position must not be negative}% {Use a number in the interval [0,1].}% \fi \ifdim\tikzphysics@elements@transverseposition pt>1pt\relax \PackageError{tikzphysics}{element transverse position must not exceed one}% {Use a number in the interval [0,1].}% \fi \ifdim\tikzphysics@elements@rectwidth<\tikzphysics@elements@bodywidth\relax\else \PackageError{tikzphysics}{rectangular element must be narrower than its sheet}% {Reduce element width or increase element body width.}% \fi \ifdim\tikzphysics@elements@rectheight<\tikzphysics@elements@bodyheight\relax\else \PackageError{tikzphysics}{rectangular element must be shorter than its sheet}% {Reduce element height or increase element body height.}% \fi \pgfmathsetlength{\@tempdima}% {-.5*\tikzphysics@elements@bodywidth+.5*\tikzphysics@elements@rectwidth+ \tikzphysics@elements@position*(\tikzphysics@elements@bodywidth-\tikzphysics@elements@rectwidth)}% \edef\tikzphysics@elements@elementx{\the\@tempdima}% \pgfmathsetlength{\@tempdima}% {-.5*\tikzphysics@elements@bodyheight+.5*\tikzphysics@elements@rectheight+ \tikzphysics@elements@transverseposition*(\tikzphysics@elements@bodyheight-\tikzphysics@elements@rectheight)}% \edef\tikzphysics@elements@elementy{\the\@tempdima}% \node[rectangular sheet, element width=\tikzphysics@elements@bodywidth, element height=\tikzphysics@elements@bodyheight] (-body) {}; \node[rectangular element, element width=\tikzphysics@elements@picwidth, element height=\tikzphysics@elements@picheight, element width label={\tikzphysics@elements@picwidthlabel}, element height label={\tikzphysics@elements@picheightlabel}, show dimensions] (-element) at (\tikzphysics@elements@elementx,\tikzphysics@elements@elementy) {}; \coordinate (-center) at (-body.center); \coordinate (-formula-anchor) at ([yshift=-8mm]-body.south); \tikzphysics@elements@drawformula{-formula-anchor}{\tikzphysics@elements@picformula}% }}, pics/sheet element diagram/.default={}, pics/physics sheet element diagram/.style args={#1}{sheet element diagram={#1}}, pics/physics sheet element diagram/.default={}, } %% ============================================================ %% DEBUG AND REFERENCE REGISTRATION %% ============================================================ \def\tikzphysics@elements@polaranchors{% center,centroid,inner-start,inner-mid,inner-end, outer-start,outer-mid,outer-end,start-mid,end-mid, north,south,east,west} \tikzphysics@registeranchors{physicspolarelement}{\tikzphysics@elements@polaranchors} \tikzphysics@registeranchors{physicsdifferentialsector}{\tikzphysics@elements@polaranchors} \tikzphysics@registeranchors{physicsdifferentialring}{\tikzphysics@elements@polaranchors} \tikzphysics@registeranchors{physicssphericalshell}{\tikzphysics@elements@polaranchors} \tikzphysics@registeranchors{physicshollowsphere}{\tikzphysics@elements@polaranchors} \tikzphysics@registeranchors{physicsunwrappedring}{% center,centroid,top-left,top-right,bottom-left,bottom-right, north,south,east,west} \def\tikzphysics@elements@rectanchors{% center,centroid,top-left,top-right,bottom-left,bottom-right, north,south,east,west} \tikzphysics@registeranchors{physicsrectangularelement}{\tikzphysics@elements@rectanchors} \tikzphysics@registeranchors{physicsrectangularstrip}{\tikzphysics@elements@rectanchors} \tikzphysics@registeranchors{physicsrectangularsheet}{\tikzphysics@elements@rectanchors} \tikzphysics@registerfamilies{physicssphereslicediagram}{disk-rim} \tikzphysics@registerfamilies{physicscylindershelldiagram}{body-rim,shell-outer-rim,shell-inner-rim,height} \tikzphysics@registerfamilies{physicscylinderslicediagram}{body-rim,slice-top-rim,slice-bottom-rim,height} \tikzphysics@registerfamilies{physicsconeslicediagram}{body-rim,slice-top-rim,slice-bottom-rim,height} \tikzphysics@registerdisplayname{physicspolarelement}{polar element} \tikzphysics@registerdisplayname{physicsdifferentialsector}{differential sector} \tikzphysics@registerdisplayname{physicsdifferentialring}{differential ring} \tikzphysics@registerdisplayname{physicsunwrappedring}{unwrapped ring} \tikzphysics@registerdisplayname{physicssphericalshell}{spherical shell} \tikzphysics@registerdisplayname{physicshollowsphere}{hollow sphere} \tikzphysics@registerdisplayname{physicsrectangularelement}{rectangular element} \tikzphysics@registerdisplayname{physicsrectangularstrip}{rectangular strip} \tikzphysics@registerdisplayname{physicsrectangularsheet}{rectangular sheet} \tikzphysics@registerdisplayname{physicsdifferentialringdiagram}{differential ring diagram} \tikzphysics@registerdisplayname{physicssphereshelldiagram}{sphere shell diagram} \tikzphysics@registerdisplayname{physicssphereslicediagram}{sphere slice diagram} \tikzphysics@registerdisplayname{physicshollowspherediagram}{hollow sphere diagram} \tikzphysics@registerdisplayname{physicscylindershelldiagram}{cylinder shell diagram} \tikzphysics@registerdisplayname{physicscylinderslicediagram}{cylinder slice diagram} \tikzphysics@registerdisplayname{physicsconeslicediagram}{cone slice diagram} \tikzphysics@registerdisplayname{physicssheetelementdiagram}{sheet element diagram} \def\tikzphysics@elements@polarkeys{% element inner radius,element outer radius,element radial thickness, element start angle,element delta angle,element dimension offset, element radius label,element radial label,element angular label, element arc label,show dimensions} \def\tikzphysics@elements@polardefaults{% element inner radius/1.8cm,element outer radius/2cm, element radial thickness/derived,element start angle/30 degrees, element delta angle/30 degrees,element dimension offset/4mm, element radius label/r,element radial label/dr, element angular label/d theta,element arc label/r d theta, show dimensions/off} \tikzphysics@registerkeys{physicspolarelement}{\tikzphysics@elements@polarkeys} \tikzphysics@registerkeys{physicsdifferentialsector}{\tikzphysics@elements@polarkeys} \tikzphysics@registerkeys{physicsdifferentialring}{\tikzphysics@elements@polarkeys} \tikzphysics@registerkeys{physicssphericalshell}{\tikzphysics@elements@polarkeys} \tikzphysics@registerkeys{physicshollowsphere}{\tikzphysics@elements@polarkeys} \tikzphysics@registerkeys{physicsunwrappedring}{% element inner radius,element outer radius,element radial thickness, source element,element circumference label,element radial label,show dimensions} \tikzphysics@registerkeys{physicsrectangularelement}{% element width,element height,element width label,element height label,show dimensions} \tikzphysics@registerkeys{physicsrectangularstrip}{% element width,element height,element width label,element height label,show dimensions} \tikzphysics@registerkeys{physicsrectangularsheet}{element width,element height} \tikzphysics@registerkeydefaults{physicspolarelement}{% element inner radius/1.8cm,element outer radius/2cm, element radial thickness/derived,element start angle/30 degrees, element delta angle/30 degrees,element dimension offset/4mm, element radius label/r,element radial label/dr, element angular label/d theta,element arc label/r d theta, show dimensions/off} \tikzphysics@registerkeydefaults{physicsdifferentialsector}{% element inner radius/0cm,element outer radius/2cm, element radial thickness/derived,element start angle/30 degrees, element delta angle/30 degrees,element dimension offset/4mm, element radius label/r,element angular label/d theta, element arc label/r d theta,show dimensions/off} \tikzphysics@registerkeydefaults{physicsdifferentialring}{% element inner radius/1.8cm,element outer radius/2cm, element radial thickness/derived,element delta angle/360 degrees, element radius label/r,element radial label/dr,show dimensions/off} \tikzphysics@registerkeydefaults{physicsunwrappedring}{% element inner radius/1.8cm,element outer radius/2cm, element radial thickness/derived,source element/optional named element, element circumference label/2 pi r,element radial label/dr, show dimensions/off} \tikzphysics@registerkeydefaults{physicssphericalshell}{% element inner radius/1cm,element outer radius/derived, element radial thickness/1.5mm,element delta angle/360 degrees, element radius label/r,element radial label/dr,show dimensions/off} \tikzphysics@registerkeydefaults{physicshollowsphere}{% element inner radius/1cm,element outer radius/2cm, element radial thickness/derived,element delta angle/360 degrees, element cavity radius label/a,element body radius label/R, show dimensions/off} \tikzphysics@registerkeydefaults{physicsrectangularelement}{% element width/8mm,element height/6mm, element width label/dx,element height label/dy,show dimensions/off} \tikzphysics@registerkeydefaults{physicsrectangularstrip}{% element width/4cm,element height/2mm, element width label/b,element height label/dx,show dimensions/off} \tikzphysics@registerkeydefaults{physicsrectangularsheet}{% element width/5cm,element height/3cm} \tikzphysics@registerkeydefaults{physicsdifferentialringdiagram}{% element inner radius/1cm,element outer radius/1.2cm, element radial thickness/derived,element body radius/2cm, element diagram gap/5mm,element center dot radius/1.2pt, show dimensions/on for both parts} \tikzphysics@registerkeydefaults{physicssphereshelldiagram}{% element body radius/2cm,element inner radius/1cm, element radial thickness/1.5mm,element formula label/dV = 4 pi r squared dr} \tikzphysics@registerkeydefaults{physicshollowspherediagram}{% element inner radius/9mm,element outer radius/2cm, element cavity radius label/a,element body radius label/R, element formula label/V = 4 pi over 3 times (R cubed - a cubed)} \tikzphysics@registerkeydefaults{physicssphereslicediagram}{% element body radius/2cm,element axial thickness/2mm, element position/0.35 in (-1,1),element projection ratio/0.24, element axial label/dx,element formula label/dV = pi y squared dx} \tikzphysics@registerkeydefaults{physicscylindershelldiagram}{% element body radius/1.6cm,element body height/3.4cm, element inner radius/9mm,element radial thickness/1.5mm, element projection ratio/0.25,element formula label/dV = 2 pi r h dr} \tikzphysics@registerkeydefaults{physicscylinderslicediagram}{% element body radius/1.6cm,element body height/3.4cm, element axial thickness/2mm,element position/0.55, element projection ratio/0.25,element axial label/dz, element formula label/dV = pi R squared dz} \tikzphysics@registerkeydefaults{physicsconeslicediagram}{% element body radius/1.8cm,element body height/4cm, element axial thickness/2mm,element position/0.58 from apex, element projection ratio/0.24,element axial label/dx, element formula label/dV = pi r(x) squared dx} \tikzphysics@registerkeydefaults{physicssheetelementdiagram}{% element body width/5cm,element body height/3cm, element width/8mm,element height/6mm, element position/0.58,element transverse position/0.58, element formula label/dA = dx dy} \tikzset{ physics element inner radius/.value required, physics element outer radius/.value required, physics element radial thickness/.value required, physics element start angle/.value required, physics element delta angle/.value required, physics element dimension offset/.value required, physics element diagram gap/.value required, physics element body radius/.value required, physics element center dot radius/.value required, physics element width/.value required, physics element height/.value required, physics element body width/.value required, physics element body height/.value required, physics element axial thickness/.value required, physics element position/.value required, physics element transverse position/.value required, physics element projection ratio/.value required, physics element radius label/.value required, physics element radial label/.value required, physics element angular label/.value required, physics element arc label/.value required, physics element circumference label/.value required, physics element width label/.value required, physics element height label/.value required, physics element axial label/.value required, physics element body radius label/.value required, physics element cavity radius label/.value required, physics element formula label/.value required, physics element source/.value required, } % Closed projected contours let TikZ apply native fill/pattern options once. % Rim guides are stroke-only; shell openings use opposite path winding. \def\tikzphysics@elements@projectedarc#1#2#3#4{% \pgfmathsetlengthmacro\tikzphysics@elements@arcrx{(#3)*1cm}% \pgfmathsetlengthmacro\tikzphysics@elements@arcry{(#4)*1cm}% \pgfpatharc{#1}{#2}{\tikzphysics@elements@arcrx and \tikzphysics@elements@arcry}% } \def\tikzphysics@elements@projectedbody{% \tikzphysics@component@move{-\cr}{-\ch/2}% \tikzphysics@component@line{-\ctr*\cr}{\ch/2}% \ifdim\ctr pt>0pt \tikzphysics@elements@projectedarc{180}{0}{\ctr*\cr}{\cd*\ctr*\cr}% \fi \tikzphysics@component@line{\cr}{-\ch/2}% \tikzphysics@elements@projectedarc{0}{-180}{\cr}{\cd*\cr}% \pgfpathclose } \def\tikzphysics@elements@projectedopening{% \tikzphysics@component@move{\ctr*(\cr-\cs)}{\ch/2}% \tikzphysics@elements@projectedarc{0}{360}{\ctr*(\cr-\cs)}{\cd*\ctr*(\cr-\cs)}% \pgfpathclose } \def\tikzphysics@elements@projectedrims{% \tikzphysics@component@move{\cr}{-\ch/2}% \tikzphysics@elements@projectedarc{0}{180}{\cr}{\cd*\cr}% \ifdim\ctr pt>0pt \tikzphysics@component@move{-\ctr*\cr}{\ch/2}% \tikzphysics@elements@projectedarc{180}{360}{\ctr*\cr}{\cd*\ctr*\cr}% \fi } %% BEGIN NATIVE COMPONENT EXTENSIONS %% solid cylinder \tikzset{ solid cylinder radius/.initial=1cm, physics solid cylinder radius/.style={solid cylinder radius={#1}}, solid cylinder height/.initial=2.5cm, physics solid cylinder height/.style={solid cylinder height={#1}}, solid cylinder depth/.initial=.25, physics solid cylinder depth/.style={solid cylinder depth={#1}}, } \pgfdeclareshape{physicssolidcylindernode}{ \savedmacro\tikzphysics@component@physicssolidcylindernodestate{% \tikzphysics@component@length\cr{solid cylinder radius} \tikzphysics@component@length\ch{solid cylinder height} \pgfmathsetmacro\cd{\pgfkeysvalueof{/tikz/solid cylinder depth}} \tikzphysics@component@check{\cr>0 && \ch>0 && \cd>0 && \cd<1}{Solid dimensions must be positive and depth between 0 and 1} \pgfmathsetmacro\ctr{1} \addtosavedmacro\cr \addtosavedmacro\ch \addtosavedmacro\cd \addtosavedmacro\ctr % Resolve deferred native draw modes without changing the node's options. \begingroup \tikz@mode@drawfalse\tikz@mode \iftikz@mode@draw \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{1}}% \else \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{0}}% \fi \tikzphysics@elements@paintstate \addtosavedmacro\cstroke } \anchor{center}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{0}{0}} \anchor{north}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{0}{\ch/2+\cd*\cr}} \anchor{south}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{0}{-(\ch/2+\cd*\cr)}} \anchor{east}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{\cr}{0}} \anchor{west}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{-(\cr)}{0}} \anchor{north east}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}} \anchor{north west}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{-(\cr)}{\ch/2+\cd*\cr}} \anchor{south east}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{\cr}{-(\ch/2+\cd*\cr)}} \anchor{south west}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{-(\cr)}{-(\ch/2+\cd*\cr)}} \anchor{base-center}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{0}{-\ch/2}} \anchor{top-center}{\tikzphysics@component@physicssolidcylindernodestate\tikzphysics@component@point{0}{\ch/2}} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox} \tikzphysics@declarepercentanchors{axis}{\tikzphysics@component@physicssolidcylindernodestate}{(0)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{bottom-rim}{\tikzphysics@component@physicssolidcylindernodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{top-rim}{\tikzphysics@component@physicssolidcylindernodestate}{(\ctr*\cr*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{generator}{\tikzphysics@component@physicssolidcylindernodestate}{(\cr*(1-\tikzphysics@percent+\ctr*\tikzphysics@percent))*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicssolidcylindernodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}}} \backgroundpath{\tikzphysics@component@physicssolidcylindernodestate \tikzphysics@elements@projectedbody } \beforebackgroundpath{\tikzphysics@component@physicssolidcylindernodestate \ifnum\cstroke=1\relax \tikzphysics@elements@projectedrims \pgfusepath{stroke} \fi }} \tikzphysics@declarehook{solid cylinder} \tikzphysics@registerdisplayname{physicssolidcylindernode}{solid cylinder} \tikzphysics@registeranchors{physicssolidcylindernode}{center,north,south,east,west,base-center,top-center} \tikzphysics@registerfamilies{physicssolidcylindernode}{axis,bottom-rim,top-rim,generator} \tikzphysics@registerkeys{physicssolidcylindernode}{solid cylinder radius,solid cylinder height,solid cylinder depth} \tikzphysics@registerkeydefaults{physicssolidcylindernode}{solid cylinder radius/1cm,solid cylinder height/2.5cm,solid cylinder depth/.25} \tikzset{physicssolidcylindernode/.style={shape=physicssolidcylindernode,physics logical shape=physicssolidcylindernode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every solid cylinder},solid cylinder/.style={physicssolidcylindernode}} %% solid cone \tikzset{ solid cone radius/.initial=1cm, physics solid cone radius/.style={solid cone radius={#1}}, solid cone height/.initial=2.5cm, physics solid cone height/.style={solid cone height={#1}}, solid cone depth/.initial=.25, physics solid cone depth/.style={solid cone depth={#1}}, } \pgfdeclareshape{physicssolidconenode}{ \savedmacro\tikzphysics@component@physicssolidconenodestate{% \tikzphysics@component@length\cr{solid cone radius} \tikzphysics@component@length\ch{solid cone height} \pgfmathsetmacro\cd{\pgfkeysvalueof{/tikz/solid cone depth}} \tikzphysics@component@check{\cr>0 && \ch>0 && \cd>0 && \cd<1}{Solid dimensions must be positive and depth between 0 and 1} \pgfmathsetmacro\ctr{0} \addtosavedmacro\cr \addtosavedmacro\ch \addtosavedmacro\cd \addtosavedmacro\ctr % Resolve deferred native draw modes without changing the node's options. \begingroup \tikz@mode@drawfalse\tikz@mode \iftikz@mode@draw \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{1}}% \else \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{0}}% \fi \tikzphysics@elements@paintstate \addtosavedmacro\cstroke } \anchor{center}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{0}{0}} \anchor{north}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{0}{\ch/2+\cd*\cr}} \anchor{south}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{0}{-(\ch/2+\cd*\cr)}} \anchor{east}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{\cr}{0}} \anchor{west}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{-(\cr)}{0}} \anchor{north east}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}} \anchor{north west}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{-(\cr)}{\ch/2+\cd*\cr}} \anchor{south east}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{\cr}{-(\ch/2+\cd*\cr)}} \anchor{south west}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{-(\cr)}{-(\ch/2+\cd*\cr)}} \anchor{base-center}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{0}{-\ch/2}} \anchor{top-center}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{0}{\ch/2}} \anchor{apex}{\tikzphysics@component@physicssolidconenodestate\tikzphysics@component@point{0}{\ch/2}} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox} \tikzphysics@declarepercentanchors{axis}{\tikzphysics@component@physicssolidconenodestate}{(0)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{bottom-rim}{\tikzphysics@component@physicssolidconenodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{top-rim}{\tikzphysics@component@physicssolidconenodestate}{(\ctr*\cr*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{generator}{\tikzphysics@component@physicssolidconenodestate}{(\cr*(1-\tikzphysics@percent+\ctr*\tikzphysics@percent))*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicssolidconenodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}}} \backgroundpath{\tikzphysics@component@physicssolidconenodestate \tikzphysics@elements@projectedbody } \beforebackgroundpath{\tikzphysics@component@physicssolidconenodestate \ifnum\cstroke=1\relax \tikzphysics@elements@projectedrims \pgfusepath{stroke} \fi }} \tikzphysics@declarehook{solid cone} \tikzphysics@registerdisplayname{physicssolidconenode}{solid cone} \tikzphysics@registeranchors{physicssolidconenode}{center,north,south,east,west,base-center,top-center,apex} \tikzphysics@registerfamilies{physicssolidconenode}{axis,bottom-rim,top-rim,generator} \tikzphysics@registerkeys{physicssolidconenode}{solid cone radius,solid cone height,solid cone depth} \tikzphysics@registerkeydefaults{physicssolidconenode}{solid cone radius/1cm,solid cone height/2.5cm,solid cone depth/.25} \tikzset{physicssolidconenode/.style={shape=physicssolidconenode,physics logical shape=physicssolidconenode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every solid cone},solid cone/.style={physicssolidconenode}} %% solid frustum \tikzset{ solid frustum radius/.initial=1cm, physics solid frustum radius/.style={solid frustum radius={#1}}, solid frustum height/.initial=2.5cm, physics solid frustum height/.style={solid frustum height={#1}}, solid frustum depth/.initial=.25, physics solid frustum depth/.style={solid frustum depth={#1}}, solid frustum top ratio/.initial=.5, physics solid frustum top ratio/.style={solid frustum top ratio={#1}}, } \pgfdeclareshape{physicssolidfrustumnode}{ \savedmacro\tikzphysics@component@physicssolidfrustumnodestate{% \tikzphysics@component@length\cr{solid frustum radius} \tikzphysics@component@length\ch{solid frustum height} \pgfmathsetmacro\cd{\pgfkeysvalueof{/tikz/solid frustum depth}} \pgfmathsetmacro\ct{\pgfkeysvalueof{/tikz/solid frustum top ratio}} \tikzphysics@component@check{\cr>0 && \ch>0 && \cd>0 && \cd<1}{Solid dimensions must be positive and depth between 0 and 1} \tikzphysics@component@check{\ct>0 && \ct<1}{Top ratio must be between 0 and 1} \pgfmathsetmacro\ctr{\ct} \addtosavedmacro\cr \addtosavedmacro\ch \addtosavedmacro\cd \addtosavedmacro\ct \addtosavedmacro\ctr % Resolve deferred native draw modes without changing the node's options. \begingroup \tikz@mode@drawfalse\tikz@mode \iftikz@mode@draw \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{1}}% \else \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{0}}% \fi \tikzphysics@elements@paintstate \addtosavedmacro\cstroke } \anchor{center}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{0}{0}} \anchor{north}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{0}{\ch/2+\cd*\cr}} \anchor{south}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{0}{-(\ch/2+\cd*\cr)}} \anchor{east}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{\cr}{0}} \anchor{west}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{-(\cr)}{0}} \anchor{north east}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}} \anchor{north west}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{-(\cr)}{\ch/2+\cd*\cr}} \anchor{south east}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{\cr}{-(\ch/2+\cd*\cr)}} \anchor{south west}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{-(\cr)}{-(\ch/2+\cd*\cr)}} \anchor{base-center}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{0}{-\ch/2}} \anchor{top-center}{\tikzphysics@component@physicssolidfrustumnodestate\tikzphysics@component@point{0}{\ch/2}} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox} \tikzphysics@declarepercentanchors{axis}{\tikzphysics@component@physicssolidfrustumnodestate}{(0)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{bottom-rim}{\tikzphysics@component@physicssolidfrustumnodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{top-rim}{\tikzphysics@component@physicssolidfrustumnodestate}{(\ctr*\cr*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{generator}{\tikzphysics@component@physicssolidfrustumnodestate}{(\cr*(1-\tikzphysics@percent+\ctr*\tikzphysics@percent))*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicssolidfrustumnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}}} \backgroundpath{\tikzphysics@component@physicssolidfrustumnodestate \tikzphysics@elements@projectedbody } \beforebackgroundpath{\tikzphysics@component@physicssolidfrustumnodestate \ifnum\cstroke=1\relax \tikzphysics@elements@projectedrims \pgfusepath{stroke} \fi }} \tikzphysics@declarehook{solid frustum} \tikzphysics@registerdisplayname{physicssolidfrustumnode}{solid frustum} \tikzphysics@registeranchors{physicssolidfrustumnode}{center,north,south,east,west,base-center,top-center} \tikzphysics@registerfamilies{physicssolidfrustumnode}{axis,bottom-rim,top-rim,generator} \tikzphysics@registerkeys{physicssolidfrustumnode}{solid frustum radius,solid frustum height,solid frustum depth,solid frustum top ratio} \tikzphysics@registerkeydefaults{physicssolidfrustumnode}{solid frustum radius/1cm,solid frustum height/2.5cm,solid frustum depth/.25,solid frustum top ratio/.5} \tikzset{physicssolidfrustumnode/.style={shape=physicssolidfrustumnode,physics logical shape=physicssolidfrustumnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every solid frustum},solid frustum/.style={physicssolidfrustumnode}} %% cylindrical shell \tikzset{ cylindrical shell radius/.initial=1cm, physics cylindrical shell radius/.style={cylindrical shell radius={#1}}, cylindrical shell height/.initial=2.5cm, physics cylindrical shell height/.style={cylindrical shell height={#1}}, cylindrical shell depth/.initial=.25, physics cylindrical shell depth/.style={cylindrical shell depth={#1}}, cylindrical shell thickness/.initial=.2cm, physics cylindrical shell thickness/.style={cylindrical shell thickness={#1}}, } \pgfdeclareshape{physicscylindricalshellnode}{ \savedmacro\tikzphysics@component@physicscylindricalshellnodestate{% \tikzphysics@component@length\cr{cylindrical shell radius} \tikzphysics@component@length\ch{cylindrical shell height} \pgfmathsetmacro\cd{\pgfkeysvalueof{/tikz/cylindrical shell depth}} \tikzphysics@component@length\cs{cylindrical shell thickness} \tikzphysics@component@check{\cr>0 && \ch>0 && \cd>0 && \cd<1}{Solid dimensions must be positive and depth between 0 and 1} \tikzphysics@component@check{\cs>0 && \cs<\cr}{Shell thickness must be between 0 and the radius} \pgfmathsetmacro\ctr{1} \addtosavedmacro\cr \addtosavedmacro\ch \addtosavedmacro\cd \addtosavedmacro\cs \addtosavedmacro\ctr % Resolve deferred native draw modes without changing the node's options. \begingroup \tikz@mode@drawfalse\tikz@mode \iftikz@mode@draw \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{1}}% \else \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{0}}% \fi \tikzphysics@elements@paintstate \addtosavedmacro\cstroke } \anchor{center}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{0}{0}} \anchor{north}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{0}{\ch/2+\cd*\cr}} \anchor{south}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{0}{-(\ch/2+\cd*\cr)}} \anchor{east}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{\cr}{0}} \anchor{west}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{-(\cr)}{0}} \anchor{north east}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}} \anchor{north west}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{-(\cr)}{\ch/2+\cd*\cr}} \anchor{south east}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{\cr}{-(\ch/2+\cd*\cr)}} \anchor{south west}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{-(\cr)}{-(\ch/2+\cd*\cr)}} \anchor{base-center}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{0}{-\ch/2}} \anchor{top-center}{\tikzphysics@component@physicscylindricalshellnodestate\tikzphysics@component@point{0}{\ch/2}} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox} \tikzphysics@declarepercentanchors{axis}{\tikzphysics@component@physicscylindricalshellnodestate}{(0)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{bottom-rim}{\tikzphysics@component@physicscylindricalshellnodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{top-rim}{\tikzphysics@component@physicscylindricalshellnodestate}{(\ctr*\cr*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{generator}{\tikzphysics@component@physicscylindricalshellnodestate}{(\cr*(1-\tikzphysics@percent+\ctr*\tikzphysics@percent))*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{inner-bottom-rim}{\tikzphysics@component@physicscylindricalshellnodestate}{((\cr-\cs)*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*(\cr-\cs)*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{inner-top-rim}{\tikzphysics@component@physicscylindricalshellnodestate}{(\ctr*(\cr-\cs)*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*(\cr-\cs)*sin(360*\tikzphysics@percent))*1cm} \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicscylindricalshellnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}}} \backgroundpath{\tikzphysics@component@physicscylindricalshellnodestate \tikzphysics@elements@projectedbody \tikzphysics@elements@projectedopening } \beforebackgroundpath{\tikzphysics@component@physicscylindricalshellnodestate \ifnum\cstroke=1\relax \tikzphysics@elements@projectedrims \tikzphysics@component@ellipse{0}{-\ch/2}{\cr-\cs}{\cd*(\cr-\cs)} \pgfusepath{stroke} \fi }} \tikzphysics@declarehook{cylindrical shell} \tikzphysics@registerdisplayname{physicscylindricalshellnode}{cylindrical shell} \tikzphysics@registeranchors{physicscylindricalshellnode}{center,north,south,east,west,base-center,top-center} \tikzphysics@registerfamilies{physicscylindricalshellnode}{axis,bottom-rim,top-rim,generator,inner-bottom-rim,inner-top-rim} \tikzphysics@registerkeys{physicscylindricalshellnode}{cylindrical shell radius,cylindrical shell height,cylindrical shell depth,cylindrical shell thickness} \tikzphysics@registerkeydefaults{physicscylindricalshellnode}{cylindrical shell radius/1cm,cylindrical shell height/2.5cm,cylindrical shell depth/.25,cylindrical shell thickness/.2cm} \tikzset{physicscylindricalshellnode/.style={shape=physicscylindricalshellnode,physics logical shape=physicscylindricalshellnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every cylindrical shell},cylindrical shell/.style={physicscylindricalshellnode}} %% conical shell \tikzset{ conical shell radius/.initial=1cm, physics conical shell radius/.style={conical shell radius={#1}}, conical shell height/.initial=2.5cm, physics conical shell height/.style={conical shell height={#1}}, conical shell depth/.initial=.25, physics conical shell depth/.style={conical shell depth={#1}}, conical shell top ratio/.initial=.5, physics conical shell top ratio/.style={conical shell top ratio={#1}}, conical shell thickness/.initial=.2cm, physics conical shell thickness/.style={conical shell thickness={#1}}, } \pgfdeclareshape{physicsconicalshellnode}{ \savedmacro\tikzphysics@component@physicsconicalshellnodestate{% \tikzphysics@component@length\cr{conical shell radius} \tikzphysics@component@length\ch{conical shell height} \pgfmathsetmacro\cd{\pgfkeysvalueof{/tikz/conical shell depth}} \pgfmathsetmacro\ct{\pgfkeysvalueof{/tikz/conical shell top ratio}} \tikzphysics@component@length\cs{conical shell thickness} \tikzphysics@component@check{\cr>0 && \ch>0 && \cd>0 && \cd<1}{Solid dimensions must be positive and depth between 0 and 1} \tikzphysics@component@check{\ct>0 && \ct<1}{Top ratio must be between 0 and 1} \tikzphysics@component@check{\cs>0 && \cs<\cr}{Shell thickness must be between 0 and the radius} \pgfmathsetmacro\ctr{\ct} \addtosavedmacro\cr \addtosavedmacro\ch \addtosavedmacro\cd \addtosavedmacro\ct \addtosavedmacro\cs \addtosavedmacro\ctr % Resolve deferred native draw modes without changing the node's options. \begingroup \tikz@mode@drawfalse\tikz@mode \iftikz@mode@draw \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{1}}% \else \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{0}}% \fi \tikzphysics@elements@paintstate \addtosavedmacro\cstroke } \anchor{center}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{0}{0}} \anchor{north}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{0}{\ch/2+\cd*\cr}} \anchor{south}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{0}{-(\ch/2+\cd*\cr)}} \anchor{east}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{\cr}{0}} \anchor{west}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{-(\cr)}{0}} \anchor{north east}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}} \anchor{north west}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{-(\cr)}{\ch/2+\cd*\cr}} \anchor{south east}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{\cr}{-(\ch/2+\cd*\cr)}} \anchor{south west}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{-(\cr)}{-(\ch/2+\cd*\cr)}} \anchor{base-center}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{0}{-\ch/2}} \anchor{top-center}{\tikzphysics@component@physicsconicalshellnodestate\tikzphysics@component@point{0}{\ch/2}} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox} \tikzphysics@declarepercentanchors{axis}{\tikzphysics@component@physicsconicalshellnodestate}{(0)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{bottom-rim}{\tikzphysics@component@physicsconicalshellnodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{top-rim}{\tikzphysics@component@physicsconicalshellnodestate}{(\ctr*\cr*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{generator}{\tikzphysics@component@physicsconicalshellnodestate}{(\cr*(1-\tikzphysics@percent+\ctr*\tikzphysics@percent))*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm} \tikzphysics@declarepercentanchors{inner-bottom-rim}{\tikzphysics@component@physicsconicalshellnodestate}{((\cr-\cs)*cos(360*\tikzphysics@percent))*1cm}{(-\ch/2+\cd*(\cr-\cs)*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{inner-top-rim}{\tikzphysics@component@physicsconicalshellnodestate}{(\ctr*(\cr-\cs)*cos(360*\tikzphysics@percent))*1cm}{(\ch/2+\cd*\ctr*(\cr-\cs)*sin(360*\tikzphysics@percent))*1cm} \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsconicalshellnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\ch/2+\cd*\cr}}} \backgroundpath{\tikzphysics@component@physicsconicalshellnodestate \tikzphysics@elements@projectedbody \tikzphysics@elements@projectedopening } \beforebackgroundpath{\tikzphysics@component@physicsconicalshellnodestate \ifnum\cstroke=1\relax \tikzphysics@elements@projectedrims \tikzphysics@component@ellipse{0}{-\ch/2}{\cr-\cs}{\cd*(\cr-\cs)} \pgfusepath{stroke} \fi }} \tikzphysics@declarehook{conical shell} \tikzphysics@registerdisplayname{physicsconicalshellnode}{conical shell} \tikzphysics@registeranchors{physicsconicalshellnode}{center,north,south,east,west,base-center,top-center} \tikzphysics@registerfamilies{physicsconicalshellnode}{axis,bottom-rim,top-rim,generator,inner-bottom-rim,inner-top-rim} \tikzphysics@registerkeys{physicsconicalshellnode}{conical shell radius,conical shell height,conical shell depth,conical shell top ratio,conical shell thickness} \tikzphysics@registerkeydefaults{physicsconicalshellnode}{conical shell radius/1cm,conical shell height/2.5cm,conical shell depth/.25,conical shell top ratio/.5,conical shell thickness/.2cm} \tikzset{physicsconicalshellnode/.style={shape=physicsconicalshellnode,physics logical shape=physicsconicalshellnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every conical shell},conical shell/.style={physicsconicalshellnode}} %% hemisphere \tikzset{ hemisphere radius/.initial=1.2cm, physics hemisphere radius/.style={hemisphere radius={#1}}, hemisphere depth/.initial=.25, physics hemisphere depth/.style={hemisphere depth={#1}}, } \pgfdeclareshape{physicshemispherenode}{ \savedmacro\tikzphysics@component@physicshemispherenodestate{% \tikzphysics@component@length\cr{hemisphere radius} \pgfmathsetmacro\cd{\pgfkeysvalueof{/tikz/hemisphere depth}} \tikzphysics@component@check{\cr>0 && \cd>0 && \cd<1}{Radius must be positive and depth between 0 and 1} \addtosavedmacro\cr \addtosavedmacro\cd % Resolve deferred native draw modes without changing the node's options. \begingroup \tikz@mode@drawfalse\tikz@mode \iftikz@mode@draw \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{1}}% \else \edef\tikzphysics@elements@paintstate{\endgroup\def\noexpand\cstroke{0}}% \fi \tikzphysics@elements@paintstate \addtosavedmacro\cstroke } \anchor{center}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{0}{0}} \anchor{north}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{0}{\cr}} \anchor{south}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{0}{-(\cr)}} \anchor{east}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{\cr}{0}} \anchor{west}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{-(\cr)}{0}} \anchor{north east}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{\cr}{\cr}} \anchor{north west}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{-(\cr)}{\cr}} \anchor{south east}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{\cr}{-(\cr)}} \anchor{south west}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{-(\cr)}{-(\cr)}} \anchor{base-center}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{0}{0}} \anchor{apex}{\tikzphysics@component@physicshemispherenodestate\tikzphysics@component@point{0}{\cr}} \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox} \tikzphysics@declarepercentanchors{rim}{\tikzphysics@component@physicshemispherenodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(\cd*\cr*sin(360*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{meridian}{\tikzphysics@component@physicshemispherenodestate}{(-\cr*cos(180*\tikzphysics@percent))*1cm}{(\cr*sin(180*\tikzphysics@percent))*1cm} \tikzphysics@declarepercentanchors{axis}{\tikzphysics@component@physicshemispherenodestate}{(0)*1cm}{(\cr*\tikzphysics@percent)*1cm} \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicshemispherenodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\cr}}} \backgroundpath{\tikzphysics@component@physicshemispherenodestate \tikzphysics@component@move{-\cr}{0} \pgfpatharc{180}{0}{\cr cm} \tikzphysics@elements@projectedarc{0}{-180}{\cr}{\cd*\cr} \pgfpathclose } \beforebackgroundpath{\tikzphysics@component@physicshemispherenodestate \ifnum\cstroke=1\relax \tikzphysics@component@move{\cr}{0} \tikzphysics@elements@projectedarc{0}{180}{\cr}{\cd*\cr} \pgfusepath{stroke} \fi }} \tikzphysics@declarehook{hemisphere} \tikzphysics@registerdisplayname{physicshemispherenode}{hemisphere} \tikzphysics@registeranchors{physicshemispherenode}{center,north,south,east,west,base-center,apex} \tikzphysics@registerfamilies{physicshemispherenode}{rim,meridian,axis} \tikzphysics@registerkeys{physicshemispherenode}{hemisphere radius,hemisphere depth} \tikzphysics@registerkeydefaults{physicshemispherenode}{hemisphere radius/1.2cm,hemisphere depth/.25} \tikzset{physicshemispherenode/.style={shape=physicshemispherenode,physics logical shape=physicshemispherenode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every hemisphere},hemisphere/.style={physicshemispherenode}} %% END NATIVE COMPONENT EXTENSIONS \makeatother \endinput %% End of file `tikzlibrarytikzphysics.elements.code.tex'. .