1. Introduction
Research on mesh generation in Computer Graphics, Scientific Visualization and Computational Field Simulations has led to a substantial number of methods within the last six decades. An exhaustive description of this field is beyond the scope of this paper; one can refer to the many surveys available, see, e.g., Thompson et al. [
1] and Lo [
2]. However, that mesh generation in regions in 2D and 3D is a central task, used in numerical methods for the solution of partial differential equations, using finite difference, finite element and finite volume methods.
There is also a special interest in studying meshes formed by triangular elements. Our interest here is to generate structured meshes with quadrilateral elements; however, all of the discussion can be applied to unstructured meshes. The simplest way to generate a structured mesh is via interpolation of the boundaries, but it is difficult to ensure that the mesh thus obtained is a convex one. In 2010, Barrera  et al. [
3] provided a review of some functionals and conditions that guarantee the existence of optimal meshes that are convex over irregular planar regions.
Our interest now is to improve the mesh quality via controlling the shape of the elements. The improvement of mesh quality can be carried out in two ways:
- Clean-up. 
- This consists of the elimination, insertion and reconnection of nodes to eliminate the worst elements. Some authors call that this procedure topological optimization in the sense that the connectivity of the nodes is removed to obtain an optimal configuration. 
- Smoothing.
- This consists of node repositioning without changing the connectivity of the elements. 
In both cases, the goal is to obtain a quality mesh with a low number of distorted elements. To achieve this goal for a quadrilateral, it is neccesary to define an ad hoc quality measure.
Definition 1 (González [
4])
. We say that a real-valued function  over a quadrilateral Q is a quality measure in the sense of Field-Oddy if it- (1) 
- Has the ability to detect degenerated elements; 
- (2) 
- Is bounded and continuous; 
- (3) 
- Is independent of scale; 
- (4) 
- Is normalized; 
- (5) 
- Is invariant under rigid transformations. 
 For practical purposes, it is convenient to define an acceptability interval  for the quality measure, i.e., when a quadrilateral has a suitable shape, outside of this interval, we say that the quadrilateral does not have the desired shape. The acceptability interval are defined empirically for each quality measure.
In this paper, we are interested in identifying the shape of the cells and in quantifying the distortion of a quadrilateral when it is not a square or a rectangle. In the remainder of this paper, we will discuss the most used quality measures for rectangles and then propose new quality measures.
The remainder of this paper is structured as follows. The following, background section presents the most used quality measures for rectangles based on angles. 
Section 3 then presents some new quality measures based on geometric properties. 
Section 4 then presents some classical global quality metrics and proposes a statistical analysis of all elements of the mesh. 
Section 5 then presents some concepts to grid quality improvement using quality measures. Finally in the 
Section 6 then presents some new quality discrete functionals for improvement of the mesh.
  2. Background
Following the ideas behind the quality measures for triangles, it is straightforward to define some figures that measure the shape of quadrilaterals. One of these is the aspect ratio, which is defined by comparing to the ideal case when the quadrilateral is a rectangle; it represents the ratio of the largest to the smallest sides. An estimator for this ratio was discussed in 1987 by Robinson [
5]. The idea is to associate a rectangle with the convex quadrilateral: a rectangle passing through the midpoints of the sides of the quadrilateral, see 
Figure 1.
This idea is usual in continuum mechanics. Robinson proposed a practical method of calculating it by means of bilinear mapping between the unit square and the quadrilateral
      
      where the 
e and 
f coefficients are realated to the nodal coordinates 
 to 
 and 
 to 
 by
      
	  The meaning of the coefficients in Equation (
3) is now shown in [
5]. Which yields
      
The associated rectangle has sides, which are parallel to the coordinate axes and pass through the midpoints of the sides of the quadrilateral. In spite of its simplicity, this analytic representation is not satisfactory since it depends on an orthogonal coordinate system. In 2000, Field [
6] reviewed this definition and suggested calculating the aspect ratio of Robinson and orthogonalizing the main axes, and proposed a quality measure to detect squares.
In 1989, Lo [
7] reviewed the classical quality measure for triangles 
 with side lengths 
, 
 and 
,
      
      which attains its optimum value in equilateral triangles, and again proposed calculating each one of those values over the four 
 triangles, which are defined by the sides and diagonals of a quadrilateral, but reordering these quantities in such a way that
      
      and using
      
      as a quality measure. The maximum value is 1 and it is obtained for rectangles. This is a quality measure because it is continuous, bounded and identifies degenerate and even non-convex quadrilaterals. The measure that Lo uses for triangles 
T is the reciprocal of the number of conditions of a linear mapping 
, which Knupp [
8] used in 2001 to measure the distortion of the elements. Locally, Lo’s measure may have more critical points, which can be far from representing a rectangle.
Another measure of quality for quadrilaterals is described by van Rens  et al. [
9] as follows: compute the inner angles 
 and define
      
