\chapter{Quadrilateral Quality Metrics}

All the metrics in this section are defined on a quadrilateral element with vertices
shown in Figure~\ref{f:quad}. Furthermore, we define the following edge vectors for
convenience. Note that each edge has two versions, one defined by its endpoints and
another indexed by sequential integers:
\begin{equation*}
\begin{array}{lcl}
\vec L_0 &=& \vec P_1 - \vec P_0\\
\vec L_1 &=& \vec P_2 - \vec P_1\\
\vec L_2 &=& \vec P_3 - \vec P_2\\
\vec L_3 &=& \vec P_0 - \vec P_3
\end{array}\rule{10em}{0pt}
\begin{array}{lcl}
\vec L_{01} &=& \vec P_1 - \vec P_0\\
\vec L_{12} &=& \vec P_2 - \vec P_1\\
\vec L_{23} &=& \vec P_3 - \vec P_2\\
\vec L_{30} &=& \vec P_0 - \vec P_3.
\end{array}
\end{equation*}

The quadrangle edge lengths are denoted as follows:
\[
L_0 = \normvec{L_0}\quad
L_1 = \normvec{L_1}\quad
L_2 = \normvec{L_2}\quad
L_3 = \normvec{L_3}
\]
and the largest and smallest edge lengths are, respectively,
\[
L_{\min} = \min\left(L_0, L_1, L_2, L_3\right)
  \rule{2em}{0pt}
L_{\max} = \max\left(L_0, L_1, L_2, L_3\right)
\]

The diagonals of a quadrilateral are denoted
\begin{equation*}
\begin{array}{lcl}
\vec D_0 &=& \vec P_2 - \vec P_0
\end{array}\rule{10em}{0pt}
\begin{array}{lcl}
\vec D_1 &=& \vec P_3 - \vec P_1
\end{array}
\end{equation*}
and the longest diagonal has length
\[
D_{\max} = \max\left\{ \normvec{D_0}, \normvec{D_1} \right\}.
\]

\begin{figure}[htb]
  \centering
  \subfigure[Vertices of a quadrilateral.]{\includegraphics[width=2in]{quad}}
  \subfigure[Principal axis vectors.]{\includegraphics[width=2in]{quad-axes}}
  \caption{A quadrilateral showing notation used in metric definitions.%
                                                                  \label{f:quad}}
\end{figure}

The principal axes are
\begin{equation*}
\begin{array}{lcl}
\vec X_1 &=& \left(\vec P_1 - \vec P_0\right) + \left(\vec P_2 - \vec P_3\right)\\
\vec X_2 &=& \left(\vec P_2 - \vec P_1\right) + \left(\vec P_3 - \vec P_0\right)
\end{array}
\end{equation*}
and the cross derivatives of the map from parametric to world space are oriented along
\begin{equation*}
\begin{array}{lcl}
\vec X_{12} &=& \left(\vec P_0 - \vec P_1\right) + \left(\vec P_2 - \vec P_3\right) =\\
\vec X_{21} &=& \left(\vec P_0 - \vec P_3\right) + \left(\vec P_2 - \vec P_1\right).
\end{array}
\end{equation*}

Each corner has a normal vector associated with it
\begin{equation*}
\begin{array}{lcl}
\vec N_0 &=& \vec L_3 \times \vec L_0\\
\vec N_1 &=& \vec L_0 \times \vec L_1
\end{array}
\rule{10em}{0pt}
\begin{array}{lcl}
\vec N_2 &=& \vec L_1 \times \vec L_2\\
\vec N_3 &=& \vec L_2 \times \vec L_3
\end{array}
\end{equation*}
and these vectors can be normalized to unit length:
\begin{equation*}
\begin{array}{lcl}
\hat n_0 &=& \dfrac{\vec N_0}{\normvec{ N_0}}\\
\hat n_1 &=& \dfrac{\vec N_1}{\normvec{ N_1}}
\end{array}
\rule{10em}{0pt}
\begin{array}{lcl}
\hat n_2 = \dfrac{\vec N_2}{\normvec{ N_2}}\\
\hat n_3 = \dfrac{\vec N_3}{\normvec{ N_3}}.
\end{array}
\end{equation*}

In addition to corner normals, we can define a ``center'' normal
\begin{equation*}
\vec N_{c} = \vec X_1 \times \vec X_2
\end{equation*}
and its unit-length companion
\begin{equation*}
\hat n_{c} = \frac{\vec N_{c}}{\normvec{ N_{c}}}
\end{equation*}
In the event that the vertices of the quadrilateral are all
contained in the same plane, all the unit normals will be
equivalent (i.e., $\hat n_0 = \hat n_1 = \hat n_2 = \hat n_3 = \hat n_c$).

\begin{figure}[htb]
  \centering
  \includegraphics[width=2in]{quad-vertex-areas}
  \caption{Areas associated with each quadrilateral vertex.%
                                                    \label{f:quad-vertex-areas}}
\end{figure}

It is often useful to partition the quadrilateral into four areas, one
associated with each vertex. These areas are denoted
\begin{equation*}
\alpha_k = \hat n_c \cdot \vec N_k\rule{10em}{0pt}\forall k\in\{0,1,2,3\}
\end{equation*}
and are shown in Figure~\ref{f:quad-vertex-areas}.
If $\vec N_c = \vec 0$, then the signed corner areas are undefined,
and all the metrics which depend on $\alpha_k$ are undefined.
In this case, we set $\alpha_k = 0$ for $k=0,1,2,3$.
When $\alpha_k \leq 0$ for any one or more $k$, the quadrilateral
is degenerate.
This occurs when
an element is so small its edge length approach the machine epsilon or
when its vertices are collinear or
when its vertices define a concave quadrilateral.

% -------------------Metric Table-------------------
\newcommand{\quadmetrictable}[8]{%
  \begin{center}
  \begin{tabular}{ll}
    \multicolumn{2}{r}{\textbf{\sffamily\Large quadrilateral #1}}\\\hline
    Dimension:             & #2\\ 
    Acceptable Range:      & #3\\ 
    Normal Range:          & #4\\ 
    Full Range:            & #5\\ 
    $q$ for unit square:   & #6\\
    Reference:             & #7\\
    \verd\ function:       & \texttt{#8}\\ \hline
  \end{tabular} 
  \end{center}
}

\newpage \input{QuadArea}
\newpage \input{QuadAspectRatio}
\newpage \input{QuadCondition}
\newpage \input{QuadDistortion}
\newpage \input{QuadEdgeRatio}
\newpage \input{QuadJacobian}
\newpage \input{QuadMaxAspectFrobenius}
\newpage \input{QuadMaximumAngle}
\newpage \input{QuadMaximumEdgeRatio}
\newpage \input{QuadMedAspectFrobenius}
\newpage \input{QuadMinimumAngle}
\newpage \input{QuadOddy}
\newpage \input{QuadRadiusRatio}
\newpage \input{QuadRelativeSizeSquared}
\newpage \input{QuadScaledJacobian}
\newpage \input{QuadShape}
\newpage \input{QuadShapeAndSize}
\newpage \input{QuadShear}
\newpage \input{QuadShearAndSize}
\newpage \input{QuadSkew}
\newpage \input{QuadStretch}
\newpage \input{QuadTaper}
\newpage \input{QuadWarpage}

