SplineGen: a generative model for B-spline approximation of unorganized points
Abstract
This paper presents a learning-based method to solve the traditional parameterization and knot placement problems in B-spline approximation. Different from conventional heuristic methods or recent AI-based methods, the proposed method does not assume ordered or fixed-size data points as input. There is also no need for manually setting the number of knots. It casts the parameterization and knot placement problems as a sequence-to-sequence translation problem, a generative process automatically determining the number of knots, their placement, parameter values, and their ordering. Once trained, SplineGen demonstrates a notable improvement over existing methods, with a one to two orders of magnitude increase in approximation accuracy on test data.
keywords:
CAD; B-spline; Approximation; Parameterization; Knot Placement; Generative Modeling1 Introduction
Generative artificial intelligent (AI) models have proven to be very powerful in natural language processing, computer vision, and computer graphics [1]. In particular, there is emerging use for the synthesis of 3D shapes lately, such as meshGPT [2], SolidGen [3], and ComplexGen [4]. However, there has been limited use of these models, or even the broader deep learning models, in computer-aided design (CAD) modeling. This is mainly because those models are probabilistic (and therefore inherent uncertainty therein), while all CAD algorithms require high certainty and accuracy. This work aims to show that, despite this gap, generative models offer considerable potential for improving classic CAD algorithms by replacing the expertise-based, heuristic parts in classic algorithms with data-driven methods.
Approximating a set of data points with a B-spline curve [5] is the algorithm of choice. It is a fundamental algorithm in CAD/CAM, underlying many high-level modeling operations such as boundary evaluation, Booleans, features, tool path generation, reverse engineering, shape optimization etc. [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]. The approximation involves three main procedures: parametrization, knot placement, and approximation error minimization [16]. The first two are prerequisites for running the third. Parametrization means associating each data point with a parameter value. Knot placement refers to the choice of the number of knots and their locations for constructing spline bases. It is well known that the parameterization and knot placement have a significant impact on the final approximation accuracy [17].
Existing parameterization and knot placement methods basically fall under two different strategies. The first strategy heuristically chooses a parameterization and knot placement a posteriori for given data points. Typical examples include uniform parameterization [16], chord length parameterization [18], centripetal parameterization [19], and Foley-Nielson parameterization [20], among many others [21]. For knot placement, uniform knots [16], the knot placement technique (KTP) [16] and the new KTP (NKTP) [22] are typical examples. These methods have also been augmented by incorporating various optimization techniques, e.g., [23]. Like all heuristic methods, those mentioned above can provide acceptable results in many but not all of the potential cases. The second strategy learns a neural network to directly map data points to their corresponding parameters and knots, in an end-to-end manner [17]. Fully connected neural networks (FCNN) [24] and residual networks (ResNet) [17] have been used for this purpose so far. Reduced approximation errors were demonstrated, but the application of these methods is consistently limited to ordered and fixed-size data points.
In this work, we propose to cast the problems of parameterization and knot placement as a generative sequence-to-sequence translation problem, where unorganized input becomes possible. Rather than directly adopting existing networks (e.g., FCNN and ResNet), this work develops an extended version of the existing Transformer network [1] to meet the specific needs of B-spline approximation. The new generative model, SplineGen, can automatically determine the number of knots, their placement, parameter values, and their ordering. More specifically, SplineGen has the following features:
-
(1)
Size-independent. Restricting input data points, parameters, and knots to a fixed size would limit the practical significance of learning-based methods. The point partitioning trick as used in [17, 24] may help but cannot solve the problem altogether. By contrast, the proposed method provides a principled way to handle variable-size input data points, parameters, and knots through the use of autoregressive models.
-
(2)
Point permutation invariant. In many practical scenarios, input points may not be in a well-ordered position as required by most existing methods. As a result, a B-spline approximation-oriented neural network should exhibit permutation invariance over the input. That is, the output parameters and knots remain unchanged when input data points are permuted. This problem is to be solved by extending the transformer network with an additional self-organization module.
-
(3)
Parameter-knot alignment. Many existing methods consider parameterization and knot placement problems separately. However, they correlate highly with each other, and lower approximate errors will be achieved if they work in a cooperative way, refer to Section 3 for more details. This necessitates a neural network that can align the generation of parameters and knots. To do so, this work uses a shared autoencoder model to learn shared point embeddings for both tasks. Furthermore, we add a new module called internal cross-attention to the parameter decoder and the knot decoder to explicitly align parameter generation and knot generation.
-
(4)
High robustness. For a set of input data points, removing some of them or adding more sample points from the same curve should not affect the output significantly, if not completely identical. This simply means robustness towards data point removal or addition (of course, without changing the unknown underlying curve). To achieve this, we further extend the transformer network by adding a masking mechanism for simulating point removal/addition and predicting the corresponding output masks.
The remaining content is organized as follows: Sec. 2 provides a review of related research studies. Sec. 3 states the problem to be solved, and Sec. 4 elaborates the proposed SplineGen network. Examples and comparisons with existing methods are provided in Sec. 5, followed by conclusions in Sec. 6.
2 Related Work
Spline techniques are fundamental to the modeling of curves, surfaces, structures, as well as semantic shapes such as tool paths, in CAD/CAM applications [25, 26, 27, 28, 29, 30, 31, 32, 33]. For this reason, a ton of related studies have been presented in the literature. They may be divided into two categories: the traditional and the recent learning-based. Because there have already been excellent reviews on the method in the traditional category, e.g., [17, 18], this paper will only gives a brief summary of those methods.
2.1 Traditional methods
Parametrization methods. Because of the importance of parameterization in B-spline approximation, many research studies on this topic have been carried out. Recently, Scholz and Jüttler provided an informative summary on the classification and development of those methods in their paper [17]. Basically, heuristic methods are the dominant means of parameterization, e.g., uniform [16], chord length [18], centripetal [19], universal [34], and Foley-Nielson [20], among many others. Such basic versions have also been used as an initial guess for the parameterization and then optimized to achieve better approximation results, e.g., [35]. Typically, this leads to a highly non-linear constrained optimization problem. One line of relevant research studies focuses on the solving algorithms for this optimization problem, e.g., particle swarm optimizers [36, 37], and global optimizers [38]. The other line designs various error metrics to control the “goodness” of the final parameterization, e.g., squared distance errors [39] and angular speed uniformness [40].
Knot placement methods. Existing knot placement methods may be classified into two types: knot assignment that computes the whole knot vectors simultaneously; and knot refinement that iteratively modifies initial knots until an error threshold is met. To reflect the distribution of data points and guarantee that every knot span includes at least one parameter, there are knot assignment methods like AVG (averaging technique) (for point number = control point number ) and KTP (knot placement technique) (for point number control point number ) [16]. Because KTP will have stability issues when is slightly greater than . Piegl and Tiller [22] proposed a stability-enhanced version (NKTP) of KTP by using an averaging method. Like in parameterization, these methods have also been used as initial guesses and then optimized by iterative knot insertion [41, 42]. The essential task here is to determine when and where to insert the new knots. Several heuristics have been developed, such as angle variations [43], curvatures [44], and minimum knot size [45]. Evolutionary optimization algorithms [46, 47] and neural network-based optimization [48] have also been used to determine the knot insertion position.
The methods discussed above have proven effective in many applications, but due to their heuristic nature, they cannot provide acceptable results in all of the potential cases. This motivates the recent use of machine learning methods to carry out parameterization and knot placement, in an end-to-end manner.
2.2 Learning-based methods
Parametrization methods. The objective here is to learn a neural network to directly map data points to their corresponding parameters. The method presented in [24] appears to be the first to do so. A standard FCNN with a fixed input size of 100 data points and three hidden layers, each with 1,000 nodes, was used to construct the mapping. Because the input size is fixed, up-sampling or down-sampling is needed to run the model if the given number of data points is not equal to 100. Moreover, the training and inference of the model are time-consuming. To overcome this limitation, Scholz and Jüttler [17] replaced FCNN with ResNet, which has a fixed input size of data points if the underlying curve is of degree . Multiple models need to be trained, each for a degree. Each model can only parameterize data points. If there are more than data points, heuristical down/up-sampling is required. By contrast, the method in this paper can directly parameterize an arbitrary number of data points.
Knot placement methods. In the same paper [24], FCNN is also used to predict knot positions. The model has a fixed input size of 100 data points and three hidden layers, each with 500 nodes. It assumes that knots are a subset of parameters. Under this assumption, predicting knot positions is converted to an easier classification problem on parameters. A similar idea has also been used in [49], where a support vector machine is used to carry out the classification instead of FCNN. It is, however, arguable to snap knots onto parameters since knots and parameters do not have a shared relationship in many cases. In addition, their method’s input size is kept fixed.
3D generative methods. The proposed method in this work makes use of generative models, so it is closely related to the emerging field of generative 3D modeling [50]. Generative models have been successfully applied to a series of shape representations such as voxels [51], point clouds [52], neural implicit fields [53, 54], meshes [2], and solids [3, 4]. However, there has been limited use of generative models for B-spline modeling. Despite this, the way they designed the networks is very inspiring to this work. In particular, SplineGen has the same high-level network architecture (i.e., encoder-decoder) as most existing generative models, the low-level design of the encoder module and decoder module is different though.
Existing learning-based parameterization and knot placement methods have proven that they can be a promising alternative to the traditional heuristic methods in B-spline approximation. And reduced approximation errors were demonstrated. Nevertheless, there is still room for improvement, especially in extending the applicability and increasing accuracy. Following what has been done in [24, 17], this work presents a generative parameterization and knot placement, with added features of unorganized data points, size-independent, point permutation invariant, knot-parameter alignment, and high robustness.
3 Problem statement
Mathematically, a B-spline curve is:
(1) |
where is a varying parameter in , the B-spline basis functions of degree , and the control points. The basis functions are generated using a knot vector , as follows:
(2) | ||||
Approximating data points with a B-spline curve is to solve the following optimization problem:
(3) |
where is the parameter value corresponding to the data point . Constructing the mapping from to is the so-called parameterization.
The above optimization problem is a least square problem, and its solution can be obtained by solving the following linear system:
(4) |
where , and
It is obvious that the coefficient matrix is solely determined by three factors:
-
1.
Parametrization. Each parameter indicates the position where to evaluate the B-spline basis function and then determines all entries in the row of . Fig. 1a shows that parametrization can significantly affect the final result.
-
2.
Knot placement. The knot vector determines each B-spline basis function , which in turn determines all entries in the column of . Fig. 1b shows that the choice of knot positions can affect the approximation accuracy a lot.
-
3.
Parameter-knot alignment. Each entry of is collectively determined by parameters and knots. Leaning towards either side will not give good results. Fig. 1c shows that, if these two are not aligned well, a high approximation error occurs.
Besides the above three factors, it is also needed to determine the number of knots, adaptively. When input data points do not assume any ordering a priori, the parameters’ order also needs to be determined automatically. This does not mean sorting the parameter values, which is simple, but organizing the output parameters in a way consistent with the input data points.

