Keywords

3.1 Adaptive Local Refinement

In this chapter, we will let the x- and y-coordinates of the points serve as the parameter values while the surface (or function) approximates the z-component of the data. We note that the algorithm handles parameterized points as well, for which each point is given with a parameter pair and 3D coordinates, see [Flo05] for a review of the different parameterization methods. In the following we will focus on elevation and therefore denote the surface parameters x and y.

3.1.1 General Principle of Adaptive Spline Refinement

We distinguish between two type of methods for fitting point clouds using local refinement:

  • Adaptive methods: Here the spline space used in the surface fitting is only changed locally guided by the previous approximation result.

  • Non-adaptive methods: the refinement of the spline space is performed independently of previous results.

Adaptive local refinement procedures are favorable in terms of the number of coefficients that defines the final surface. The proposed adaptive local refinement will be performed as follows:

  1. 1.

    Initial step: The point cloud is approximated by a tensor product (TP) B-spline surface which is a piecewise polynomial over a rectangular domain, see Chap. 2 for more details. A TP B-spline surface is a special case of an LR B-spline surface. This initial surface is represented as an LR B-spline surface to start the iteration.

  2. 2.

    Following steps: As long as the distance between some points and the surface is above the given tolerance in some subdomains of the surface, the surface is refined in these parts only. We address alternative refinement strategies in Sect. 3.2, while the technical details of the refinement procedure is described in details in Chap. 2 and briefly in Sect. 3.1.2. The principle of adaptive refinement is summarized in Algorithm 1.

  3. 3.

    Last step: A geospatial point cloud may represent a very rough terrain and contain noise and possible outliers. We usually stop the iteration before all points are closer to the surface than the tolerance to avoid fitting the noise. The refinement process can be stopped by the number of iterations or by statistical criteria as described in Chap. 4.

figure a

3.1.2 Refining the LR B-Spline Surface

The initial surface is the starting point for the adaptive surface approximation. It is a TP B-spline surface represented as an LR B-spline surface. The parameter domain of such a surface is defined by a regular mesh of lines (the initial tensor mesh represented as a LR mesh). The meshlines split the domain into rectangles (boxes), each corresponding to a polynomial piece of the surface. Axis parallel meshline segments are successively inserted into the surface where the accuracy requirements are not met and have to satisfy:

  • The meshline segment starts and ends at meshlines in the orthogonal parameter direction.

  • The meshline segment has to split the support of at least one existing LR B-spline.

Fig. 3.1
figure 1

Initial TP mesh (blue) with a meshline to insert (black). a The supports of two B-splines are shown prior to insertion. b After insertion, the brown B-spline is split while the green B-spline is unchanged. The black candidate line has become a part of the LR mesh and turned into blue

The resulting mesh defines a collection of none overlapping boxes. A box can touch but don’t overlap adjacent boxes. The union of the boxes corresponds to the union of the boxes of the TP mesh. The B-splines spanning the spline spaces are created in parallel to the refinement of the LR mesh by splitting existing B-splines that no longer have minimal support. This way, the number of internal meshlines traversing the entire support of the B-spline does not exceed the polynomial degree. Note that meshline multiplicity has to be included in the count. Figure 3.1a shows an initial TP mesh corresponding to a biquadratic surface prepared for local refinement. The supports of two overlapping B-splines are shown with brown vertical lines and green diagonal lines. A new meshline (black) is entered. Since it covers the support of the brown B-spline, it is a legal refinement. In Fig. 3.1b, we see that the B-spline corresponding to the brown support is split. The new supports are depicted with brown vertical and brown horizontal lines, respectively. The line does not traverse the green support, and this B-spline remain unchanged. The new line has been included in the mesh, but not in the definition of the green B-spline. The line also leads to the splitting of two more B-splines (not shown here for the sake of simplicity). Since two pairs of the new B-splines are identical, the total increase in the number of B-splines, and consequently the surface coefficients, is one.

3.1.3 Goodness of Fit of the Approximation

