# Lines and surfaces curvature.

For a long time, when in shipbuilding just started using CAD systems, I had one customer, to whom I smoothed the surface of the ship's hull. It was new customer and I smoothed the hull surface for him for the first time. In those days, we could only communicate by phone and email. As usual, I tried to do my job as best I could. When it was all over, I sent to him the lines drawing and body lines in DXF file format. Suddenly, I received many comments about poorly smoothed areas of the hull. I looked all over again and made the lines even smoother, but the answer was the same. This went on for quite a long time, until the customer printed out the lines on a plotter on a large scale. On paper, everything was fine. It turned out that my DXF was checked on a computer in AutoCAD. To optimize polyline output, AutoCAD reduces the number of output points of a curve. In this case, the lines look faceted. To display the curve exactly, it was necessary to use the command "REGEN". My customer did not know about it. This was the first time that an incorrect method was used to control the shape of the curves.

A few years later, one of my customers decided to use Rhinoceros to test the lines smoothness of a lines drawing. By loading my DXF and converting all the curves into b-splines, he explored the curvature and found waviness on some lines. I was very surprised, because in ShapeMaker there is the possibility of displaying lines of inflections on surfaces and all unwanted inflections are removed at the initial stage of smoothing the surface. Just as in the first case, I suggested to plot the drawing and checking the smoothness by eye. In the case when a plot converted to splines was displayed on the plotter, a slight waviness was noticeable. The original drawing of these excesses was not. What is the problem? When I smooth the hull in ShapeMaker, I work directly with the surface. In this case, the sections and graphs of their curvature are calculated as the characteristics of a surface point. When transferring surface sections to a DXF file, ShapeMaker calculates the intersection line as a large set of points, which is then interpolated by a set of arcs and lines with a given accuracy. If you interpolate a DXF polyline with a b-spline curve, the result may differ from the polyline and, especially, from the sections of the original surface.

Why is this happening? In mathematics, there are two methods for constructing a b-spline curve passing through a set of points — approximation and interpolation. The difference in these methods is only in the fact that during approximation the curve passes at the minimum distance from the points, and during interpolation the b-spline curve passes through each point. Any of the smoothing algorithms for a set of points is either a pure approximation or interpolation or a combination of these two methods. The task of most of these algorithms is to minimize the deviation from the original points, and the smoothness of the curve in this case is not critical. Therefore, visually, the curve can look quite good, but if you examine the curvature of such a b-spline curve, you can see sharp jumps in curvature. The curvature is more sensitive to a change in the shape of the curve. A minimum, within a fraction of a millimeter, change in the position of the b-spline control point is enough to cause a sharp change in the shape of the curvature graph. This is especially noticeable if the nodes of the b-spline curve are unevenly arranged. In the case when the distance between the nodes is small, the minimum deviation of the node from the original curve is enough to get a jump in curvature in this area. In this case, it will be visually almost no noticeable to the eye. So, in this case, the study of curvature will not give enough objective information about the shape of the surface section.

I have made some test in ShapeMaker. First picture show section curvature directly from surface. Second one show curvature from line projected to surface in same place as first one.

In general it is quite close to original curvature, but in some places line curvature has more sharp peaks. Curvature of projected line depends very much from interpolation precision. In our case precision was 1 E-9 mm.

Most CAD systems use surface to import the hull surface. The surface is mathematically transmitted. Any CAD tool allows you to build a section of the surface. But, in this case, too, you must be careful. If the result of the construction of the cross section is a b-spline curve, then a situation arises equivalent to that described above. The curvature of this spline will be calculated based on the geometry of the curve, and not the geometry of the surface. In any case, the result will not always correspond to reality, especially in the b-spline nodes, which are close to each other.