4 Methods
4.1 Network architecture
Rather than directly inputting raw point coordinates into the network (as in existing methods [24, 17]), SplineGen first seeks a neighborhood-aware high-dimensional embedding for each data point, see the left part of Fig. 2. This is done with the help of the attention mechanism in transformer [1]—it allows every data point to attend to all data points in the input sequence. (This is the primary reason this work chooses transformer as the backbone.) SplineGen combines it with an additional masking mechanism to force each data point to attend more to its neighborhood regardless of how points are organized. Specifically, we use masking to simulate point embedding corruption and ask the remaining point embeddings to yield the same curve as before. As such, each point embedding carries its neighborhood’s information. To facilitate the alignment of parameters and knots, we force shared point embeddings between parameter generation and knot generation through the use of a shared autoencoder model. By doing so, we hope to capture the interplay between parameterization and knot placement in the high-dimensional embeddings.
Having point embeddings in place, two decoders are used to decode them into knots and parameters, respectively. See the middle part of Fig. 2. The knot decoder autoregressively predicts the next knot based on already generated knots until it thinks enough of them are generated, indicated by an “EOS” token. This essentially determines the number of knots and their placement simultaneously and automatically. Parameters are generated in a similar way, but with a self-organization module included in its decoder to ensure that the number of generated parameters and their order are in line with the input data points. To align these two generative models, a new module called internal cross-attention is added to the two decoders so that their attention modules are directly bundled together during knot and parameter generation. Lastly, the two decoders are further equipped with a masking mechanism to simulate data point removal/addition. It enforces a robust generation of knots and parameters (and therefore a robust approximation of the same curve) when some data points are missing or added.
SplineGen’s last module is a physics-informed neural network (PINN) layer appended to the above two decoders. PINN is a machine learning technique allowing governing equations (e.g., Eqs. (3) and (4)) to be respected during training [55]. In this regard, the added PINN layer can directly use Eq. (4) to guide the alignment of knot and parameter generation, capturing more subtle interplay between parameterization and knot placement than those obtained with shared embeddings and internal cross-attention. This module can be viewed as the final fine-tuning of the generative model.