Following [Sky15], we define the performance indicators:

  1. 1.

    The root mean square error (RMSE) with respect to the approximated surface in the z-direction defined as \(RMSE=\frac{1}{\sqrt{n_{obs}}}{\left\| \hat{\textbf{z}}-\textbf{z}\right\| }_2\), where \(\hat{\textbf{z}}\) is the estimated z-component of the point cloud obtained after the kth iteration. The RMSE is a good measure to estimate the standard deviation of a typical observed value from the model’s prediction. Here we assume that the observed data can be decomposed into the predicted value and random noise with mean zero. The RMSE does not, however, take into account the spatial pattern of the error. Additionally, the number of observations will influence its value. A thinned version of a point cloud will give a smaller RMSE regardless of the accuracy in each single point.

  2. 2.

    The mean absolute error (MAE). To overcome the aforementioned limitation of the RMSE, we introduce the MAE, which is less sensitive to outliers than RMSE.

    $$\begin{aligned} MAE=\frac{1}{n_{obs}}\sum _{i=1}^{n_{obs}} |z_j - \hat{z_j}|, \quad \textbf{z} = \{z_j\}_{j=1}^{n_{obs}}\, \text { and }\, \hat{\textbf{z}} = \{\hat{z}_j\}_{j=1}^{n_{obs}} \end{aligned}$$

    We have \(MAE \le RMSE \le \sqrt{n_{obs}}\times MAE\).

  3. 3.

    The maximum error defined as \({Max}_{err}={max\left\| \hat{\textbf{z}} -\textbf{z}\right\| }\).

  4. 4.

    The number of points outside a given tolerance: \(n_{out}\).

  5. 5.

    The number of coefficients \(n_{cp}\) estimated for a given iteration k of the refinement.

  6. 6.

    The computational time CT. The computations are performed on a stationary desktop with 64 GB of DDR4-2666 RAM. It has a i9-9900 K CPU with 8 cores and 16 threads, but a single core implementation is used in the examples.

3.2 Refinement Strategies

During the adaptive surface approximation, we maintain local information on the approximation accuracy for each mesh cell. The cells with insufficient accuracy are easily identified, but it is not obvious that every such cell should trigger refinement at every iteration step in the adaptive algorithm.

3.2.1 Isogeometric Analysis Versus Scattered Data Approximation

Some studies on the properties of various refinement strategies for LR B-splines and other LR splines exist, mostly in the context of Isogeometric Analysis (IgA). Johannessen et al. [Joh13] apply the strategies they named Full span, Minimum span and Structured mesh combined with LR B-splines for IgA. Bracco et al. [Bra18] also focus on IgA and study two classes of meshes for hierarchical B-splines. Hennig et al. [Hen17] compare two refinement strategies for hierarchical B-splines and T-splines. The refinement of LR B-spline surfaces from the perspective of maintaining local linear independence has been addressed in [Bre15] and [Pat20], respectively.

The use of LR splines for scattered data approximation differs from the use in IgA by the persistence of the surface. In the approximation setting, the computed surface is the final result while in IgA, the surface (or volume) is an intermediate step in the computations, i.e., the surface is not kept for further use. When approximating a point cloud, the variation of the underlying surface represented by the data points can be deduced during the approximation. A tailor-made selection of surface coefficients is possible. In IgA it is only possible to know which degrees of freedom are necessary first when the simulation is completed. An extensive introduction of new degrees of freedom may be appropriate. We will focus on approximation accuracy related to data size as in [Sky22].

3.2.2 Refinement Strategies in the Approximation Context

In the following, we focus on the approximation of geospatial data and present a variety of refinement strategies. The approximation algorithm coincides with the one presented in Sect. 3.1.1 and the iteration is pursued until the prescribed tolerance is met or no further accuracy improvements are possible. Here we give a short overview over the refinement strategies pursued in [Sky22], which are partly the same as in [Joh13]. The methods will be applied to various data sets in Chaps. 5 and 6.

The strategies are:

Full span (F)::

All B-splines overlapping a mesh cell identified for refinement are refined in their support. One new meshline for each selected parameter direction is entered in the middle of the knot interval(s) corresponding to the identified cell.

Minimum span (M)::

Only one B-spline overlapping a mesh cell identified for refinement is refined in its support. Several methods for selecting this B-spline can be addressed. In this context, we consider only a choice that combines the size of the B-spline support and the number of out-of-tolerance points situated in this support (c).

Structured mesh (S)::

A B-spline is selected for refinement, and refined in its support by inserting new knots in the middle of all knot intervals of the B-spline.

Restricted mesh (R)::

