# Learn the Shape Maker. Mathematical model.

Updated: Oct 9, 2020

The technology for designing the hull surface using this mathematical model is as follows. First, lines are introduced that form the spatial framework of the object. It can be a buttock in CL, a side line of a deck, knuckle lines, a line of a midship-frame. Then the surface is “pulled” onto this frame. After that, the lines and surfaces are adjusted to obtain the desired shape of the hull (the shape of the hull controlled by orthogonal sections of surfaces, inflection lines, lines of equal normal to the surface, etc.).

**Point.**

A point has three coordinates that determine its position in 3D space.

Different types of points are presented in the system depending on the topological connections:

**- A spatial point** is a point that does not have topological connections with any other elements,

**- A point on a line** - This is a point lying on a line with which it is connected topologically,

**- A point on a surface** - This is a point that always lies on a surface that is connected topologically.

**- The intersection point of two lines** is the point obtained as a result of the intersection of two lines. Such a point cannot be changed.

**- The point of intersection of a line and a surface** - This is the point obtained as a result of the intersection of a line and a surface. Such a point also cannot be edited.

**Line.**

The line is a smooth (twice continuously differentiable by parameter) parametric curve in 3-dimensional space. It is presented in the form of an inhomogeneous cubic polynomial B-spline. Such a curve is represented as a set of segments - Bezier sections, which are cubic parametric curves connected to each other at points called B-spline nodes. The number of Bezier segments of the curve is less than the number of its control points by 3.

The position of any point on the line is determined by its parameter, which varies monotonously and continuously along the curve.

The direction is defined for the line, that is, the beginning and the end are determined. The direction of the line is determined by its start and end points.

1 - Endpoint

2 - Control points of the B-spline,

3 - Segment of curve,

4 - Control polygon,

5 - B-spline node.

A B-spline is defined by a control polygon, which, by some rule, maps a curve to the following properties:

- the polyline must contain at least four control points of the B-spline;

- the start and end points of the curve coincide with the start and end points of the polygon;

- the tangent at the starting point of the curve is directed along the first segment of the polygon, at the end point - along the last;

- the curve tracks the shape of the polygon(in particular, a polygon with self-intersections corresponds to a curve with self-intersections; if all vertices of the polygon lie on one straight line, then the curve will coincide with this straight line);

- the curve is contained in the "convex hull" of the polygon, that is, the dimensions of the curve are obviously no more than the dimensions of the polygon;

- a change in the position of one of the vertices of the polygon leads to a change in no more than four segments of the curve;

- arcs and circles are approximated approximately, the maximum radial deviation from the true arc can be 0.1 mm.

From the user's point of view, the control polygonis a tool for correcting the shape of the line.

The line is based on 2 points. A line starting and ending at one point is not used and cannot be entered. The line changes shape when the position of the end points changes.

Different types of lines are presented in the system depending on the topological connections:

**- A space line** is a line that does not have topological connections with any surfaces;

**- A lines on surface** is a line projected to surface by some way and topologicaly lined to this surface. It means the line will folow the changes of surface shape.

**- A intersection line** is a line of intersection of two surfaces. Such line will be always on intersection of two surface and will follow changes of surfaces shapes.

**Surface.**

The surface element is a smooth parametric B-spline surface. Her math is similar to the math of a B-spline curve, corrected for the two-dimensional case.

The surface can be based on 2, 3 or 4 boundary lines forming a closed loop. Closedness is ensured if the corner point of the surface is common to two boundary lines. A surface changes shape when the shape of the boundary lines changes.

The shape of the surface is represented by lines of equal parameter and sections. The shape of the surface can be controlled by changing the shape of the boundary lines and the position of the nodes of the control grid of the surface.

The number of nodes of the control grid of the surface and their location is determined by the control polygons of boundary lines. If opposite boundary lines have the same number of control polygon nodes, then the surface grid along the corresponding direction will have the same number of control polygon nodes. Otherwise, the number of nodes of the control polygon of the surface along this direction can be increased, but no more than the sum of the nodes of the control grid of these lines.

1- Boundary lines, 2- Lines of equal surface parameter, 3- Control surface polyhedron, 4 - Corner points.

**Driver.**
The Shape Maker implements complex constructions, such as a surface of revolution, conjugation of lines with a radius, etc., and their automatic support during correction. The driver elements in structure are no different from ordinary elements. They have all the relevant topological dependencies and relationships among themselves. They can be used to build other elements (lines, surfaces, etc.), for object snap (geometric and topological), as the basic elements of fixation. Correction of the original driver elements or driver parameters leads to automatic rebuilding of the driver elements.

**References.**
As mentioned above, the line changes shape when the position of the end points changes, the surface changes shape when the boundary lines change. This dependency is implemented using direct and reverse links between elements. For example, a line has direct links to its end points, and these points are backward links to a line, a surface has direct links to boundary lines and corner points, and lines and points are backward links to a surface.

**The names of the elements.**
Each element in the project database has its own unique number or name. This number can no longer be assigned to any other database items, even if this item is deleted. Thanks to this, the apparatus of links between elements is realized. The user can also use unique element names to select an element for editing. At the same time, instead of pointing the element with the cursor in the working window, in the input line of coordinates you just need to type its name and press Enter. In this case, the item will be selected for editing even if it is in the switched off unit. This property is often used in cases where it is necessary to deal with the topological dependencies of one element on another.
**Topological dependence of the elements.**
We call an element topologically dependent on another element (reference) if it has at least one common point with the reference element, a direct link to the reference element and changes when the reference element changes. A line is topologically dependent on its endpoints, and a surface on boundary lines and corner points.
**Topological connection of elements.**
Two elements are called topologically connected if there is a topological dependence between them. Topologically connected line, its endpoint, surface, its boundary line and corner point. Two elements are also called topologically connected if there is any element common to them on which these elements are topologically dependent or which itself depends on these elements. Two lines are topologically connected if they have a common endpoint. Two surfaces are topologically connected if they have a common boundary line or a common corner point.

Thus, the support contour for the surface will be closed if its lines are topologically connected. We call such a contour topologically closed. Thus, the surface can only be defined on a topologically closed contour. Two lines are topologically connected if they refer to the same point. There is no topological connection if the lines refer to different points, even if these points have the same Cartesian coordinates.