4.2 Learning point embeddings
The shared autoencoder model has three components, an encoder and two decoders, as shown in Fig. 3. The encoder takes as input the data points with their coordinates as 3-channel features for each point. These data points are not passed to the encoder directly but go through an intermediate step consisting of a positional encoding (on coordinates) function [56] and a linear projection, as follows:
where is a learnable matrix, with and for all cases in this work.

The above preliminary embeddings are then passed to a transformer encoder E, followed by a linear layer, to obtain the final point embeddings :
where denote trainable parameters of the transformer encoder. Note that our transformer is not equipped with a position encoding, since input points are unorganized and the point embeddings should be permutation invariant.
To train and obtain embeddings meaningful for parameterization and knot placement, an encoder-decoder scheme is used, with two transformer decoders: one for recovering knots from , and the other for recovering parameters from . Fig. 3 shows the network. The specific procedures of training follow the autoregressive scheme [1]. Specifically, assume that the two decoders have already generated knots and parameters, denoted by and , they will predict the next knot and parameter from the same point embeddings using:
(5) | ||||
where is the network parameters of its argument, <SOS>
is the starting token, and is the next predicted knot and parameter, respectively.
Instead of directly passing to the decoder, an additional masking mechanism is used to force each data point to attend more to its neighborhood regardless of how points are organized. Specifically, we randomly mask some embeddings to simulate point embedding corruption and ask the remaining point embeddings to yield the same results as before (except for the masked embeddings’ corresponding parameters). As such, each point embedding carries its neighborhood’s information.
The whole encoder-decoder pipeline is trained using the weighted sum of two losses, and , which are the mean squared losses between ground truth( and ) and predicted sequence( and ), respectively.
4.3 Generating knots and parameters
From point embeddings, SplineGen decodes them into knots and parameters, again in an autoregressive way. Two problems need particular attention: how to ensure that the number of generated parameters and their ordering are in line with the input data points; and how to align parameterization and knot placement. This work solves these problems with several extensions to the transformer decoder. In a nutshell, the proposed decoder fuses two sub-decoders through a module called internal cross-attention (Fig. 4); one of the sub-decoders is a vanilla transformer decoder, and the other is a modified version with an additional self-organization module.

