# Gap-free solution in Shape Maker.

Updated: Dec 1, 2019

Very often, gaps are detected in preliminary models of hull surfaces for smoothing. Perhaps this is due to the improper use of programs for modeling or because of the shortcomings of these programs.

In this article, I would like to talk about those features of the Shape Maker mathematical model that avoid the gaps between surface patches.

I think that anyone who has at least once modeled hull surfaces has repeatedly encountered this problem when gaps are detected between the surface patches in the model. Typically, this problem occurs when transferring a surface from one system to another. Accurate representations of surface boundaries differ in different systems and often do not coincide. In many ship surface smoothing programs that are currently used in shipbuilding, the common boundary line of two adjacent surfaces is not mathematically identical with these surfaces. The boundaries of each of the surfaces are presented as an approximation of the general boundary curve. This approach has both positive and negative properties. The biggest problem is that the approximation always has a certain accuracy. In other words, there is always a gap between two adjacent patches of the hull surface. When transferring a surface to hull structure modeling systems, the accuracy of the approximation may be insufficient. This may be the cause of problems encountered in modeling hull structural parts and shell plates.

In the article __“NURBS - Nobody Understands Rational B-Splines”__ I already talked about the main properties of this type of curves. The most important mathematical property used in the Shape Maker model of the surface is that we can mathematically accurately represent part of the curve or the entire curve as a new curve and use it as the boundary of the surface. This allows you to create mathematically accurate boundaries of surfaces that do not have gaps on the common border of two adjacent surfaces. The topological surface model in Shape Maker is briefly described here - __“Topological elements in the Shape Maker”__.

A mathematically accurate description of the surface boundaries avoids gaps between surface patches, but at the same time imposes restrictions on the number of control points of the boundary curves. In Shape Maker, the number of points of a control surface polygon cannot be set by the user but is determined by the number of points on the boundary curves. I note that there are no special restrictions on the number of control points in Shape Maker but adhering to certain rules can significantly reduce the number of surface control points and simplify the work of surface modifying.

Since surface patch in Shape Maker rely on boundary curves, surface boundaries must be mathematically identical to the curves on which they rely. At the same time, on the opposite boundary curves of the surface there can be a different number of control points and, accordingly, knots. For this, the knots surface vector is represented as a superposition of the vectors of boundary curves. In another words, knots of the opposite curve are added to the knots vector of first one. Adding a knot without changing the shape of the curve is another important property of this type of curve. If the value of the knot on the source curve coincides with the knot on the opposite curve, you do not need to add such a knot. Each knot on the surface adds an additional row of control points. In a situation where none of the nodes matches, the number of control points on the surface will be equal to the sum of the control points on the boundary curves. This can significantly increase the complexity of the modification of such a surface.

Another problem may arise if the distance between the surface knots is uneven. This leads to an uneven area of influence of control points on the surface shape and difficulties in editing the shape.

The above problems can be easily avoided if, when defining the boundary lines, combinations of the numbers of control points are used, at which an odd number of knots with a uniform distribution of the parameter will be added on the surface. The set of magic numbers of control points is a series: 4 5 7 11 19 35 67... and the corresponding number of knots intervals will be 1 2 4 8 16 32 64 .... Accordingly, the knots on the opposite boundary curves will either coincide or be located along mid-spacing between adjacent knots. If you use the numbers of this series to set the boundary lines, the resulting surface will always have a uniform distribution of the parameter. In this case, the number of surface points will coincide with the maximum number of points on the boundary curve. This circumstance allows you to set a different number of points on adjacent surfaces. For example, a stem line may have 35 control points. The line of the bilge radius only 5 points and the resulting number of points on the nose surface will be 35. The aft surface mating to the bilge radius may have, for example, 19 points, if 19 control points are specified on the transom line. It is worth noting that observance of magic numbers is not really a big restriction in the system and is important only for complex curved surfaces.

If the surface is flat or cylindrical, then the number of points can be any. If one of the surface boundaries is built on part of the line, it is recommended to bring the hinged point strictly to the curve knot and calculate the number of control points on the opposite boundary based on the number of knots on the part of the curve. It will also give a uniform distribution of knots on the surface.