Marcus Bole - PolyCAD - Reusing and Rebuilding Surface Geometry
Reusing and Rebuilding Surface Geometry

Old Geometry and File Formats

The extensive range of CAD tools and exchange file formats provide us with different capabilities allowing us to swap our design between systems to get the best capability at the right time. There is a great heritage of software tools and geometry file formats in the marine industry. We like to use old data often because the performance characteristics of the represented hull are known and sometimes it is the only representation that exists, electronically or otherwise. Hull surface geometry can be captured in the format of offsets, surfaces, occasionally facets or linear meshes. There are also a large number of proprietary file formats. This data may get archived and need to be reused years later. Since a lot of the data is stored as text in common data structures it's possible to extract meaningful representations from these files long after the authoring software has become obsolete.

Solid Modelling Challenges

Today, Solid Modelling is ubiquitous but the supporting data structures are complex and the technique relies upon a lot of numerical analysis which is sensitive to tolerances. With different Solid Modelling tools using different algorithms, mathematical representations and tolerances there can be occasional problems loading models from one system into another. If a model is passed through between several different systems problems can accumulate resulting in corrupt geometry and a failing model. Perhaps worst still, some Solid Modelling systems replace concise geometry, such as mathematical primitives or planes with generic geometry such as NURBS surfaces. The user may not be aware of this until the geometry model fails and it's no longer possible to continue with that version of the definition.

Solid models can fail if there are poor tolerances between patches or errors in the surface.

The Close Relationship between Hull Form Design and Surface Geometry

Hull Surface Design is a unique discipline. We are one of the few design fields that like to interact directly with NURBS control polygons or, for more complicated ship hull forms, we may use definition curves which form the edge components of the B-Rep data structure that holds multiple surface patches together as a Solid Modelling 'Surface' in its own right. Marine designers have always had a close relationship with the raw mathematical representations and data structures. It's fine when it's working well but when representations are used incorrectly surface definitions can fail and gaps between patches will appear. More often than not this is down to a lack of experience, skill or failure to ask the right questions about best practise or tool capabilities. Added to that is the desire that software hides its inner workings and mechanisms so that low skilled or experienced users can achieve adequate results.

Rescuing Broken Geometry

A broken or old geometry containing file is not usually terminal. It may not be possible to load the dataset as intended but the geometry representations within the dataset should retain their integrity individually. It might not be possible to load a Solid Model B-Rep anymore but it will be possible to load the surfaces and curves that formed the parts of the definition. It make be possible to piece these parts back together into a Solid Model but it's likely that the reasons the geometry failed will prevent that. If this is the case, we can look at rebuilding the geometry using existing definition. We accept that while the data may be broken, the represented shape will still be present and we can capture it using tools and techniques already present in the CAD environment.

Basic Electronic Digitisation in 3D

Digitising 2D plans can be quite a laborious task. We can use an Engineer's Scale and type the coordinates into the software. Space will be needed to layout the paper and we will spend a lot of time reconfiguring the position of our body to measure, measure again to check, and then write or type into the computer and then return to work out where we were previously on the plan. An electronic digitiser can reduces time by capturing the coordinates and feeding them into the software. If an electronic definition already exists we can digitise inside the design environment using the dynamic coordinate snapping features that are present in many CAD design applications. Dynamic Snapping allows you to interactively draw new geometric entities by referencing existing geometry and extracting coordinate positions of features based on the position of the mouse. This can be a very quick process and it is something that would be considered a routine operation today.

The simplest way to capture geometry is to use snapping tools to identify points.
Easier but still time consuming and the traced geometry still requires interpretation.

Since Hull Design Software often uses specialist representation it is very advantageous if generic representations can also be imported into the software and used as references to build up a hull surface definition using snapping tools. While dynamic snapping tools is found in many generic CAD tools it is not something that's present in all surface design tools. PolyCAD has pioneered the ability to import primitive geometry and snap too it to allow hull surface definition to be rebuild and reused. In fact, snapping has been the single most productive development in the tool's history. Examples of building up the boundary and feature curves for an X-Topology Curve Network can be found here for a set of imported sections and for an existing surface definition.

Intersection as a means of Digitising Coordinates.

Although Dynamic Snapping is good for capturing coordinates from particular features of reference geometry it is not alone good for capturing shape. Capture of shape requires a more systematic approach and forcing the user to be systematic in their use of the software often breeds a feeling of tediousness. In hull design, shape is often captured with cross sections - planar cuts through geometry represented as a curve. Therefore to capture shape from any reference geometry we can cut it with a plane to reveal a set of coordinate points. A curve (polyline) may be generated by connecting the points together using various sequencing or sorting algorithms. The coordinate of the intersection points may also be published into the CAD environment as features which the Dynamic Snapping tools are sensitive to.

Sections intersected with a plane identify points which are connected into a curve.

PolyCAD features a Plane element which can be more and redefined interactively. Options allow the generation of points based on intersections with any curves or surfaces. Curves can then be generated through the points.

Rebuilding Surfaces using X-Topology