Knot sub-decoder. SplineGen uses the same transformer decoder as the one used in Sec. 4.2. It generates knots autoregressively, starting from the <SOS>
token, predicting the next knot, and stopping at the <EOS>
token. The number of knots is determined by the network automatically.
To facilitate the training of this sub-decoder, we slightly modify the representation of knots. They are first sorted in non-decreasing order, then prefixed with the start token <SOS>
and suffixed with the stopping token <EOS>
. After inserting these special tokens, the knot sequence is of length . Rather than using a real value for the knots, we add another two dimensions to indicate the probability of being <SOS>
and <EOS>
token, respectively.
Given all the point embeddings of given data points and the previously output knots at step , the goal is to model the next output knot token, denoted by . The input to the transformer decoder is derived from each of the tokens in by adding positional encoding followed by a linear project, and then the transformer decoder followed by another linear projection takes this input to predicts the next token. The model is trained to minimize the mean squared loss between predicted knots and the ground truth.
Parameters sub-decoder. For the parameter sub-decoder, the primary task is to make the output parameters’ ordering in line with the input data points. To do so, a parameter-point associative decoder is designed out of the transformer decoder used in Sec. 4.2. It adds an index prediction module so that the decoder can output not only the parameter values but also the positional indices of their corresponding points in the input. Specifically, the decoder takes the learned point embeddings as input into its cross-attention part and autoregressively outputs parameter values and indices. Let the decoder be denoted by and its output embeddings be , we let each autoregressively generated embedding to learn a probability distribution over the indices of the point encodings so that the one with the largest probability will correspond to the generated parameter in this iteration.
A common way to define is expressing it in terms of a dot product operation between and encoded points , followed by a normalization operation with softmax, as follows [57]:
(6) |
where and are learnable matrices. The encoded points are simply latent codes of the input data points, and they are generated by a transformer encoder. The purpose of using instead of the input data points is to add more trainable parameters.
Combining the trainable decoder and Eq. (6) , the index prediction module essentially learns the following distribution:
(7) |
where denotes the already predicted indices until step and is the decoder’s parameters.
To avoid some indices being repeatedly predicted, we mask the corresponding entry in the dot product operation every time a new index is reached. This also guarantees that all elements in will be visited because the prediction step is executed exactly times.
To generate the intended parameter values, each embedding after the translation is passed to a 2-layer MLP to decode it into a parameter value. Combined with the previously generated index, we can obtain a parameter value, and meanwhile know its position in the final parameter array altogether. It should be noted that, to ensure the decoder generates as many parameters as the input data points, the generation process will be interrupted once enough parameters are output. This is different from the generation process for knots.
Internal cross-attention. Cross-attention has proven effective in model associativity between multimodal data [58]. This inspires us to add an attention-based module to fuse the decoders described above and then align the knot generation and parameter generation processes. Different from most existing cross-attention models, which operate on an attention module’s outputs (e.g., [4]), the internal cross-attention module here directly operates on its internal key/value/query matrices. This internal way of working can model the interplay between knots and parameters more conveniently.
The design of the internal cross-attention module is illustrated in Fig. 4. It activates only after the knots have all been generated. Upon reaching the final generation step of the knot sub-decoder ( with a token length denoted as ), both the key vectors and the value vectors have been generated in the self-attention module. These vectors are subsequently utilized in the upcoming internal cross-attention step. Consider the parameter generation at the time step . At the level of the parameter sub-decoder, the output of decoder layer is transformed into query vectors via a multiplication operation with a learnable matrix . Employing these prepared keys, values, and queries within the cross-attention framework, an output vector is computed. This output is then combined with the preceding to yield a refined representation . The network module that follows uses this refined representation as its input instead of the original .
Masking. Lastly, the two decoders are further equipped with a masking mechanism to simulate data point removal/addition. Different from the masking mechanism used in Sec. 4.2, here we randomly remove a small proportion of points from the input data while keeping the generated knots and parameters for the remaining data points unchanged. This method enforces a robust generation of knots and parameters when some data points are missing or added, thereby giving a robust approximation of the same curve.
4.4 PINN-based fine alignment
To directly use Eq. (4) to guide the alignment of knot and parameter generation, a PINN layer is further added to SplineGen when training it. This layer accepts the outputs from both the knot and parameter sub-decoders and computes a series of control points. The layer first calculates B-spline basis functions with an adapted version from the NURBS-Diff method presented in [55], then solves Eq. (4), resulting in a set of control points , which define the intended curve . Utilizing the generated curve , the parameters , and the corresponding 3D points , we evaluate the approximation error through the following loss function:
(8) |
where the maximum loss is employed instead of the mean loss to ensure that all predicted points consistently stay close to their target positions.
It should be noted that training a network with PINN layers is not easy. The derivatives of the PINN loss w.r.t the PINN input (i.e., parameters and knots in our case) need to be explicitly given to the network. The NURBS-Diff method [55] has provided a detailed derivation of those derivatives. We omit the details in this work.
5 Results
5.1 Setup
Dataset. A dataset of 500,000 B-spline curves with their control points, knot vectors, and sampled points has been compiled. Self-intersecting curves were eliminated using a specialized detection program. For data processing, we normalize control points to and utilize masked arrays for neural network training consistency, refer to Supplementary Material for more details. A test dataset of above 5,000 curves is generated in the same way. We will make these datasets publically available upon publication of this paper.
Training. SplineGen has been implemented using PyTorch. We trained it on an NVIDIA RTX 3090 GPU and with the Adam solver, having a batch size 256 for 500 epochs and a fixed learning rate =. The dataset is split into 8:2 for training and validation.
5.2 Evaluation Metrics
Given the input data points and the reconstructed curve and predicted parameters for , we evaluate the performance of SplineGen with the following three most commonly used metrics.
Maxium of Euclidian distances. We first evaluate the points in according to and compute the Euclidian distances of corresponding points. We use the max of these distances as our metrics, which is the same as Eq. (8) to measure the maximum approximation distance:
MSE of Euclidian distances. In addition, we also evaluate the mean square of these distances:
Hausdorff distances. We also evaluate the Hausdorff distance between point set and , which measures the greatest distance between any point in one set to its closest point in the other:



