adjdata adjusts the data points in counterclockwise order based on the shortest distance method.
UTF-8
adjdata(x, y, ub.np =2000, times =1.2, len.pro =1/20, index.sp =1)
Arguments
x: the x coordinates of points on a polygon's boundary.
y: the y coordinates of points on a polygon's boundary.
ub.np: the upper bound of the number of points eventually retained on the polygon's boundary.
times: the number of times un.np is initially retained as the number of points.
len.pro: the proportion of the distance between any two points to the maximum distance between the points on the polygon's boundary, which is used to determine whether the second point needs to be deleted.
index.sp: the index of the starting point of a group of indices that regularly divide the number of points on the polygon's boundary into ub.np parts.
Details
When ub.np > length(x), length(x) points on the polygon's boundary are retained. The quantile function in package stats
is used to carry out the regular division of data points. From the starting point, the second point is the one that has the shortest distance from the former. When the distance between the two points is larger than len.pro multiplied by the maximum distance between points on the polygon's boundary, the second point is deleted from the coordinates. Then, the third point that has the shortest distance from the first point is defined as the second point. If the distance between the first point and the second point is no more than len.pro multiplied by the maximum distance, the first and second points are recorded in a new matrix for the coordinates of the polygon, and the second point is defined as the first point in the old matrix for the coordinates of the polygon. The shortest distance method is then used to look for a third point that meets the requirement.
Returns
x: the x coordinates of points eventually retained on the polygon's boundary.
y: the y coordinates of points eventually retained on the polygon's boundary.
References
Shi, P., Gielis, J., Quinn, B.K., Niklas, K.J., Ratkowsky, D.A., Schrader, J., Ruan, H., Wang, L., Niinemets, Ü. (2022) 'biogeom': An R package for simulating and fitting natural shapes. Annals of the New York Academy of Sciences 1516, 123−134. tools:::Rd_expr_doi("10.1111/nyas.14862")
Shi, P., Ratkowsky, D.A., Li, Y., Zhang, L., Lin, S., Gielis, J. (2018) General leaf-area geometric formula exists for plants - Evidence from the simplified Gielis equation. Forests 9, 714. tools:::Rd_expr_doi("10.3390/f9110714")
Su, J., Niklas, K.J., Huang, W., Yu, X., Yang, Y., Shi, P. (2019) Lamina shape does not correlate with lamina surface area: An analysis based on the simplified Gielis equation. Global Ecology and Conservation 19, e00666. tools:::Rd_expr_doi("10.1016/j.gecco.2019.e00666")
The initial boundary data of a polygon can be obtained by running the M-file based on Matlab (version >= 2009a) developed by Shi et al. (2018) and Su et al. (2019) for a .bmp black and white image of the polygon. See references below.