Using Planes as a tool to intersect geometry generating points that are then collected into a curve is an effective way of generating surface definition but requiring the user to process this in separate steps isn't efficient particularly when a larger number of sections may be required or the precise positioning of sections needs to be found interactively. In X-Topology, the process is automated to expose a flowing experience where the intersection plane is defined interactively with a number of mouse clicks, intersecting geometry and Point Clouds are automatically selected and a fitted X-Topology curve is generated directly from the extracted coordinates. Curves can be rapidly added and reviewed interactively after the intersection plane is defined by the mouse cursor.

Two curve fitting techniques are implemented: Cubic Spline Fitting and Least-Squares Fitting:

  • Spline fitting generates a cubic spline which interpolates all coordinate points generated by the plane intersection. Significantly, the number of definition points on the curve is directly related to the number of intersection points. This is an important characteristic to keep in mind when generating sequences of curves which should form a family, i.e. they should have the same mathematical model to avoid introducing unnecessary complexity into the generated surface from additional knots and inconsistent parameterisation which will be perceived as unfairness. In addition, keeping the number of control low improves the ability to fair shape and reduces the amount of time required to keep a curve fair. Spline fitting is best used when generating secondary curves which cross the main design curves and define patch boundaries.
  • A cubic spline fit will use every sampled point in the curve definition.
  • Least Squares fitting removes the implicit connection between the number of intersection or sampled points and the control polygon of the fitted curve definition. The number of control points is an addition parameter controllable by the user. Smoothing functions can be introduced which can improve the quality of the fit and support the generation of control points when there is limited data. The need to review these additional parameters creates a pause in the flow which allows the user to take a second look at the fit. While this may seem counter intuitive, experience with the Spline Fit suggested that as intersection curves could be added very quickly with a single click that often too many curves could be added without consideration of quality.
In the least squares fit the number of control points is not related to the number of sample points and automatic fairing is possible

Least Squares fitting is an analytical optimisation method which has many similarities to fairing [1] and curve generation [2]. Algorithms for least squares fitting can be found in many texts and the basic premise is the generation of a curve that interpolates a set of points with the least amount of error in the squared distance between curve and points. Smoothing introduces an additional set of equations which reduce the amount of bending energy in the curve. In addition to this, constraints may be added to introduce specific features into the curve. Curve tangents at the end of a fitted segment need to reflect the tangent information on any X-Topology curve to which a connection is made. Intersection with X-Topology Curves with tangent information splits curve into several segments which are fitted independently. X-Topology curves without tangent information are not treated especially and no attempt is made to interpolate these curves precisely because this would suggest that the fitted curve is behaving as a secondary design curve rather than primary. In these cases, a spline fit is better suited.

Curve sampled from a Point Cloud showing relative deviation from sampled points.
Curve sampled from a Point Cloud showing curvature.
Curve sampled from a Point Cloud showing curvature with smoothing applied.

Curve Fitting and Form Topology

One of the challenges of fitting B-Spline curves and surfaces to sampled points that represents a shape with regions of different curvature degrees and flat planar areas is that it's difficult for the fitting algorithm to automatically adapt the resolution of the control polygon to the complexity of the shape. Fitting algorithms will normally uniformly space the control polygon meaning that sharp areas of curvature are under defined and planar areas over defined. Typically, users will increase the number of control points to ensure the areas with sharp curvature are adequately represented producing a fitted definition that has a significant number of control points and is challenging to modify by hand subsequently.

Form Topology information from curves with tangent information allow the fit to be separated across the different
regions of shape. This allows the right number of points to be used in the right place.

This challenge is alleviated when fitting curves to an existing X-Topology Curve Network that contains Form Topology because the boundaries of the different regions of shape are captured and can split a fitted X-Topology curve into multiple segments. Each segment is fitted independently allowing the optimal fit parameters to be selected for that region. Where a segment is straight or a blend curve between neighbouring segments, the fitting algorithm can introduce the corresponding X-Topology Curve constraints avoiding the need to introduce control points.

Refining Curve Networks

This fitting process can also be used to refine the X-Topology Curve Network during the design process. Sometimes the network has to be reorganised or changed to improve shape or adapt to include a feature. Adding new curves in manually can, in the process, damage the fairness or destroy shape as you adapt the new geometry into it. The challenge is that unless you add the new shape in perfectly positioned some change will be experienced. But it is possible to fit an X-Topology to a surface definition using the curve fitting tools. Furthermore, the tools understand this requirement and will automatically reference existing X-Topology curves to the new geometry to ensure the correct hierarchy between the primary shape curves and crossing curves. This process is demonstrated in the video below.

Summary

Repairing and rebuilding surfaces by intersecting geometry efficient generates points to which curves and surfaces can be fitted avoiding manual digitisation. By incorporating Form Topology principles into the fitting algorithm X-Topology Curves can be generated with definition that is sensitive to the degree of curvature in the original geometry and produce a control polygon that is amenable to subsequent modification by hand as part of a surface design process.

More details on the background of the process discussed on this page can be found in my COMPIT 2014 Paper. [3].

References

  1. Curves and Surfaces for CADG: A Practical Guide, G. Farin, 2002 , Morgan Kaufmann.
  2. Computational Geometry for Ships, H. Nowacki, M.I.G. Bloor, B. Oleksiewicz, 1995, World Scientific Publishing Co Pte Ltd.
  3. Regenerating Hull Design Definition from Poor Surface Definitions and other Geometric Representations, M.Bole, COMPIT 2014, Redworth, UK, 12-14 May 2014.