5.3 Examples
Some sampling results of using SplineGen to approximate data points are given in Figs. 5 and 6, with increasing shape complexity from top to bottom. To further show the capability of SplineGen, Fig. 7 gives some approximation examples of very complex shapes. As can be seen from the figure, although these shapes are not practical and have unreasonably complex shapes, our SplineGen can still generate quality results.
5.4 Ablation Studies
An ablation study has been conducted on SplineGen’s major modules, including the internal cross-attention module, the shared encoder module, and the masking module. Its setup is as follows:
-
(a)
All: The proposed SplineGen network, with all modules included.
-
(b)
w.o. Cross attention: The internal cross-attention module is removed when training the parameter decoder, which means the parameter decoder is not informed with the knots information.
-
(c)
w.o. Shared encoder: The shared point encoder module is replaced with a simple linear layer to encode the points.
-
(d)
w.o. Masking: The masking module is removed when training the decoders.
The ablation study results are shown in Table 1. They show that SplineGen, only when all modules are included, can give the best performance. This confirms the effectiveness of the pipeline outlined in Fig. 2. Also, as each optionally removed module is related directly to the functions of parameter-knot alignment and robustness, the ablation study results validate SplineGen’s features claimed in Sec. 1. Note that the features of size-independent and point permutation invariant are automatically ensured by the generative nature of SplineGen.
Model | Param loss | Ordering loss |
All | 8.14e-3 | 3.18e-2 |
w.o. Cross- attention | 1.54e-2 | 3.38e-2 |
w.o. Shared encoder | 9.90e-3 | 3.58e-2 |
w.o. Masking | 8.68e-3 | 3.83e-2 |
Model | Max Error | MSE | Hausdoff |
SplineGen | 8.66e-3 | 2.81e-3 | 8.51e-3 |
Jüttler [17] | 7.71e-2 | 2.48e-2 | 5.54e-2 |
PARNET [24] | 1.01e-1 | 2.24e-2 | 5.84e-2 |
Centripetal+DOM | 1.55e-1 | 8.04e-3 | 4.50e-2 |
Chord+DOM | 1.65e-1 | 1.01e-2 | 4.48e-2 |
Centripetal+Uniform | 6.01e-1 | 3.91e-2 | 1.44e-1 |
Chord+Uniform | 6.04e-1 | 4.11e-2 | 1.47e-1 |
Centripetal+KTP | 1.61e-1 | 1.21e-2 | 5.07e-2 |
Chord+KTP | 1.70e-1 | 1.04e-2 | 4.50e-2 |
Centripetal+NKTP | 1.57e-1 | 1.08e-2 | 4.71e-2 |
Chord+NKTP | 1.67e-1 | 9.06e-3 | 4.66e-2 |
Model | Curve 1 | Curve 2 | Curve 3 | Curve 4 | ||||||||
Max | Mse | Hsdff | Max | Mse | Hsdff | Max | Mse | Hsdff | Max | Mse | Hsdff | |
SplineGen | 1.2e-2 | 2.7e-3 | 1.2e-2 | 1.1e-2 | 4.9e-3 | 1.1e-2 | 9.1e-3 | 3.3e-3 | 7.7e-3 | 1.0e-2 | 4.7e-3 | 1.0e-2 |
Jüttler [17] | 4.7e-1 | 2.9e-1 | 8.4e-2 | 4.2e-1 | 2.2e-1 | 8.4e-2 | 3.8e-1 | 1.2e-1 | 8.0e-2 | 3.6e-1 | 2.0e-1 | 6.9e-2 |
PARNET [24] | 3.6e-2 | 1.2e-2 | 3.6e-2 | 6.5e-2 | 1.9e-2 | 4.5e-2 | 8.8e-2 | 1.7e-2 | 8.8e-2 | 4.9e-1 | 3.4e-2 | 2.0e-1 |
Centri + DOM | 2.8e-2 | 8.9e-3 | 2.8e-2 | 5.0e-2 | 1.3e-2 | 5.0e-2 | 2.3e-2 | 5.2e-3 | 2.3e-2 | 5.1e-1 | 2.2e-2 | 2.0e-1 |
Chord + DOM | 6.5e-1 | 2.6e-2 | 7.4e-2 | 4.7e-2 | 1.2e-2 | 4.7e-2 | 6.7e-1 | 3.0e-2 | 1.1e-1 | 2.6e-2 | 8.9e-3 | 2.6e-2 |
Centri + Uniform | 3.3e-2 | 7.9e-3 | 3.3e-2 | 3.1e-2 | 8.8e-3 | 3.1e-2 | 9.3e-3 | 3.2e-3 | 9.3e-3 | 5.1e-1 | 1.8e-2 | 2.0e-1 |
Chord + Uniform | 6.5e-1 | 2.6e-2 | 7.4e-2 | 3.3e-2 | 8.2e-3 | 3.3e-2 | 6.7e-1 | 2.7e-2 | 1.1e-1 | 1.9e-2 | 5.1e-3 | 1.9e-2 |
Centri + KTP | 3.6e-2 | 1.3e-2 | 3.6e-2 | 5.2e-2 | 1.5e-2 | 5.2e-2 | 2.8e-2 | 6.7e-3 | 2.8e-2 | 5.1e-1 | 2.2e-2 | 2.0e-1 |
Chord + KTP | 6.5e-1 | 3.1e-2 | 7.7e-2 | 5.4e-2 | 1.4e-2 | 5.4e-2 | 6.7e-1 | 2.7e-2 | 1.0e-1 | 3.3e-2 | 1.0e-2 | 3.3e-2 |
Centri + NKTP | 3.0e-2 | 1.0e-2 | 3.0e-2 | 4.7e-2 | 1.3e-2 | 4.7e-2 | 2.4e-2 | 6.9e-3 | 2.4e-2 | 5.1e-1 | 2.2e-2 | 2.0e-1 |
Chord + NKTP | 6.5e-1 | 2.8e-2 | 7.4e-2 | 4.5e-2 | 1.2e-2 | 4.5e-2 | 6.7e-1 | 2.7e-2 | 1.1e-1 | 2.3e-2 | 9.6e-3 | 2.3e-2 |
5.5 Comparisons
Table LABEL:tab:qualitative_comparison shows a qualitative comparison between SplineGen with existing learning-based methods (i.e., Jüttler [17] and PARNET [24]). SplineGen is the only method that can generate parameters and knots with unordered and non-fixed-size inputs. Table 2 presents a quantitative comparison of SplineGen with existing methods. Considering that all those existing methods require ordered data points as input, we have pre-sorted the input accordingly to make the comparison fair. Besides learning-based methods, we also compared with various classical parametrization and knot placement methods. Specifically, the chord-length and centripetal methods have been chosen for parametrization; NKTP [22], KTP [16], DOM [44] and uniform knots [16] have been chosen for knot placement. All of their combinations have been analyzed, as shown in Table 2.
The results indicate that SplineGen outperforms other methods in terms of maximum error (Max), mean squared error (Mse), and Hausdorff error (Hsdff). Table 3 further provides statistics of comparing SplineGen with existing methods on four curves chosen from the examples in Fig. 5. Fig. 8 shows the resulting approximate B-spline curves from these methods. SplineGen is seen to give competitive results in terms of both accuracy and generality. Only in the Mse error of Curve 3, SplineGen is less accurate than the method using the centripetal method for parametrization and the uniform method for knot placement. However, the result of SplineGen is very close to the best result, with only a 1e-4 difference.

