A shape equation for Hayward Kiwifruit

ABSTRACT In this paper, a new shape equation for Hayward kiwifruit is developed. Being simple and generic, it required only the major measurable dimensions of a kiwifruit as inputs (length, major-diameter, and minor-diameter). The equation was validated against empirical shape data with a maximum 3.09% error. The new shape equation can estimate important metrics, such as volume, mass and surface area. Equation development was generalized, so shape equations for other crops could be produced using the same methodology. The simplicity and speed of this new method allow realistic populations of Hayward kiwifruit to be rapidly generated in a modeling environment.


Introduction
Mathematical modeling is being increasingly utilized to innovate and optimize key pre-and post-harvest processes, vital to the success of the horticultural cold-chain. [1][2][3][4][5] One current challenge in the model development process for products of biological origin is the definition and construction of an accurate 3D model geometry. Fruits and vegetables are in particular produced with a wide variability in shape and size, even within a given cultivar. Environmental, nutritional and production management differences result in each fruit having a unique size, mass, and shape. [6][7][8][9] Taking this natural variability into account is a key obstacle to engineering efficient processes in the horticultural industry, with larger design tolerances being required to operate competently compared with other industries, driving up costs. [10] Commercially, variances in size and shape are typically managed in the sorting and packing processes, where morphological defects are removed and produce is electronically sorted into mass ranges. [11][12][13] Even so, within a size range, there still remains a range of size and shape.
In this paper, a new shape equation for Hayward kiwifruit is developed, to create a process for rapidly generating populations of fruit shapes and sizes in a computational environment. Kiwifruit was chosen as the subject of this study because it is the largest fresh horticultural export of the authors' home nation, New Zealand. [14] The primary requirements to this new approach is that: (1.) it can be conducted independent of shape input data (such as [15,16] and [3] ); (2.) it performs better than ellipsoid approximation; (3.) it is sufficiently simple to implement as a few short lines of code, in order to execute natively in modelling software such as COMSOL or Blender, and; (4.) it can be used to draw an accurate 3D kiwifruit of any size or shape with little to no modification of the original equation(s). The best method to meet these criteria is an algebraic function that follows the longitudinal profiles of a Hayward kiwifruit, and can be scaled/sized to different grades by setting the value of several scale factorsideally, the measurable dimensions of a kiwifruit.

