Sometimes splines are useful in boat building. Physical splines or  more often used today  mathematical splines.
A few years ago I wrote a VBA Excel folder with (natural) cubic splines. Input consists of a set of xycoordinates (e.g. half breadth of a waterline) output is graphically displayed and will give you for any xvalue in the given interval the corresponding yvalue.
("howtouse" included)
(I just find out, that it seems not possible to upload a ".xlsm" folder. I will try to pack it. Edit: a .zip file is also not possible. If anyone is interested I would email it.)
Spline (mathematical)

 AYRS Chairman
 Posts: 104
 Joined: Tue Nov 08, 2016 6:39 pm
Re: Spline (mathematical)
Hi Helmfried  Sorry I cant immediately advise on uploading files to this forum  I am not the one running the website.
You could email me your VBA file to j_perry AT btinternet DOT com, although I am not familiar with VBA files. Maybe this is something we could include in Catalyst?
I havn't done any programming for several years, other than just a few simple bits of Python code to program Arduino and similar microprocessor boards, so I am a bit rusty with this kind of thing. However I have looked back over some old files to find out how I used to implement cubic splines in software. I found the attached Pascal file from something I was doing in the '80s, although I think I would have later done much the same thing with object orientated C++.
I guess your VBA will have some similarity to the attached code?
Sorry the attached listing has no useful comment statements  only too common with my amateur programming efforts! But I think the important part is in the procedures SPLINE and CURVE. Taking CURVE first, arrays x[] and y[] define a series of points and it is required to fill the gap between each pair of points with a smooth curve. So, for each segment between two points CURVE calculates coefficients represented by arrays a[] and b[] and passes these coefficients to the SPLINE procedure which uses these coefficients to draw a series of short lines following the required smooth curve. The number of short lines used to fill in the curve is 'nsteps', so by making nsteps reasonably large a close approximation to a smooth curve is achieved. The actual drawing on the computer screen, printer or whatever is done by 'movto' and 'linto' which are procedures elsewhere in the software. OCURVE is similar to CURVE, but for a closed curve  i.e. the end of the curve joins smoothly with the beginning.
You could email me your VBA file to j_perry AT btinternet DOT com, although I am not familiar with VBA files. Maybe this is something we could include in Catalyst?
I havn't done any programming for several years, other than just a few simple bits of Python code to program Arduino and similar microprocessor boards, so I am a bit rusty with this kind of thing. However I have looked back over some old files to find out how I used to implement cubic splines in software. I found the attached Pascal file from something I was doing in the '80s, although I think I would have later done much the same thing with object orientated C++.
I guess your VBA will have some similarity to the attached code?
Sorry the attached listing has no useful comment statements  only too common with my amateur programming efforts! But I think the important part is in the procedures SPLINE and CURVE. Taking CURVE first, arrays x[] and y[] define a series of points and it is required to fill the gap between each pair of points with a smooth curve. So, for each segment between two points CURVE calculates coefficients represented by arrays a[] and b[] and passes these coefficients to the SPLINE procedure which uses these coefficients to draw a series of short lines following the required smooth curve. The number of short lines used to fill in the curve is 'nsteps', so by making nsteps reasonably large a close approximation to a smooth curve is achieved. The actual drawing on the computer screen, printer or whatever is done by 'movto' and 'linto' which are procedures elsewhere in the software. OCURVE is similar to CURVE, but for a closed curve  i.e. the end of the curve joins smoothly with the beginning.
Re: Spline (mathematical)
I sent the folder to you, John, and in a separate email the code.
To give you some ideas about the folder I quote the text of its tab 1.
[urlhttps://www.booteforum.de/showthread.php?p=428 ... ost4282578][/url]
To give you some ideas about the folder I quote the text of its tab 1.
Here you can find some pics on it:How is this folder working?
A cubic spline function is calculated from the input table with x and y data, e. g. the offsets of halfbread or height of a boat hull.
A spline function is an approximation formula which is used by the computer to calculate an y value to every x value inside the given interval.
The results of the spline function are shown as a table with 100 steps and as a graph.
Additional there is an "living" output table which shows the y value to every x input.
This folder calculates only "natural" splines, which means, the graph has no curvature at its beginning and its end.
For what purpose is it used?
You are able to check offset tables. If you are dealing with boat building, you will mostly use a lot of offset tables and sometimes there are mistakes in it.
The graph will show mistakes because it is not fair at this point. In this case you are able to correct the value in the table and run it again and check the new graph.
You are able to calculate measurements in between given points of offset. E. g. for additional building parts or changes of the position of a part.
You are able to design a fair line out of a few points for a building part you design by yourself.
What is necessary?
Necessary is an input of a table which contains at least 3 pairs of values. Each pair of values consists out of one x value and one y value.
The denomination of the values as "x" and "y" is usual in math, no special meaning is included.
If you put x as position of the frames and y as the corresponding half bread, you will get a waterline.
Requirements
Only decimal numbers allowed, no fractions, no mix of feet and inches.
Two input possibilities are given: column form or row form (often you will copy & paste the values from an other document and in this case column or row is given).
The end of the input table has to be marked with an "e" (lower case and without quotation marks) in the directly following position (look at example sheets).
It is only possible to use one of the two input possibilities. The other one must be blocked with an "e" at the first x position.
The input table must contain at least 3 pairs of values.
The x values have to be in ascending order, every x has to be greater (not eaqual, not lesser) than the preceding x.
Every x value needs an y value, if an y position is left empty, it is interpreted as zero.
In the input table is no void allowed.
Use the cell "A1" at input sheet, marked with "calculate", as click button to start calculation of the spline after finishing or altering the table.
[urlhttps://www.booteforum.de/showthread.php?p=428 ... ost4282578][/url]

 AYRS Chairman
 Posts: 104
 Joined: Tue Nov 08, 2016 6:39 pm
Re: Spline (mathematical)
Hi Helmfried  thank you for emailing me your spreadsheet and for the English translation of the 'Gebrauchsanleitung'  this does help since like many people in the UK I have almost no understanding of other languages! I can see the purpose of the spreadsheet and I can see that in the tab Eingabe there is a table for inputing values of x and y. I changed one of the y values, making it a number rather than calculated from a formula, then clicked on cell A1 and this did indeed produce a new tab called Chart1 with a plot of the new curve, so your spreadsheet does work!
As with your spreadsheet, the code I attached to a previous email also draws splines with zero curvature at the ends, at least if you use the CURVE procedure  the OCURVE procedure draws a closed shape. Having zero gradient at the ends of curves is probably what you want for most boat building purposes since when a hull is built from planks or sheet material laid in place over formers or frames there is usually little or no initial bending stress at the ends.
I think the code I posted will work with X values that are not all increasing one after the other, so it will for example draw a 'C' curve as easily as a 'U' curve.
All good fun, but I cant help thinking that any good drawing software will allow you to draw a curve through a set of points then interpolate between those points.
As with your spreadsheet, the code I attached to a previous email also draws splines with zero curvature at the ends, at least if you use the CURVE procedure  the OCURVE procedure draws a closed shape. Having zero gradient at the ends of curves is probably what you want for most boat building purposes since when a hull is built from planks or sheet material laid in place over formers or frames there is usually little or no initial bending stress at the ends.
I think the code I posted will work with X values that are not all increasing one after the other, so it will for example draw a 'C' curve as easily as a 'U' curve.
All good fun, but I cant help thinking that any good drawing software will allow you to draw a curve through a set of points then interpolate between those points.
Re: Spline (mathematical)
You are obviously right. The question is only which of the possibilities is easier at hand in a case you need it. As I'm not able to work reasonably with CAD software this folder helps me a lot.All good fun, but I cant help thinking that any good drawing software will allow you to draw a curve through a set of points then interpolate between those points.