This function is continuous, dimensionless and 
. One can see that 
 if 
Q is a triangle and 
 only if 
Q is a rectangle.
In 2012, Remacle et al. [
10] described the Blossom-Quad algorithm to construct a non-structured mesh with quadrilateral elements obtained from a previous triangulation and used a cost function to produce a quality mesh. They used
      
      and observed that if the value of this function is 1, 
Q is a perfect quadrilateral, and it is 0 if any of the angles are greater than or equal to 
, i.e., when the quadrilateral degenerates into a triangle or is nonconvex. This function is also a quality measure.
As noted, unlike other measures for rectangles we have discussed up to this point, the last two ones do not depend either on the shape of the quadrilaterals or the aspect ratio or proportion of their sides; they only measure how near or far away a quadrilateral is from being a rectangle using only the internal angles.
Another function based on the inner angles was proposed by Wu [
11]. This author used the same idea as Lo: to order the inner angles 
 so that 
 and define
      
This function reaches its maximum value of 1 on rectangles. However, this is not a good measure in the sense of Field-Oddy, since it is not capable of detecting degenerate quadrilaterals.
  3. New Quality Measures
In the previous section, we had reviewed some measures that characterize rectangles and also pointed out some intervals of acceptability to decide if a quadrilateral is close to the desired shape. However, which rectangle is it close to?
  3.1. Quality Measure of Rectangles
A very interesting problem in computational geometry is the following: given a cloud of points, calculate the rectangle of the minimum area that contains them. It is known that this problem can be raised directly on the convex hull of the cloud of points, and therefore the problem can be regarded as calculating a rectangle of minimum area that contains a convex polygon.
We propose the use of the rectangle of minimum area to define a distortion measure of the quadrilateral in the sense that it measures how close or far a quadrilateral 
Q is from being a rectangle, 
Figure 2.
Example 1. For the quadrilateral A(−6.84, 7.5), B(−10, −4), C(11.81, −1.38) and D(9.27, 11.94), the rectangle of minimum area is  with an aspect ratio 
of 1.62. See Figure 2.  On one hand, the cell area 
, is less than the rectangle area; that is, 
, and it is easy to see that
        
        see Lassak [
12] for the proof. The quotient thus defined reaches its maximum value of 1 on rectangles. Therefore, we propose the value
        
        as a new quality measure to characterize rectangles.
One must note that  is a good quality measure according to Field-Oddy, and  if Q is a triangle.
Another good quality measure in this sense is
        
        where
        
        and 
 are the area of the four triangles defined by taking the four vertices of a quadrilateral into groups of three.
  3.2. New Aspect Ratio
Using the rectangle of minimum area for Q, we propose the use of the ratio of the largest to the smallest side as the aspect ratio. This measure is invariant under rigid and scaling transformations. This measure is better than Robinson’s aspect ratio. It is easy to construct an example for which the Robinson aspect ratio is 1 but the quadrilateral is distorted following the next example.
Example 2. For the quadrilateral A(3.53, 10.21), B(−10, −4), C(11.81, −1.38) and D(9.27, 11.94), Robinson’s aspect ratio 
is 1.00 but using the rectangle of minimum area , the  aspect ratio 
is 1.62. See Figure 3.  As we have discussed, some measures to characterize rectangles are based on the inner angles. Another way to achieve this is to ask Q to be a parallelogram and one of its inner angles to be a right one. As it is, we use a measure that imposes a particular condition on a rectangle instead of one on the form of Q.
Our interest is to characterize the rectangles geometrically. A well-known result in the literature is as follows:
Theorem 1. Let Q be a quadrilateral of vertices  and D whose sides are  and d. The quadrilateral Q is a rectangle if and only if the area of the quadrilateral is written as  The proof of this result can be found in Josefsson [
13]. The interesting fact about this theorem is that it provides of an analytical expression of the area of a hypothetical rectangle formed by the sum of the squares of the opposite sides of 
Q and compares the square of the area of 
Q to identify how far it is from being a rectangle.
On the other hand, following the proof of the theorem, it is easy to see that the area 
 of any convex quadrilateral satisfies
        
Using this idea, we propose the measure
        
        where 
 is defined in Equation (
12).
The measure  is a good quality measure in the Field-Oddy sense, since it is continuous, bounded and capable of indentifying degenerate quadrilaterals (to triangles), as well as to identify if a quadrilateral is non-convex. This measure reaches its optimal value of 1 for rectangles.
An acceptability interval to consider that the quadrilateral is a rectangle under this measure is .
  3.3. Quality Measure of Parallelograms
Let 
Q be an oriented quadrilateral of vertices 
. The latter defines four oriented triangles 
, 
, 
 and 
, see the 
Figure 4.
Let 
 be the area of the four oriented triangle and 
 be the area of grid cell 