Development of a shape equation for Hayward kiwifruit
The major geometrical attributes of a single 'Hayward' kiwifruit (Actinidia deliciosa) are: length (distance from the largest axial cross section to the apex), L; major axis (maximum distance at the largest axial cross section), D X ; and minor axis (minimum distance at the largest axial cross-section, perpendicular to the major axis), D Y (Figure 1). The shape of a kiwifruit has three profiles: the lateral X-Y profile (red line), a function of D X and D Y ; the longitudinal X-Z profile (blue line), a function of D X and L; and the longitudinal Y-Z profile (yellow line), a function of D Y and L ( Figure 1). In this section algebraic functions are developed that represent the lateral and longitudinal profiles of a 'Hayward' kiwifruit.
An anonymous industrial partner provided shape data of count 36 'Hayward' kiwifruit to help develop and validate a shape equation (Figure 2). [11] The information was empirically determined   [11] Images not to scale; scale omitted to preserve data confidentiality. lateral and longitudinal profiles, derived by sketching the outlines of 117 fruit, producing maximum, minimum and average fruit size within the count 36 mass range. As this information is commercially sensitive, Figure 2 is not to scale and the scale has been omitted. Subsequent analysis and discussion of kiwifruit shape and size use dimensionless lengths.
Although the entire volume of the kiwifruit cannot be described as an ellipsoid, [17] the lateral profile ( Figure 2c) is nearly elliptical. Ellipses with the same major and minor axes as D X and D Y are compared to the empirical lateral profiles in Figure 2c. The differences in area were minimal, with an error of 0.26%, 0.39% and 1.61% for the minimum, average and maximum lateral profiles, respectively. These low errors demonstrate an ellipse can accurately describe the lateral profile of a Hayward kiwifruit.
Kiwifruit do not have an elliptical longitudinal profile. [17] Instead, kiwifruit are relatively flat near the center of the fruit, and then curve sharply at the apices to form a shoulder (see Figure 2a and b), a shape distinct from an ellipse. An algebraic function was developed that has this behavior, named a longitudinal profile function (LPF). The general form of an LPF is: where f 1 is the LPF, a function of the diameter of the fruit (D), the length of the fruit (L) and the distance from the center of the fruit (largest axial cross-section) to the apices (Z). As there are two longitudinal profiles, there are two LPFsone each for the X-Z and Y-Z directions; indicated by subscript j, where j ¼ X or Y. The origin of the Z-axis (where Z ¼ 0) is the largest axial cross-section, marked as the X-centre and Y-centre on Figure 2. Separate LPFs can be considered for the top (calyx) and bottom (stem) halves of the fruit. This is indicated by subscript k, where k ¼ calyx or stem. The LPF (f 1 ) gives d, the distance from the Z-centre line to the outer edge of the fruit along the X-or Y-axis, at any point along the Z-axis. It is assumed there is symmetry along the Z-centre line. This is a valid assumption as the fruit is graded to eliminate significant morphological deformities prior to packaging. [11] At the center of the fruit (Z ¼ 0), the output of the function must be d X ¼ D X or d Y ¼ D Y ; and at the apex of the fruit (Z ¼ L k ), the output must be zero, d j ¼ 0. Within the limits of 0 Z L k , this behavior is given by: where f 2 defines the rate that d changes with respect to Z. f 2 also has limits where at Z = 0, f 2 = 0; and at Z = L k , f 2 = L k . f 2 , therefore, influences the rate at which d diminishes to 0: if there is a linear relationship between d and Z, the profile is a straight line: For an elliptical profile: So that the LPF for an ellipsoid is: As a kiwifruit is relatively flat in the middle and forms a sharp shoulder near the stem or calyx, f 2 needs to be a function that diminishes slowly at low to medium values of Z, and then quickly diminishes to 0 as Z approaches L k . This is achieved by using an exponential function: However, Equation (6) violates the limits imposed for f 2 (when Z = 0, f 2 = 0 and when Z = L k , f 2 = L k ), so the following additions are required: where S is added as a 'shoulder coefficient', where different values of S impact the steepness or flatness of the curve. Substituting Equation (7) into Equation (2) gives the LPF for kiwifruit: Non-linear least squared regression (MATLABs 'lsqnonlin' function) was used to determine the S that minimizes the difference between the new LPF and the average empirical profile provided by [11] in each of the four scenarios. Performance is assessed in Figure 3. Equation (6) showed a much closer agreement to the average empirical profiles than an ellipse: while the ellipse routinely under predicted the true shape of a kiwifruit, the new LPF was within the bounds of variability in three out of four comparisons. Although the new LPF shows a closer agreement to the average empirical profile, there was still an over prediction near the middle of the fruit and an underprediction near the apices. The level of error was problematic, as ideally the shape equation for kiwifruit should be able to produce an accurate fruit shape of any size within the given range, not just an 'average' sized fruit. As shown in Figure 3, an ellipse lacks the relative flatness near the middle of the fruit, but has a softer curve near the apices; and conversely, the new LPF curves too sharply toward the apices, but is flatter near the middle. Therefore, the two profiles are complementary and can be combined to help mitigate the deficiencies of the other. This gives an updated LPF for kiwifruit: The performance of Equation (9) is explored in Figure 4. The shoulder coefficient S = 7.0 was found by minimizing the mean percentage error across all comparisons (12 comparisons in total: the minimum, maximum and average profiles for the Z-X, Z-Y, stem and calyx directions). Equation (9) performs well at predicting the average kiwifruit longitudinal profile (maximum error of 0.55%) and also accurate across the 12 comparisons, with a maximum error of just 3.09% in the case of the minimum Y-Z stem profile (Figure 4d). Equation (9) therefore represents a single equation that requires only three input parameters, the measurable major geometric attributes of a kiwifruit (D X , D Y and L) and one constant (S = 7.0) that can accurately describe both the X-Z and Y-Z longitudinal profiles for any fruit size within the count 36 mass range.

Application of shape equation
Implementation in CAD and modeling software Equation (9) can be implemented natively into modeling software such as COMSOL [18] or Blender [19] to draw 3D kiwifruit shapes through the use of a parametric surface. Parametric surfaces are generally described by: where the three functions f X , f Y and f Z each specify the shape of the surface in the x, y and z dimensions, respectively. The u variable is the radial coordinate direction, so that 0 u 2π; and v is the coordinate in the vertical direction, so that f Z = v and 0 v L k . f X and f Y are the LPF for kiwifruit (Equation 9) in the x and y directions, respectively,but D X and D Y are replaced with D X Á cos u ð Þ and D Y Á sin u ð Þ, respectively, to transform into the radial coordinate direction, u. Z is simply transformed to be equal to v as these coordinate directions are both equivalent (for more details on surfaces, see [20] ). These transformations give: Using the shape equation in modeling software such as COMSOL is summarised in Figure 4e. Digital kiwifruit analogs were divided into eight faces, similar to how COMSOL creates spheres and ellipses. Therefore, eight separate parametric surfaces were created to describe the kiwifruit. In Blender, kiwifruits were created in a similar fashion using the 'XYZ Math Surface' function.

