The magazine of the Melbourne PC User Group

Yacht Shape Design Using Bezier Curves
Ken Holmes
 


Ken Holmes presents another of the many special projects he has written for PC Update over the years.


In the April and May, 1999, issues of PC Update were articles describing the 3-point and 4-point Bezier curves and their construction by a recursive process of finding mid-points of intervals. They were used to design a dinghy, a yacht and a rather racey trimaran/tunnel-hull speedboat. These have evoked some interest through the Internet as apparently there is not much else available along these specific lines.

In retrospect, the programs were fairly crude as they were written purely as a programming exercise to placate my obsession with viewing stereo on the screen using a simple mirror (just mirror, no smoke). So it seems like a good idea to update the program using Visual Basic, since the Windows version is generally more suitable. Doubtless, the same job can be done using CAD but such programs are expensive and have a steep learning curve. Hopefully, boat fans will be sufficiently interested to play around with the shape - they might even be tempted to design a real boat.

Figure 1 shows the typical three view layout with a default shape with which to start. The gunwale and keel each use three consecutive 4-point Beziers. The gunwale runs from the bow (point 0) to point 24 defining 24 frames. Further sets of 24 points run lengthwise and proceed down the hull side until the keel runs from the bow to point 193 and then along to point 216 at the bottom of the transom. The default length, beam, depth, transom width and transom depth may be varied. The first decision would involve the length as this will determine the plotting ratio so that the side and plan views will always occupy two thirds of the screen width. It will then look rather strange until you choose the other main dimensions in proportion.
 



Figure 1. The default Three View Plan

The Gunwales

Points 0, 8, 16 and 24 are Bezier "anchor" points and there are Bezier "handles" at frames 2, 6, 10, 14, 18 and 22. Points 8 and 16 are both at 0.48 times the beam from the centre-line and so the maximum (half) beam is near point 12. Point 8 may be moved out or in using the scroll bar and point 16 is automatically moved inversely. The effect is to keep the beam constant but move the maximum fore or aft in accordance with the aesthetics of the user. A fundamental property of a Bezier is that the tangent to the curve at an anchor is, in fact, the line to the nearest handle; thus, to get a smooth transition between the Beziers, we must keep adjacent handles lined up with the intermediate anchor. Also, as point 8 is moved it is necessary to vary the slope of the tangents at points 8 and 16 to maintain a flowing line. This is automatically done so that the only choice open to the user is to fiddle with point 8. The handle at frame 2 may be used to sharpen or widen the bow as designers have their own ideas on wave penetration, pitching or water over the deck under various sea conditions.

The Keel

The keel gets similar treatment despite its dissimilar shape. To get the inflection fore and aft of the keel projection requires the keel handles at frames 6 and 18 to be well up towards the deck, rather than outside the hull, as with the gunwales. Points 200 and 208 are fixed at the chosen depth, but we maintain smooth transitions so that the program may also be used to design a smooth boat with no keel, as might be used for a trailer-sailer with a retractable centreboard, such as one I built about 30 years ago.

One effect of this is the projection below points 200 and 208, but this can be replaced by a faired weight or a winged-keel. It does also provide some thickness to the keel horizontal cross-section between points 200 and 208. The frame 2 keel handle can again be used to change the bulkiness of the bow section and the frame 22 handle can avoid any kinks at the transom. A necessary feature is that points 200 and 208 may be moved horizontally to vary the width of the keel projection or its fore and aft position, since our neat division of the length into three equal parts would not be the choice for all yachts. This causes different frame spacings in the three sections requiring some manipulation of the gunwale handles to maintain the smooth transitions for the gunwale. The boat builder would not use all 24 frames, but would use a lesser number for frames or for templates in the construction of a mould for a fibreglass hull.
 
The Frames

The recursive Bezier procedure is used to draw the gunwale and keel curves, but mainly to locate the points, and frames, at 8 equal intervals between anchors. At each frame, we use a 4-point Bezier between the gunwale point and the keel point anchors, using two handles (called inner and outer) to get the desired shape. For the keeled yacht, we want convex profiles at bow and stern and the S-shape at the projecting keel. The handle values are actually used as multipliers on the frame's anchor points. For example, the horizontal multipliers for both inner and outer handles at frame 8 are applied to the distance from centreline to point 8 to get the actual horizontal coordinates of the handles, and the vertical values are based on the distance of point 200 from the deck. The user may select the multipliers at frames 2, 8, 16 and 24 but the intermediate handle multipliers are calculated by linear interpolation. This ensures smooth transitions between the quite different frame cross-sections along the boat.

Presentation

The program does all the calculations and presents the 3-view plot in under a second, and repeats this every time a control value is changed - a little quicker than lofting a shape or making a model to see if you like the look of it. There is a perspective view available which suffers from the ambiguity in the fore and aft direction. It is also superfluous in that the mirror stereo view gives a perspective for each eye, albeit at half size.



Figure 2.  Mirror-Stereo View

For the "Stereo" view (Figure 2), the right eye view is plotted on the right half of the screen and you look at it with, guess what, the right eye. The left eye view plot is mirror-flipped onto the left of the screen. A mirror about 30 cm wide has its left side up the centreline of the screen and projects at right angles to it. Your nose is placed on the outer edge of the mirror so that your left eye can see the left side's reflection which is, of course, flipped back to its proper position. Assuming you have both eyes open(?), you will see perfect stereo - no ifs, no ands and no buts. There is no jumble of lines such as you see in two dimensions since you see around those in front. Now you may pitch the yacht up or down 90 degrees and rotate it 360 degrees using the scroll bars. One warning - don't scratch the screen, particularly if it is LCD. The stereo calculations assume eyes are 30 cm from a computer screen. The printed Figure 2 is somewhat smaller and the mirror width should be in proportion but, if not, you will simply see foreshortening or stretching at right angles to the paper. You should be able to perceive the stereo effect.

Figure 3 gives the coordinates of all of the 216 points as soon as you select the "Frames" view. Then, the scroll bar may be used to select individual frames, when that frame will be plotted and its coordinates table will be enclosed by a square. This has been done for a few frames in Figure 3. Selecting frames 1 to 12 or 13 to 24 lets you examine how adequate are the shape transitions, at a larger scale than in Figure 1. To preserve a final shape it is best to capture Figure 1 and Figure 3 as we have for this article. Pressing Print Scrn will capture onto the clipboard and it may be then pasted into (what better than) IrfanView. The program will always start with the default but, with Figure 1 recorded, you can readily change to your different settings. We could have saved the settings to a data file and the coordinates to a text file but I doubt that offers any advantages. If you happened to be an avid modeller, you could print out Figure 3 in several versions with different sets of frames drawn and use a photocopier to enlarge or shrink by a common amount. Then you would cut out frames and paste onto sheet material.



Figure 3. Coordinates of all points

Your Access

The program YACHT.EXE is available for download from the link. Note that, as a Visual Basic program it needs the run-time library, vbrun300.dll, on your computer.  Programming is such an enjoyable pastime that I adopt an Open Source attitude and my VB code is available to anyone with sufficient interest.

Reprinted from the May 2005 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[ About Melbourne PC User Group ]