Q, we have
        
        It is easy to see that a quadrilateral is a parallelogram if and only if
        
The proof is based on follow: on one side
        
On the other hand
        
        if and only if corresponding sides are parallel. But if we impose that 
g1 and 
g2 are equal 
, 
 so that the other sides are parallel, see [
4]. A quality measure to characterize parallelograms is
        
This measure is invariant under rigid and scaling transformations.
In the 
Figure 5 it is shown differents level curves for 
.
Now, we reorder these quantities in such a way that
        
        and use
        
        as a quality measure. Again, the maximum value is 1 and it is obtained for parallelograms. This is a quality measure because it is continuous, bounded and identifies degenerate and even non-convex quadrilaterals, see [
4].
In the 
Figure 6 it is shown different level curves for 
.
  3.4. Quality Measure of Squares
An ideal mesh is one in which its cells are close to being squares. If 
 is a good quality measure for triangles, the harmonic mean of the four triangles 
 is
        
If rewriting 
 in the form
        
        we obtain a good quality measure for quadrilaterals, because it is continuous, bounded, invariant under the rigid and scaling transformations and identifies degenerate and even non-convex quadrilaterals, since it inherits those properties from 
. Here, 
 is a normalization parameter.
To characterize squares, we require a property  as seen from:
Theorem 2. If  is a good quality measure for triangles according to Field-Oddy, in which for isosceles right triangle the highest energy among all right triangles is achieved,  defined in (24) is a quality measure in the Field-Oddy sense and characterizes squares at their maximum value.  Proof.  The proof is very simple; it is based on the fact that the four triangles must be congruent to have the same energy. From this it follows that the triangles must be right triangle or they do not form a quadrilateral. Now, if the lowest energy contained for right triangle only occurs when they are isosceles right triangle then 
 defined in (
24) only detects squares at its maximum value.
Some measures 
 for triangles with those properties are
          
          where 
 was proposed by Joe, [
14], 
 is the 
radius ratio measure, 
 is described by Shewchuk and 
 is Cavendish’s measure, see [
15].
Using the quadrilateral 
Q with 3 fixed vertices 
 and 
, 
 is a function of 
. In the 
Figure 7 it is shown the level curves for 
 using 
 and 
.    □
   4. Some Global Quality Metrics
In many applications, it is necessary to identify the utility of a mesh through the assessment of the quality of all the mesh elements.
The assessment of the quality of a mesh can be achieved through
- (1)
- A visual or exploratory or inspection; 
- (2)
- Qualitative evaluation or shape parameters; 
- (3)
- Statistical analysis. 
A first visual evaluation can involve analyzing the distribution in a histogram of values of a chosen good-quality measure  or metric . A second visual assessment can be performed by looking at a color map on a quality-dependent color scale. In this section, we will attempt to describe some methods or techniques with which to carry out a global qualitative assessment of the mesh by assigning a value to the mesh.
Allievi and Casal [
16] proposed two measures for qualitative evaluation of orthogonality of the mesh. The first criteria is the maximum deviation of orthogonality given by
      
      and the second is the mean deviation of orthogonality given by
      
      where 
 are the internal angles of the mesh.
Now, let 
 be a measure of quality. Other global criteria used frecuently is the average quality of a mesh 
G, or the mean quality, defined as
      
      where 
N is the number of elements in 
G. Another global measure well known is the standard deviation or the mean square error:
      which is a value that represents the averages of all the individual differences of the observations with respect to a common reference point, which is the arithmetic mean.
As it is well known, a greater value of 
 corresponds to a greater dispersion of the values, in this case 
 with respect to its mean 
. For this reason, researchers are using the geometric mean as a measure of global quality of the mesh for a measure 
 given by
      
This quantity is well known in the literature as the mesh shape parameter or simply shape parameter, see [
2].
The natural approach to evaluate the quality of an mesh from that of its elements consists of considering the best and worst element qualities, the arithmetic mean, the mean square error and the shape parameter. For the mesh of the 
Figure 8 with ADO = 13.21, MDO = 76.17, the corresponding results for differents quality measures are given in 
Table 1.
We believe that a statistical approach should be used to qualify and quantify the geometric quality of a mesh. The shape parameter for squares or rectangles can be combined with a statistical analysis of all the elements of the mesh in the following order:
- (1)
- How many elements are squares? 
- (2)
- How many elements are rectangles with aspect ratio less than 4? 
- (3)
- How many elements are parallelograms with aspect ratio less than 4? 
We will say that the remainer cells are distorted. This can be performed as follows: consider three measures of quality 
, 
 and 
 for squares, rectangles and parallelograms, and exclude rectangles from squares and parallelograms from rectangles. Let us exclude, respectively, large-aspect-ratio rectangles and large skew elements. Now let us represent those elements in a colormap, see 