5.6 Discussion and limitations
From the comparisons shown in Figs. 5-8, and Tables 2 and 3, SplineGen can consistently give competitive approximation results, with lower error and better robustness. Large improvements have been confirmed for classic parametrization and knot placement methods (except for one case), see Fig. 8. Even for the state-of-the-art learning-based method, the proposed method is still able to reduce the maximum error by a notable percentage, above 88%, depending on the specific data points being considered.
Numerical issues in solving Eq. (4) have also been observed. An in-depth analysis showed that the reason lies in the distribution of the parameters generated by SplineGen. It has been known that it is better to have parameters filled in every knot span, and empty knot spans will result in a poorly conditioned coefficient matrix [59]. To completely solve this issue, a network that can evenly distribute parameters over knot spans is needed. Such a network remains unknown, and further development is required.
6 Conclusion
A generative model called SplineGen has been presented to solve the traditional parameterization and knot placement problems in B-spline approximation. The main features of this model include input data point size-independent, point permutation invariant, aligned knots and parameters, and robustness, cumulatively giving a highly accurate parameterization and knot placement method. These features are essentially attained by casting the parameterization and knot placement problems as a sequence-to-sequence translation problem, together with several extensions to the existing transformer network to account for the special needs of parameterization and knot placement. A notable improvement over existing methods has been demonstrated in various experiments.
It should, however, be noted that SplineGen only represents a first step towards generative spline modeling, and much more work remains to be done. Most notably, extending SplineGen to the problem of surface fitting of unorganized points is among the most important improvement directions. Our preliminary results show that the primary challenge in this extension is to handle scattered data points assuming no tensor product grids or rectangular topology (i.e., the underlying surfaces are trimmed splines). There is no obvious solution to this challenge, and this seems to be the main reason why there is no successful application of learning-based methods to surface fitting.
For the current SplineGen, there is still room for improvement. During the implementation, it was found that a small error in the parameter-point associative module could yield a large error in the final results. This is mainly because SplineGen uses a global way to generate the associativity. This will have issues when the number of input data points is large. For such cases, a parameter-point associative network that can attention to local neighborhoods is preferred. Then those local associativity can be assembled to attain the overall associativity. Developing such a network module is practically beneficial. Another interesting improvement lies in controlling the distribution of generated parameters. It is known that good parameterization distributes parameters evenly in individual knot spans; otherwise, numerical issues would happen when solving Eq. (4). Incorporating this knowledge into SplineGen is among the research studies to be carried out in the future.
Acknowledgements
This work has been funded by NSF of China (No. 62102355), the “Pioneer” and “Leading Goose” R&D Program of Zhejiang Province (No. 2024C01103), NSF of Zhejiang Province (No. LQ22F020012), and the Fundamental Research Funds for the Zhejiang Provincial Universities (No. 2023QZJH32).
References
References
- [1] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, I. Polosukhin, Attention is all you need, in: Advances in neural information processing systems, Vol. 30, 2017.
- [2] Y. Siddiqui, A. Alliegro, A. Artemov, T. Tommasi, D. Sirigatti, V. Rosov, A. Dai, M. Nießner, MeshGPT: Generating triangle meshes with decoder-only transformers, arXiv preprint arXiv:2311.15475.
- [3] P. K. Jayaraman, J. G. Lambourne, N. Desai, K. Willis, A. Sanghi, N. J. W. Morris, SolidGen: An autoregressive model for direct B-rep synthesis, in: Transactions on Machine Learning Research, 2023.
- [4] H. Guo, S. Liu, H. Pan, Y. Liu, X. Tong, B. Guo, ComplexGen: CAD reconstruction by B-rep chain complex generation, ACM Transactions on Graphics 41 (4) (2022) 1–18.
- [5] C. De Boor, On calculating with b-splines, Journal of Approximation theory 6 (1) (1972) 50–62.
- [6] I. Stroud, H. Nagy, Solid modelling and CAD systems: how to survive a CAD system, Springer Science & Business Media, 2011.
- [7] Q. Zou, H.-Y. Feng, S. Gao, Variational direct modeling: A framework towards integration of parametric modeling and direct modeling in cad, Computer-Aided Design 157 (2023) 103465.
- [8] S. Liu, T. Liu, Q. Zou, W. Wang, E. L. Doubrovski, C. C. Wang, Memory-efficient modeling and slicing of large-scale adaptive lattice structures, Journal of Computing and Information Science in Engineering 21 (6) (2021) 061003.
- [9] Q. Zou, H.-Y. Feng, Push-pull direct modeling of solid CAD models, Advances in Engineering Software 127 (2019) 59–69.
- [10] H. Wang, Q. Zou, H. Lin, A quasi-optimal shape design method for electromagnetic scatterers based on nurbs surfaces and filter-enhanced gwo, IEEE Transactions on Antennas and Propagation.
- [11] Q. Zou, Length-optimal tool path planning for freeform surfaces with preferred feed directions based on Poisson formulation, Computer-Aided Design 139 (2021) 103072.
- [12] Q. Zou, J. Zhang, B. Deng, J. Zhao, Iso-level tool path planning for free-form surfaces, Computer-Aided Design 53 (2014) 117–125.
- [13] M. Li, C. Lin, W. Chen, Y. Liu, S. Gao, Q. Zou, Xvoxel-based parametric design optimization of feature models, Computer-Aided Design 160 (2023) 103528.
- [14] Q. Zou, Y. Gao, G. Luo, S. Chen, Meta-meshing and triangulating lattice structures at a large scale, Computer-Aided Design (2024) 103732.
- [15] C. Su, X. Jiang, G. Huo, Q. Zou, Z. Zheng, H.-Y. Feng, Accurate model construction of deformed aero-engine blades for remanufacturing, The International Journal of Advanced Manufacturing Technology 106 (2020) 3239–3251.
- [16] L. Piegl, W. Tiller, The NURBS Book, 2nd Edition, Springer-Verlag, New York, NY, USA, 1996.
- [17] F. Scholz, B. Jüttler, Parameterization for polynomial curve approximation via residual deep neural networks, Computer Aided Geometric Design 85 (2021) 101977.
- [18] J.-J. Fang, C.-L. Hung, An improved parameterization method for B-spline curve and surface interpolation, Computer-Aided Design 45 (6) (2013) 1005–1028.
- [19] E. T. Lee, Choosing nodes in parametric curve interpolation, Computer-Aided Design 21 (6) (1989) 363–370.
- [20] T. A. Foley, G. M. Nielson, Knot selection for parametric spline interpolation, in: Mathematical methods in computer aided geometric design, Elsevier, 1989, pp. 261–CP4.
- [21] C. Balta, S. Öztürk, M. Kuncan, I. Kandilli, Dynamic centripetal parameterization method for B-spline curve interpolation, IEEE Access 8 (2019) 589–598.
- [22] L. A. Piegl, W. Tiller, Surface approximation to scanned data, The Visual Computer 16 (2000) 386–395.
- [23] Z. Yong, H. Kang, Z. Yang, Y. Gu, The unimodality of initial B-spline approximations in spline fitting, Communications in Mathematics and Statistics 10 (2) (2022) 331–352.
- [24] P. Laube, M. Franz, G. Umlauf, Deep learning parametrization for B-spline curve approximation, in: 2018 International Conference on 3D Vision, 2018, pp. 691–699.
- [25] Q. Zou, H.-Y. Feng, A robust direct modeling method for quadric b-rep models based on geometry–topology inconsistency tracking, Engineering with Computers 38 (4) (2022) 3815–3830.
- [26] Y. Zhao, Q. Zou, G. Luo, J. Wu, S. Chen, D. Gao, M. Xuan, F. Wang, Tpms2step: error-controlled and c2 continuity-preserving translation of tpms models to step files based on constrained-pia, Computer-Aided Design (2024) 103726.
- [27] Q. Zou, H.-Y. Feng, A decision-support method for information inconsistency resolution in direct modeling of cad models, Advanced Engineering Informatics 44 (2020) 101087.
- [28] Z. Wang, S. Liu, L. Liu, Q. Zou, X.-M. Fu, Computing smooth preferred feed direction fields with high material removal rates for efficient cnc tool paths, Computer-Aided Design 164 (2023) 103591.
- [29] Q. Zou, H.-Y. Feng, Variational b-rep model analysis for direct modeling using geometric perturbation, Journal of Computational Design and Engineering 6 (4) (2019) 606–616.
- [30] G. Luo, Q. Zou, A simple point-based iso-scallop tool path planning method for noisy point clouds with high robustness and controlled errors, Computer-Aided Design 163 (2023) 103560.
- [31] Q. Zou, J. Zhao, Iso-parametric tool-path planning for point clouds, Computer-Aided Design 45 (11) (2013) 1459–1468.
- [32] J. Ding, Q. Zou, S. Qu, P. Bartolo, X. Song, C. C. Wang, Stl-free design and manufacturing paradigm for high-precision powder bed fusion, CIRP Annals 70 (1) (2021) 167–170.
- [33] Q. Zou, Robust and efficient tool path generation for machining low-quality triangular mesh surfaces, International Journal of Production Research 59 (24) (2021) 7457–7467.
- [34] C.-G. Lim, A universal parametrization in B-spline curve and surface interpolation, Computer Aided Geometric Design 16 (5) (1999) 407–422.
- [35] J. Gao, C. Tang, V. Ganapathi-Subramanian, J. Huang, H. Su, L. J. Guibas, DeepSpline: Data-driven reconstruction of parametric curves and surfaces, arXiv preprint arXiv:1901.03781.
- [36] A. Iglesias, A. Gálvez, M. Collantes, Bat algorithm for curve parameterization in data fitting with polynomial Bézier curves, in: 2015 International Conference on Cyberworlds (CW), 2015, pp. 107–114.
- [37] A. Iglesias, A. Gálvez, M. Collantes, Four adaptive memetic bat algorithm schemes for Bézier curve parameterization, Transactions on Computational Science XXVIII: Special Issue on Cyberworlds and Cybersecurity (2016) 127–145.
- [38] T. Speer, M. Kuppe, J. Hoschek, Global reparametrization for curve approximation, Computer Aided Geometric Design 15 (9) (1998) 869–877.
- [39] W. Wang, H. Pottmann, Y. Liu, Fitting B-spline curves to point clouds by curvature-based squared distance minimization, ACM Transactions on Graphics 25 (2) (2006) 214–238.
- [40] J. Yang, D. Wang, H. Hong, Improving angular speed uniformity by reparameterization, Computer Aided Geometric Design 30 (7) (2013) 636–652.
- [41] J. Luo, H. Kang, Z. Yang, Knot calculation for spline fitting based on the unimodality property, Computer Aided Geometric Design 73 (2019) 54–69.
- [42] D. Michel, A. Zidna, A new deterministic heuristic knots placement for B-spline approximation, Mathematics and Computers in Simulation 186 (2021) 91–102.
- [43] W. Li, S. Xu, G. Zhao, L. P. Goh, Adaptive knot placement in B-spline curve approximation, Computer-Aided Design 37 (8) (2005) 791–797.
- [44] H. Park, J.-H. Lee, B-spline curve fitting based on adaptive curve refinement using dominant points, Computer-Aided Design 39 (6) (2007) 439–451.
- [45] H. Kang, F. Chen, Y. Li, J. Deng, Z. Yang, Knot calculation for spline fitting via sparse optimization, Computer-Aided Design 58 (2015) 179–188.
- [46] F. Yoshimoto, T. Harada, Y. Yoshimoto, Data fitting with a spline using a real-coded genetic algorithm, Computer-Aided Design 35 (8) (2003) 751–760.
- [47] J. Luo, H. Kang, Z. Yang, Knot placement for B-spline curve approximation via l, 1-norm and differential evolution algorithm, Journal of Computational Mathematics 40 (4) (2022) 589.
- [48] Z. Wen, J. Luo, H. Kang, The deep neural network solver for B-spline approximation, Computer-Aided Design 169 (2024) 103668.
- [49] P. Laube, M. O. Franz, G. Umlauf, Learnt knot placement in B-spline curve approximation using support vector machines, Computer Aided Geometric Design 62 (2018) 104–116.
- [50] Z. Shi, S. Peng, Y. Xu, A. Geiger, Y. Liao, Y. Shen, Deep generative models on 3D representations: A survey, arXiv preprint arXiv:2210.15663.
- [51] K. Schwarz, A. Sauer, M. Niemeyer, Y. Liao, A. Geiger, VoxGRAF: Fast 3D-aware image synthesis with sparse voxel grids, Advances in Neural Information Processing Systems 35 (2022) 33999–34011.
- [52] X. Zeng, A. Vahdat, F. Williams, Z. Gojcic, O. Litany, S. Fidler, K. Kreis, LION: Latent point diffusion models for 3D shape generation, in: Advances in Neural Information Processing Systems, Vol. 35, Curran Associates, Inc., 2022, pp. 10021–10039.
- [53] J. Gao, T. Shen, Z. Wang, W. Chen, K. Yin, D. Li, O. Litany, Z. Gojcic, S. Fidler, GET3D: A generative model of high quality 3D textured shapes learned from images, Advances In Neural Information Processing Systems 35 (2022) 31841–31854.
- [54] Y.-C. Cheng, H.-Y. Lee, S. Tulyakov, A. G. Schwing, L.-Y. Gui, SDFusion: Multimodal 3D shape completion, reconstruction, and generation, in: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023, pp. 4456–4465.
- [55] A. D. Prasad, A. Balu, H. Shah, S. Sarkar, C. Hegde, A. Krishnamurthy, NURBS-diff: A differentiable programming module for NURBS, Computer-Aided Design 146 (2022) 103199.
- [56] Z. Wang, S. Wu, W. Xie, M. Chen, V. A. Prisacariu, NeRF–: Neural radiance fields without known camera parameters, arxiv preprint arXiv:2102.07064.
- [57] O. Vinyals, M. Fortunato, N. Jaitly, Pointer networks, Advances in Neural Information Processing Systems 28.
- [58] C.-F. R. Chen, Q. Fan, R. Panda, CrossViT: Cross-attention multi-scale vision transformer for image classification, in: Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 357–366.
- [59] G. E. Farin, Curves and surfaces for CAGD: a practical guide, Morgan Kaufmann, 2002.