Volume and surface area
Given that the cross-section of a Hayward kiwifruit can be modeled as an ellipse, a kiwifruit can be modeled as a stack of elliptical disks. Therefore, Equation (9) can be used to determine the size of each disk in the stack, and the volume and surface area [21] of a kiwifruit of a given size (set of D X , D Y and L values) can be numerically determined, using the disk method. [22] With reference to Figure 5a, the first elliptical disk at the center of the fruit has the same major and minor diameters as D X and D Y . The size of subsequent disks along the Z-axis is determined from Equation (9), where the thickness of each disk is dependent on the number of disks used: where I is the total number of elliptical disks and ΔZ is the thickness of each disk. The volume disk i out of a total number of disks I is: Figure 5. Numerical calculation of (a) volume and (b) surface area using the disk technique (Riddle, 1974).
So that the volume of a kiwifruit can be estimated numerically as the sum of all disks: where Equation (14) assumes L calyx = L stem . A similar numerical approach is used for the determination of surface area. With reference to Figure  5b, elliptical disks are discretized in the radial direction to form J number of vertexes, the angle between each vertex being 2π=J radians. This is used to calculate the x, y, and z coordinates of each vertex: where V is a single vertex. Vertexes V i;j , V i;jþ1 , and V iþ1;j form a triangular face F A;i;j and vertexes V i;jþ1 , V iþ1;j , and V iþ1;jþ1 form triangular face F B;i;j . The area of the two faces are determined using Heron's formula [23] by calculating the lengths of the sides of each triangle: The surface area can, therefore, be determined numerically by summing the area of all triangular faces: The accuracy of these numerical methods is dependent on the level of discretization (I and J values). This is explored by coding the above numerical methods into a MATLAB script and applying them to a sphere with a radius of 1 m at various levels of discretization. Results are shown in Figure 6, where the volume and surface area approaches the analytical solution at relatively low levels of discretization.

Results and discussion
Validation Figure 4 serves as a validation of the shape equation for kiwifruit (Equation 9) within the count 36 size range, however, a further validation was performed for fruit outside of this range. [16] measured the major diameter (D X ), minor diameter (D Y ) and length (L) of 15 Hayward kiwifruit ranging from 55.3 to 112.3 g, and then measured the volume of each fruit using the water displacement method. These values of D X , D Y , and L where used to predict fruit volume using the shape equation for kiwifruit (Equation 9) and the disk method (I = 500), which was then compared to the measured values. Ellipsoids (Equation 5) with the same semi-axis dimensions as the fruit were also compared. Results are shown in Figure 7a. Ellipsoids routinely under predicted the true volume by a significant margin, and had a mean error of 8.5%. The new shape equation performed much better, neither consistently over nor under predicting the true volume, and had a mean error of just 2.5%.
Developing shape equations for other fruit The process described above has potential to be generalized, so that shape equations for other fruits can be created. Generating new shape equations requires careful consideration of the nature of the f 2 function (Equation 2), which defines the rate at which d approaches zero as the length Z approaches the apex, L k . It is also likely that most fruit items consist of multiple LPFs, and cannot be considered symmetrical along one or more planes. For example, a pear could be simplified to be symmetrical along the X-Z and Y-Z planes (in relation to directions displayed in Figure 1), but not along the X-Y plane. The LPF for the bottom half of a pear could be an ellipsoid (L calyx Z 0; Equation 5), but a new LPF would be required for the top half of the pear. This LPF would need to incorporate a step change in the decline of d at different values of Z, where d declines rapidly at low values of Z but then does not decline at all at medium values of Z, forming the 'neck' of the pear. As Z approaches L stem , d should again start to decline, to be equal to zero at the top of the fruit.
Alternatively, an LPF can be derived from empirical shape data through the use of a Fourier series, similar to [15] : Figure 6. Efficacy of using the disk method to numerically approximate the (a) volume and (b) surface area of a sphere (radius = 1 m) as a function of the degree of numerical discretization resolution.
Equation (27) uses polar coordinates, so relating it back to the LPF format requires d = ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi R 2 À Z 2 p and Z = R Á cos θ ð Þ, where θ = 0 ! 0.5π. This approach requires empirical data to function, so a data library of fruit shapes must be acquired first, but the acquisition of the harmonics can be automated, making it a universal approach. For example, the LPF developed for a kiwifruit (Equation 9), expressed as a Fourier series with 10 harmonics was a 0 = 1.017, a n = [−0.00398, 0.000657, −0.00984, −0.00915, −0.000949, 0.00164, 0.00241, 0.00120, 7.32E-5, −0.000163] and b n = [0.00405, 0.00658, 0.00630, −0.00504, −0.00624, −0.00350, −0.00116, 0.000549, 0.000422, 6.55E-5] for L k = 1 and D j;k = 1. While more flexible in some senses, Equation (27) is more difficult to implement natively in modeling software, and new harmonics would need to be derived with any changes to L k or D j .

Conclusion
A new shape equation for Hayward kiwifruit was developed. By developing a Longitudinal Profile Function and combining it with a parametric surface, accurate 3D kiwifruit shapes of any size can be created using only a single equation. This equation can be combined with the disk method to quickly estimate volume, mass and surface area for a given set of major dimensions, namely the fruit length, major diameter, and minor diameter. The new equation showed a very close agreement to empirical data, when compared in terms of shape and volume across a wide range of fruit sizes. The new equation can be implemented trivially into modeling software such as COMSOL or Blender, enabling the modeling and potential optimization of key kiwifruit pre-and post-harvest operations. There is potential for this approach to be generalized by developing new LPFs for other crops. ) and ellipsoids (circles; Equation 5) with measured volumes (dashed line) of kiwifruit ranging from 55.3 to 112.3 g. [16] .