A B-spline is selected for refinement, and refined in its support by inserting new knots in a subset of the knot intervals of the B-spline. Knot intervals towards the middle of the support, large intervals compared to the size of the support, and intervals corresponding to cells with a high number of points having a residual value larger than the tolerance are subject to knot insertion.

Given a mesh cell where the accuracy criteria are not met, the approximation flexibility will increase locally if one B-spline containing the cell in its domain is split. A good refinement strategy will insert enough new meshlines to resolve the criteria in a substantial number of cells without starting to adapt to noise. A slow pace in the introduction of meshlines in general gives surfaces with few coefficients, but increases the computational time to some extent. On the other hand, a very restrictive introduction of lines may lead to a blocking meaning that the approximation accuracy is not improved despite an introduction of new mesh lines in areas where the tolerance is not met. The pace of the refinement can be reduced by selecting a restrictive strategy (Mc or R), by refining in one parameter direction at a time (A) as opposed to refining in both directions (B), or by applying some kind of threshold. The latter means that not all candidate mesh cells or B-splines are refined at each iteration level. The candidates are sorted according to selected criteria involving the number of points outside the tolerance belt and the residual value in these points [Sky22]. Only the most significant candidate cells are refined.

To summarize, the full span strategy (F) shows the most stable behaviour for the diversity of test cases investigated. Alternating parameter directions (A) gives fewer coefficients than the full span strategy in general, with an acceptable increase in computational time. Thresholding can be beneficial, but these results were slightly less conclusive. Furthermore bidegree (2, 2) is preferred over bidegrees (1, 1) and (3, 3). Bicubic polynomials generally produces more coefficients without delivering better accuracy. Bilinear polynomials often results in lean surfaces, but the stability suffers for some data sets and some refinement strategies. We will build on the results from [Sky22] and complement them with statistical considerations in Chap. 4. Further examples are given in Chaps. 5 and 6.

Fig. 3.2
figure 2

Refinement strategies. a Initial mesh, selected cell is yellow. b Full span in one parameter direction at a time (FA). c Full span in both parameter directions (FB). d Minimum span in one parameter direction at a time (McA). e Minimum span in both parameter directions (McB)

Fig. 3.3
figure 3

Refinement strategies. a Initial mesh, selected B-spline support is yellow. b Structured mesh in one parameter direction at a time (SA). c Structured mesh in both parameter directions (SB). d Restricted mesh in one parameter direction at a time (RA). e Restricted mesh in both parameter directions (RB)

Figures 3.2 and 3.3 show the resulting mesh after refinement triggered by one mesh cell or B-spline using different strategies. The initial surface is biquadratic and defined on a uniform mesh with seven inner knots in each parameter direction. Normally, a number of refinements is performed at every iteration step, but here only one cell or B-spline support is selected for illustration purposes.

3.3 Surface Approximation

At each step in the iterative surface fitting algorithm, the coefficients of the current surface are computed to obtain the best fit to the point cloud. The approximation is performed either using a least squares (LS) approach or the multilevel B-spline approximation (MBA).

3.3.1 Least Squares Approximation

In this section, we introduce the concept of LS approximation within the framework of surface fitting. We restrict ourselves to the main formulas for the sake of simplicity. More details can be found in the references.

General Formulation

The LS approximation is a global method. The following expression is minimized with respect to the surface coefficients \(c_B\) over the entire surface domain:

$$\begin{aligned} \min _{\textbf{c}} [\alpha _1 J(F(x,y)) + \alpha _2 \sum _{h=1}^{n_{obs}} (F(x_h,y_h) - z_h)^2]. \end{aligned}$$
(3.1)

\({\textbf{x}}=(x_h,y_h,z_h), h=1,\ldots ,n_{obs}\) are the data points. The surface is defined as \(F(x,y) =\sum _{B \in \mathcal {B}_j} c_B N_B(x,y)\), where \(N_B\), \(B \in \mathcal {B}_k\), are the scaled TP B-splines defined as in Sect. 2.5. Note that we index by TP B-splines in the collection \(\mathcal {B}_k\). Thus, the LS method minimizes a scaled version of RMSE. The expression is differentiated and turned into a linear, sparse equation system in the number of surface coefficients. The equation system is solved iteratively using a pre-conditioned conjugate gradient method. A pure LS approximation method will result in a singular equation system if there exist B-splines with no data points in their support.

