\icmd{\tzpolygon} connects an arbitrary number of coordinates to draw a polygon, a closed figure. |\tzpolygon| is equivalent to a \xem{closed} |\tzlines|. Since |\tzpolygon| is a \xem{semicolon version}, you need to enter a \xem{semicolon} to indicate when the coordinate repetition ends.
You can also move the polygon by specifying the option |<shift coor>| before the first coordinate.
The \xem{empty} shift option |<>| is \xem{not allowed}.
The starred version \icmd{\tzpolygon*} paints the interior of the polygon with the default options |fill=black!50| with |fill opacity=.3| and |text opacity=1|.
\icmd{\tzrectangle} and \icmd{\tzbox} are aliases of |\tzframe|.
\begin{tztikz}
\tzframe(0,1)(3,2) % works like:
\draw (0,1) rectangle (3,2);
\end{tztikz}
The plus version \icmd{\tzframe+} uses the second coordinate as the coordinate relative (with |++|) to the first. \icmd{\tzrectangle+} and \icmd{\tzbox+} are aliases of |\tzframe+|.
\begin{tztikz}
\tzframe+(0,1)(3,2) % works like:
\draw (0,1) rectangle ++(3,2);
\end{tztikz}
The starred version \icmd{\tzframe*} fills the interior
with |black!50| with |fill opacity=.3| and |text opacity=1|, by default.
(\icmd{\tzrectangle*} and \icmd{\tzbox*} are aliases of |\tzframe*|.)
|\tzframe+| has also its starred version \icmd{\tzframe*+}.
(\icmd{\tzrectangle*+} and \icmd{\tzbox*+} are aliases of |\tzframe*+|.)
You can move |\tzframe| and its variants by specifying the option |<shift coor>| immediately before the first mandatory coordinate.
The empty shift option |<>| is not allowed.
\icmd{\tzrectanglering*} draws two rectangles and draws a rectangle ring by filling the interior with the default options \ixxw{even odd rule}, |fill=black!50|, |fill opacity=.3|, and |text opacity=1|.
The starred version \icmd{\tzcircle*} fills the interior
with |fill=black!50| with |fill opacity=.3| and |text opacity=1|, by default.
You can change the fill opacity using the curly brace option |{<fill opacity>}| \xem{right after} the option |(<radius>)|.
You can move the circles by specifying the option |<shift coor>| \xem{before} the center coordinate or \xem{immediately before} the option |"<path name>"| if it exists.
The \xem{empty} shift option |<>| is \xem{not allowed}.
\icmd{\tzring*} draws two circles and draws a circle ring by filling the interior with the default options \ixxw{even odd rule}, |fill=black!50|, |fill opacity=.3|, and |text opacity=1|.
\begin{tztikz}
\tzring*(0,0)(1cm)(0,0)(1.5cm) % works like:
\draw [fill=black!50,fill opacity=.3,text opacity=1, even odd rule]
(0,0) circle (1cm) (0,0) circle (1.5cm);
\end{tztikz}
\begin{tztikz}
\tzellipse(0,0)(1 and .5) % works like:
\draw (0,0) ellipse (1 and .5);
\end{tztikz}
You can move the ellipse by specifying the option |<shift coor>| immediately before the mandatory coordinate.
The \xem{empty} shift option |<>| is \xem{not allowed}.
Using the last option |{<fill opacity>}|, you can change the fill opacity.
\begin{tzcode}{.3}
% \tzellipse(*)
\begin{tikzpicture}
\tzhelplines(4,3)
\tzellipse(2,2)(1.5 and 1)
\tzellipse*[blue](2,1)(1 and 1.5){.5} % fill opacity
\tzellipse[fill=green](3,1)(1cm and .5cm)
\tzellipse*[red]<0,-.5>(3,1)(1cm and .5cm) % shift
\end{tikzpicture}
\end{tzcode}
You can add some \Tikz\ code with the option |<code.append>|.
\begin{tzcode}{.3}
% \tzellipse(*), \tzoval(*): <code.append>
\begin{tikzpicture}
\tzhelplines(4,4)
\tzoval*[blue,even odd rule](2,2)(1.5 and 1)
<(2,2) ellipse (2 and 1.5)>
\tzellipse[fill=green,even odd rule](3,1)(1 and 1)
<(3,1) ellipse (.5 and .8)>
\end{tikzpicture}
\end{tzcode}
\icmd{\tzoval} is an alias of |\tzellipse| and \icmd{\tzoval*} is an alias of |\tzellipse*|.
\subsection{\protect\cmd{\tzellipsering(*)}}
\icmd{\tzellipse*} draws two ellipses and draws an ellipse ring by filling the interior with the default options \ixxw{even odd rule}, |fill=black!50|, |fill opacity=.3|, and |text opacity=1|.
\icmd{\tzellipse} draws two ellipses with the default option |even odd rule|.
|\tzellipsering(*)| is basically the same as |\tzring(*)|.
\begin{tzdef}
% syntax: minimal
\tzellipse*(<coor>)(<x and y radius>)(<coor>)(<x and y radius>)
% syntax: full
\tzellipsering*[<opt>]<shift coor>
(<coor>)(<x and y radius>)(<coor>)(<x and y radius>)
{<fill opacity>}<code.append>
% defaults: \tzellipse*
*[even odd rule,fill=black!50,fill opacity=.3,text opacity=1]
<>(<m>)(<m>)()(){.3}<>
% defaults: \tzellipse
*[even odd rule]<>(<m>)(<m>)()()<>
\end{tzdef}
\begin{tztikz}
\tzellipsering*(2,1)(1cm and 1.5cm)(2,2)(1.5cm and 1.5cm) % works like:
\draw [fill=black!50,fill opacity=.3,text opacity=1, even odd rule]
(2,1) ellipse (1cm and 1.5cm) (2,2) ellipse (1.5cm and 1.5cm);
\end{tztikz}
\begin{tzcode}{.3}
% \tzring*: fill opacity
\begin{tikzpicture}
\tzhelplines(4,4)
\tzellipsering*[blue](2,2)(1 and 1)(2,2)(1.5cm)
\tzring*[fill=green](2,1)(1 and 1.5)(2,1)(.7 and 1){1}
\end{tikzpicture}
\end{tzcode}
\begin{tzcode}{.3}
% \tzellipsering(*)
\begin{tikzpicture}
\tzhelplines(4,4)
\tzcoors(2,2)(A)(3,1)(B);
\tzellipsering*[blue](2,2)(1 and 1.5)
< (1.5,2.5) circle (3mm) >
\tzellipsering[pattern=bricks]<1,0>(2,1)(1 and 1.5)
< (2.5,.5) rectangle ++(1,1) >
\end{tikzpicture}
\end{tzcode}
\begin{tzcode}{.3}
% \tzellipsering(*)
\begin{tikzpicture}
\tzhelplines(4,4)
\tzcoors(2,2)(A)(3,1)(B);
\tzovalring*[fill=red,draw=none,nonzero rule]
(2,2)(1 and 1.5)(3,1)(1 and 1.5){1}
\tzovalring[fill=white]
(2,2)(1 and 1.5)(3,1)(1 and 1.5)
\end{tikzpicture}
\end{tzcode}
\icmd{\tzovalring} is an alias of |\tzellipsering| and \icmd{\tzovalring*} is an alias |\tzellipsering*|.
%%==================================
\chapter{Arcs, Wedges, and Angle Marks}
\label{c:arcs}
You can move arcs by specifying the option |<shift coor>| before the center coordinate or immediately before the option |"<path name>"| if it exists.
The \xem{empty} shift option |<>| is \xem{not allowed}.
You can also extend the path of |\tzarc| by specifying the last option |<code.append>| with \Tikz\ code written in it. For example, |<--cycle>| makes the path closed.
The macro \icmd{\tzarcsfrom} (i.e. |\tzarcs + from|) accepts an arbitrary number of parenthesis arguments in the form of |(<angA:AngB:radius>)| following the start coordinate. Since |tzarcsfrom| is a semicolon version, you need to enter a \xem{semicolon} to indicate when the repetition ends.
The swap version \icmd{\tzwedge'} is the \iisw{swap version} of \icmd{\tzwedge}.
It switches the drawing direction from \ixxw{counterclockwise} to \ixxw{clockwise} and vice versa.
The starred version \icmd{\tzwedge*} fills the wedges with |fill=black!50| with |fill opacity=.3| and |text opacity=1|, by default.
With |\settzfillcolor| and |\settzfillopacity|, you can change the default values.
You can also change the fill opacity by specifying the last optional argument |{<fill opacity>}|.
%%------------------------------------------------------------
\subsection{\protect\cmd{\tzpointangle}: Angles between points}
\label{ss:tzpointangle}
\icmd{\tzpointangle}|(<coor1>)(<coor2>)(<\mymacro>)| computes the angle between two points and allows you to use, where |(coor1)| serves as the coordinate of the center.
\icmd{\tzanglemark} accepts three mandatory coordinates to display an angle mark by an arc (of radius |10pt|, by default) for the second coordinate, on the |behind| layer by default.
You can change the angle arc radius by \icmd{\settzAAradius}.
You can change the layer by \icmd{\settzanglelayer}. Its alias is |\settzanglemarklayer|.
The default line width of angle marks is |very thin|. You can change the default line with with \icmd{\settzAAlinestyle}.
\paragraph{How it works} Every |\tzanglemark| calculates angles (from 0\textdegree to 360\textdegree) and stores the values under the names \icmd{\tzangleONE} and \icmd{\tzangleTWO}. The difference of the two numbers is stored as an absolute value under the name \icmd{\tzangleresult}.
Of course, you can use these values \xem{only after} running |\tzanglemark|.
\begin{itemize}\firmlist
\item |\tzanglemark| draws an angle mark between two angles, |counterclockwise|, from small two large.
\item |\tzanglemark'| draws an angle mark between two angles, |clockwise|, from small to large.
\end{itemize}
\remark Simple to use:
\begin{itemize}\firmlist
\item
|\tzmarkanlge(A)(B)(C)| draws an angle mark by an arc from |(A)| to |(C)| about |(B)|.
\item
|\tzmarkanlge(C)(B)(A)| draws an angle mark by an arc from |(C)| to |(A)| about |(B)|.
\item Ignoring the direction, |\tzanglemark(A)(B)(C)| and |\tzanglemark(C)(B)(A)| give the same result.
\end{itemize}
\paragraph{Swap version}
The \iisw{swap version} \icmd{\tzanglemark'} draws an angle mark for an angle in $360\text{\textdegree}-\theta$.
In other words, |\tzanglemark'| \xem{switches the direction} of drawing an angle arc from |counterclockwise| to |clockwise|, and vice versa.
\paragraph{Angle mark text position}
The midpoint of an angle arc is stored under the coordinate name |tzAAmid|.
The angle mark text is put on the line that goes through the middle point and \icmd{(tzAAmid)}. The default |(<arc radius>)| is |10pt| and the default position of angle text is |pos=1.5| in |[<node opt>]|.
\begin{tzcode}{.3}
% angle marc text position
\begin{tikzpicture}
\tzhelplines(4,3)
\tzcoors*(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
\tzlines(A)(B)(C);
\tzanglemark(C)(B)(A){$\theta$}[pos=.65](20pt) %%
\tzdot*(tzAAmid)
\tzline[red,dashed,tzextend={1cm}{2cm}](B)(tzAAmid)
\end{tikzpicture}
\end{tzcode}
\remark Instead of using the options |{<text>}| and |[<node opt>]|, you can also use the coordinate |(tzAAmid)| to place the angle text wherever you want, without using |\tzanglemark(')|. Of course, you can use the correct |(tzAAmid)| only after running |\tzanglemark|.
%%------------------------------------------------------------
\subsection{\protect\cmd{\tzanglemark*(')}: Fill angle marks}
\label{ss:tzanglemark*}
\icmd{\tzanglemark*} fills (in the |behind| layer, by default) the angle mark area with |fill=black!50| and with the options |fill opacity=.3| and |text opacity=1| by default. It does not draw any lines: |[draw=none]| by default.
Using the macros such as |\settzfillcolor|, |\settzfillopacity|, and \icmd{\settzanglelayer}, you can change the default values.
%%%% (REMOVED!!!)
%%%%%------------------------------------------------------------
%%%\section{\protect\cmd{\tzpicangle}: angle marks}
%%%\label{s:tzpicangle}
%%%
%%%\begin{tzdef}
%%%% syntax: angle ABC or angle CBA
%%%\tzpicangle(')[<angle pic opt>][<path/draw opt>](<coor1>)(<coor2>)(<coor3>)
%%% {<angle pic text>}[<text eccentricity>](<angle pic arc radius>)
%%%% defaults:(')[][]()()(){}[1.5](10pt)
%%%\end{tzdef}
%%%
%%%When |(coor1) -- (coor2) -- (coor3)| is arranged naturally (counterclockwise),
%%%|\tzarc| draws an arc naturally (counterclockwise), while |tzarc'| draws an arc clockwise.
%%%
%%%When |(coor1) -- (coor2) -- (coor3)| is arranged clockwise,
%%%|\tzarc| draws an arc counterclockwise, while |tzarc'| draws an arc counterclockwise.
%%%
%%%\remark
%%%Internally, |\tzpicangle| is defined to draw an arc by a |pic| operation of \TikZ, so it is not affected by scaling, unless |transform shape| is not used.
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}
%%%\tzhelplines(4,2)
%%%\tzlines(2,2)(1,1)(3,0);
%%%\tzpicangle[->,draw=red,fill=red!30](2,2)(1,1)(3,0){a}
%%%\tzlines [xshift=1cm](2,2)(1,1)(3,0);
%%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}
%%%\end{tikzpicture}
%%%\end{tzcode}
%%%
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}
%%%\tzhelplines(4,2)
%%%\tzlines(3,0)(1,1)(2,2);
%%%\tzpicangle[->,fill=red!30](3,0)(1,1)(2,2){a}
%%%\tzlines [xshift=1cm](3,0)(1,1)(2,2);
%%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
%%%\end{tikzpicture}
%%%\end{tzcode}
%%%
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}
%%%\tzhelplines(4,2)
%%%\tzlines(2,0)(0,0)(0,2);
%%%\tzpicangle[fill=red!30](2,0)(0,0)(0,2){a}
%%%\tzlines [xshift=1cm](2,2)(1,1)(3,0);
%%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
%%%\end{tikzpicture}
%%%\end{tzcode}
%%%
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}
%%%\tzhelplines(4,2)
%%%\tzpicangle [fill=red!30](2,2)(1,1)(3,0){a}
%%%\tzpicangle'[][xshift=1cm](2,2)(1,1)(3,0){a}
%%%\end{tikzpicture}
%%%\end{tzcode}
%%%
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}
%%%\tzhelplines(4,2)
%%%\tzpicangle [fill=red!30](3,0)(1,1)(2,2){a}
%%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
%%%\end{tikzpicture}
%%%\end{tzcode}
%%%
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}
%%%\tzhelplines(4,2)
%%%\tzpicangle [fill=red!30](2,0)(0,0)(0,2){a}
%%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
%%%\end{tikzpicture}
%%%\end{tzcode}
%%%
%%%\begin{tzcode}{.3}
%%%\begin{tikzpicture}[scale=.5]
%%%\tzhelplines(4,2)
%%%\tzpicangle [fill=red!30](2,0)(0,0)(0,2){a}
%%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
%%%\end{tikzpicture}
%%%\end{tzcode}
\subsection{\protect\cmd{\tzrightanglemark}: Right angle marks}
\label{ss:tzrightangle}
\icmd{\tzrightanglemark} takes three coordinates as mandatory arguments to display a right angle mark for the second coordinate. The mark is drawn on the |behind| layer by default, which can be changed by \icmd{\settzanglelayer}.
The default line with is |very thin|, which can be changed by the option |[<opt>]|. You can also change the line width using \icmd{\settzRAlinestyle}, which is valid until the end of |tikzpicture| environment.
|\settzRAlinestyle| is an alias of |\settzAAlinestyle|.
The length of the side is |5pt| by default, and it can be changed by the last option |(<size>)|.
You can also change the size with \icmd{\settzRAsize}, which is valid until the end of the |tikzpicture| environment.
\remark
\begin{itemize}\firmlist
\item |\tzrightanglemark(A)(B)(C)| and |\tzrightanglemark(C)(B)(A)| give the same result.
\item |\tzrightanglemark'| is redundant, but it is provided to avoid frequent coding errors.
\end{itemize}
Each |\tzrightanglemark| defines \icmd{(tzRAvertex)} as the coordinate of the right angle mark vertex.
The angle text is placed on the line going through the second coordinate and |(tzRAvertex)|. The default position is |pos=2| in |[<node opt>]|.
\remark You can also use the coordinate |(tzRAvertex)| to place angle text wherever you want, after |\tzrightanglemark|.
\subsection{\protect\cmd{\tzrightanglemark*}: Fill right angle marks}
\label{ss:tzrightangle*}
The starred version \icmd{\tzrightanglemark*} fills the interior of right angle marks with |fill=black!50|, with |fill opacity=.3| and |text opacity=1|. It does not draw any line: |[draw=none]| by default. The filled mark is drawn on the |behind| layer by default, which can be changed by \icmd{\settzanglelayer}.
Its alias is \icmd{\settzanglemarklayer}.
\section{\protect\cmd{\tzdistance}: Distances and changes}
\label{s:tzdistance}
\icmd{\tzdistance}|(<coor1>)(<coor2>){<\mylength>}| calculates the Cartesian distance \xem{from} |(<coor1>)| \xem{to} |(<coor2>)| and stores the (absolute) value to the user-specified macro |\mylength| in centimeters.
And |\tzdistance| also stores the changes in |x| and |y| to |{<\Deltax>}| and |{<\Deltay>}|, respectively.
Note that the calculated distance is \xem{approximate}.