Figure 8.
This technique can be very useful for meshes over irregular regions such as lakes or reservoirs.
In this paper the quality measure for curved elements are not discussed, but a good reference for curvilinear finite elements is [
17].
  5. Grid Quality Improvement
  On Distortion of the Mesh
In general, if 
 is a good quality measure for quadrilaterals, a way of measuring the distortion of a quadrilateral 
Q with respect to 
 is using
        
        because if 
 is much greater than 1, the cell will be far from the value for which 
 characterizes the geometric shape of the cell 
Q (square, rectangle, parallelogram, etc.) and we can say that 
Q is a distorted quadrilateral with respect to that measure. Usually, the maximum value of a quality measure corresponds to the minimum value of the energy density over the grid, see Ivanenko [
18].
Under this idea, the distortion of the mesh 
G can be measured as the average of the distortions of all the cells
        
        where 
 its the number of the cells. Using this concept, we have the following definition:
Definition 2. A grid  has better quality than the mesh  ifwhere  is a distorsion measure.  As an optimization problem, improving the quality of a G mesh can be considered as the problem
        
        where the inner nodes of 
G are the unknowns. In this context, the discrete grid generation problem can be posed, in general, as a large scale optimization problem. The optimization problem is a large-scale one when the mesh dimensions 
 are very large. It is important to note that the initial mesh 
 must be convex and remain so in each step of the optimization process. We use for this a Newton-like methods with bound constraints L-BFGS-B [
19].
Usually, the quality measures for quadrilaterals are non-differentiable functions; in an optimization process, it is better to build a convex function with similar characteristics to the quality measure.
  6. New Quality Discrete Functionals
From the proof of Theorem 1, it is easy to see that
      
      for any convex quadrilateral, then
      
      is a positive convex function whose critical points are rectangles. With this function, we can define a discrete functional 
 over all the grid cells
      
In 
Figure 9, the shape of the surface of 
 is sketched.
We propose to combine this functional with a convex area functional 
 defined in [
3]. This functional has an infinite barrier at the boundary of the set of unfolded grids.
      
      where 
. In addition, the function
      
      can be interpreted (by cells) as a normalization (with respect to the Jacobian) of Knupp’s area-orthogonality functional defined in [
20]
      
As we have discussed, since the quality measures are usually non-differentiable functions, it is difficult to use them as objective functions; it is advisable to design the convex and differentiable functions , whose optimal values also satisfy  for a specific quality measure .
As it is known, a rectangle is a parallelogram, so its opposite sides are equal. The diagonals of a rectangle are equal and bisect each other. In 
Figure 10, we can see those elements.
With this idea, we propose to use a convex functional of the form
      
      over all elements of the grid 
G. Locally, this functional has a critical point in the cells formed by parallelograms, see Khattri [
21].
Optimizing 
 is an attempt to produce parallelograms. Now, we define a discrete functional to obtain rectangles. For each cell of 
G let us measure the square of the difference of the square of diagonals
      
      combining both functionals, we obtain
      
If where 
 is chosen to allow that shape of the cells can be flexible. In the practice we use 
. 
 is a positive and convex functional, which has a critical point in a mesh formed by rectangles (including squares). This can always be achieved if we guarantee that in each optimization step the mesh is convex.
Therefore, we use 
 to guarantee and preserve the convexity of the mesh, and combine it with the latter functional in the form
      
Thus, with a linear convex combination between  and , one can generate both convex grid and close to being rectangles.
  7. Examples
For both functionals, we can obtain optimal grids whose cells have a very large aspect ratio, see 
Figure 11.
Now, for control of the aspect ratio, we propose to use an area (volume) distortion measure functional
      
      over all the 
N signed areas of all the grid cell triangles. Here, 
 is an adequate value, see [
4]. This distortion measure has a barrier on the boundary of the set of grids consisting of convex quadrilateral cells and it is very similar to the one proposed by Garanzha [
22], but now we have a better control of the global distribution of the area.
For the mesh optimized using the functional (
37) with area control, we show in 
Figure 12 the color maps for two quality measures.
For the mesh optimized using the functional (
43) with area control, we show in 
Figure 13 the color maps for two quality measures.
As it is well known, for irregular regions, the distorted cells accumulate near the border.
  8. Conclusions
In conclusion, this paper presented an overview of classical quality measures and introduced new quality measures for quadrilaterals that help to improve meshes and the aspect ratio. We show that our aspect ratio is better than the one proposed by Robinson. We propose that a statistical approach should be used to qualify and quantify the geometric quality of a mesh. In addition, we have proposed new functionals for grid generation as alternatives for area-orthogonal grid generation. These functionals are based on the fact that the maximum value of a quality measure corresponds to the minimum value of the energy density over the grid.
Future work in this area could include extending some of these ideas to 3D, as well as exploring the potential of functionals for volume grid generation, which need to be further investigated.