Smoothness Function

A typical point cloud has a non-rectangular outline and may contain voids. Parts of the surface domain will frequently lie outside the domain of the point cloud. This challenge is addressed by adding a smoothness term J(F(xy)) to the minimization functional. It allows to solve a non-singular equation system even if this situation occurs. Thus the smoothness term approximates the minimization of curvature and variations of curvature in the surface. These intrinsic measures are made parameter dependent to give rise to a linear equation system after differentiation. The smoothness term is expressed as:

$$\begin{aligned} J(F(x,y)) = {\int }{\int \limits _{\Omega }}\int \limits _0^{\pi } \sum _{i=2}^3 w_i \Big (\frac{\partial ^i F(x_0+r \cos \phi ,y_0 + r \sin \phi )}{\partial r^i}\Big |_{r=0} \Big ) \textrm{d} \phi \textrm{d} x_0 \textrm{d} y_0. \end{aligned}$$
(3.2)

At each point \((x_0,y_0)\) in the surface domain \(\Omega \), a weighted sum of the directional first and second derivatives of the surface is integrated around the circle and the result is integrated over the surface domain. The directional derivative is represented by the polar coordinates \(\phi \) and r. The two terms in J(F(xy)) are given equal weight. The weight on the smoothness term is kept low to emphasize the approximation accuracy. In the examples of the next sections \(\alpha _1= 1.0\times 10^{-9}\) and \(\alpha _2 = 1-\alpha _1\). A more detailed description of the procedure can be found in [Meh97]. A suite of alternative smoothness terms is presented in [Now98].

3.3.2 Multilevel B-Spline Approximation

MBA is a local, iterative approximation method,  [Lee97]. It was originally developed for a hierarchy of TP B-spline functions. Given a current surface \(F_k(x,y)\), the residuals corresponding to the data points are defined and a surface \(G_k(x,y)\) approximating these residuals is computed. In the hierarchical B-spline setting, a set of subdomains where a prescribed tolerance is not met is identified and residual surfaces are computed for these domains only, [Zha98]. A special construction is applied to maintain continuity of the final hierarchical surface at the boundaries between these subdomains and the remaining parts of the surface.

Computing the Coefficients of the Residual Surface

The coefficients \(q_B\) of the residual surface \(G_k(x,y) = \sum _{B\in \mathcal {B}} q_B N_B(x,y)\) are computed individually for each scaled TP B-spline \(N_B\). Each coefficient \(q_B\) is determined from the collection of data points \(P=(x_p,y_p,z_p)\in {\mathcal {P}}_B\) in the support of \(N_B\). Let \(r_p = z_p - F_k(x_p,y_p)\) be the residual corresponding to the point \((x_p,y_p,z_p)\). The coefficient is computed as

$$\begin{aligned} q_B = \frac{\sum _{P \in \mathcal {P}_B} N_B(x_p,y_p)^2 \phi _{B,P}}{\sum _{P \in \mathcal {P}_B} N_B(x_p,y_p)^2}, \end{aligned}$$
(3.3)

where \({\phi }_{B,P}\), addressed below, depends both on the residuals of the points in \({\mathcal {P}}_B\) and the collection, \(\mathcal {B_T}\), of B-splines with a support overlapping at least one point in \(\mathcal {P}_B\). By default \(N_B \in \mathcal {B_T}\). For each of the residuals, we define an under-determined equation system

$$\begin{aligned} r_p=\sum _{C\in \mathcal {B_T}} \phi _{C,P}N_C(x_p,y_p), \, P\in \mathcal {P}_B. \end{aligned}$$
(3.4)

where \({\phi }_{C,P}\) are unknowns to be determined. There are many solutions to this equation system. For MBA, the solution is computed as a pseudo-inverse, see [Hsu92], giving

$$\begin{aligned} \phi _{C,P} = \frac{N_{C}(x_p,y_p)r_p}{\sum _{C'\in \mathcal {B_T}} N_{C'}(x_p,y_p)^2}, \, {C\in \mathcal {B_T}, \, P\in \mathcal {P}_B}. \end{aligned}$$
(3.5)

This solution minimizes

$$\begin{aligned} \sum _{P \in \mathcal {P}_B} \phi _{C,P}^2 \end{aligned}$$
(3.6)

in the LS sense.

Finally we select \({\phi }_{B,P}, \, P\in {\mathcal {P}}_B\) as the missing piece in Eq. 3.3. The process is explained in more detail in [Zha98].

Updating the LR B-spline Surface

The current surface and the residual is represented by a collection of LR B-splines following the procedure of Sect. 2.5. Thus the updated surface can be computed as

$$\begin{aligned} F_{k+1}(x,y) = F_k(x,y)+G_k(x,y) = \sum _{B\in \mathcal {B}} (c_B+q_B) N_B(x,y). \end{aligned}$$
(3.7)

MBA is an iterative process. Experience indicates that repeated applications of the approximation algorithm without adding more mesh lines improves the approximation accuracy. The improvement is stopped when the accuracy is restricted by the potential in the current collection of B-splines.

In [Sky15], the two approximation algorithms are compared in various examples. In general, the LS algorithm has a better approximation order while the MBA-algorithm is more stable when the spline space is less regular and/or the number of points in each element is low. We will discuss this topic further in Chap. 5.

3.3.3 Summary of the Adaptive Refinement

The LS method provides the best approximation to the point cloud in the L2 norm. Adding the smoothness term with a small weight maintains the good approximation properties. However, some supports of the smallest B-splines can contain none or few points in case of unevenly distributed scattered data points. Moreover, there is a risk of overfitting with LS, leading to ripples in the surface, see [Bra20]. Thus, the MBA method should be preferred after a few iterations with LS. As stated in Eq. 3.6, the pseudo inverse tends to minimize the deviation of the residual surface from zero. The procedure of local refinement combining LS and MBA is illustrated in Fig. 3.4 and can be summarized as follows:

  1. 1.

    The surface fitting algorithm starts with a LS approximation of the point cloud at the coarser levels to benefit from the best approximation property.

  2. 2.

    The local refinement strategy for LR-splines is applied iteratively to cells on which the L1-norm in the z-direction of the point-wise residuals exceeds a certain tolerance.

  3. 3.

    The algorithm switches to MBA after a few iterations. The switch is triggered either (i) by a prescribed iteration level being reached, (ii) if the convergence of the conjugate gradient method used for LS slows down, or (iii) if the number of surface coefficients and consequently the size of the LS equation system becomes large.

Fig. 3.4
figure 4

Combination of MBA and LS for adaptive surface approximation with LR B-splines

3.4 Example of Adaptive Refinement

In the following section, we will illustrate how adaptive fitting with local refinement using LR B-splines works. To that end, two simulated point clouds are generated.

3.4.1 Generation of Reference Point Clouds

The reference surfaces correspond to Fig. 3.5a: A smooth geometry and Fig. 3.5b: A geometry with sharp edges. For each generated point cloud, we set \(\left( x,y\right) \in {\left[ -1,1\right] }^2\) with \(n_{obs}=40{,}000\) scattered data points \(\left( x_i,y_i,z_i\right) \), \(i=1...n_{obs}\). The z-component is obtained from the proposed mathematical equations:

$$\begin{aligned} \text{ Point } \text{ cloud } \text{(a): } z=\frac{\tanh {\left( 10y - 5x \right) }}{4} + \frac{1}{5 \text {e}^{(5x -2.5)^2 + (5y-2.5)^2}}. \end{aligned}$$
(3.8)

The point cloud is illustrated in Fig. 3.5a and corresponds to a Gaussian bell as would be a mountain in real life, and a dam-like jump with a smooth transition.

$$\begin{aligned} \text{ Point } \text{ cloud } \text{(b): } z&= \frac{1}{3\text {e}^{\sqrt{(10x-3)^2+(10y-3)^2}}} + \frac{2}{3\text {e}^{\sqrt{(10x+3)^2+(10y+3)^2}}} \nonumber \\ {}&+ \frac{3}{3\text {e}^{\sqrt{(10x)^2+(10y)^2}}}. \end{aligned}$$
(3.9)

The surface represents three peaks with different levels of altitudes on a flat ground, see Fig. 3.5b. We conjecture that the large gradient and the edges are challenging to approximate with LR B-splines. We refer to Chap. 1 for a discussion on approximation methods.

Fig. 3.5
figure 5

Visualization of the mathematical functions. a A Gaussian bell with a dam-like jump. b Three peaks on a flat ground

3.4.2 Results of Simulations

To illustrate how adaptive surface fitting with LR B-splines performs, we use the two point clouds (a) and (b). Following Algorithm 1, we set a maximum of 10 iterations and use a tolerance of 0.007. We present the meshes and some corresponding surfaces for point cloud (a) in Figs. 3.6 and  3.7, and in Fig. 3.8 for point cloud (b). Additionally, we compute the MAE, the maximum error, the number of points outside tolerance and the computational time at each iteration, see Tables 3.1 and 3.2 for point cloud (a) and (b), respectively. We focus on the full span refinement strategies with alternating parameter directions (FA), as described in Sect. 3.2 and choose the polynomial bidegree (2, 2) for the splines.

Point cloud (a)

Fig. 3.6
figure 6

Meshes at different level of approximation for point cloud (a). tolerance 0.007, refinement strategy FA, polynomial bidegree (2,2)

Fig. 3.7
figure 7

Final fitted surface after 6 iterations for point cloud (a) with tolerance 0.007

Fig. 3.8
figure 8

Top: Meshes at different iteration steps for point cloud (b). tolerance 0.007, refinement strategy FA. Bottom: The fitted surface for level 0 and 10

After 4 iterations, the algorithm switches to the MBA strategy and stops after the 6th iteration. Here the number of points outside tolerance \(n_{out}\) reaches 0 and the maximum error \({Max}_{err}\) is 0.0046. Approximately 1300 coefficients are needed to approximate the 40,000 points in less than 0.21 s. These values highlight the potential of surface fitting with LR B-splines to approximate in a short amount of time a high number of observations. The MAE reaches 0.00041 at the last iteration level and is close to the tolerance after the 3rd iteration (0.0085 vs. 0.007). Here only 473 coefficients have to be estimated, which is 400 times lower than the total number of points. We point out that a lower tolerance would have led to a higher number of coefficients and more iterations. The choice of the tolerance is often left to the user’s convenience and will be discussed in Chap. 4 by means of statistical criteria.

Figure 3.7 provides a visualization of the LR B-spline surface at the 6th iteration. This latter is close to the original one. At the 1st refinement level, the mesh is split by series of vertical meshlines. After the 3rd iteration the refinement is performed near the slope and the bell. As the number of iterations increases, the precision of the refinement in this area is getting higher.

Point cloud (b)

Unlike the approximation of point cloud (a), 4 points are still outside tolerance for fitting point cloud (b). They are located at the highest peak in the middle of the surface. We use the same tolerance of 0.007 and a maximum of 10 iterations. At that point, \({Max}_{err}\ \)reaches 0.017 and the MAE 0.00037. Although the size of the two data sets is the same, the geometry of point cloud (b) is more challenging to approximate with an LR B-spline surface. We further note that MAE saturates at the 7th iterations. Increasing the levels of refinement from the 7th to the 10th does not lead to a significant improvement in accuracy (0.00039 vs. 0.00037) for 92 additional coefficients (800 vs. 892). We note that the CT remains under 0.3 sec after 10 iterations. This is a slightly higher CT than for point cloud (a) due to the increase of iteration levels. The splitting of each B-spline becomes more costly as the number of B-splines increases. From Fig. 3.8, the refinement leads to a mesh having more meshlines in the domain corresponding to the three peaks, which is expected from a local refinement strategy. The adaptive fitting with local refinement using LR B-splines has a high performance regarding the geometry with sharp edges and curvature changes (Table 3.2).

Table 3.1 Results of fitting point cloud (a)
Table 3.2 Results of fitting point cloud (b)

3.5 Conclusion

In this chapter, we have introduced the adaptive fitting with LR B-splines and explained four refinement strategies. The latter can be performed either in one or two directions; The choice of the method depends on the point clouds and the applications at hand, e.g., if the computational time or mesh regularity are important criteria. We have described the LS method to perform surface approximation, to which a smoothness term can be added. This approximation strategy is used in the first iterations of the adaptive algorithm, starting from a coarse mesh. In a second step, we described the MBA, which provides an explicit expression of the coefficients, thus avoiding matrix inversion without losing goodness of fit. An example with simulated observations have shown both the simplicity, conciseness and accurateness of the approximation method with local refinement.