Download PDF + model files

 

A Simple Formula Example

by Reinhard Siegel

 

MultiSurf provides a wide variety of mathematical functions. The complete set of functions is listed below.

Often used functions are the following ones:

Let us consider a simple example. Open model wl_length.ms2.

 

Model wl_length.ms2

 

The model shows hull surface "hull". We want to measure the waterline length.

Here the function DIST has been used.

Since both rings have coordinates Y = 0 and Z = 0 an alternative is to use the function XPOS. The expression for the formula "wl_length" would then read: XPOS(ring2) - XPOS(ring1).

In order to display the result of our calculation (i. e. the value of variables and formulas) we have two options:

For Real Values display use the Tools menu or the shortcut letter key V.

To present the content of variables by the entity Text Label follow thes steps.

 

More complex use of variables and formulas is made in the models sloop_rig.ms2, J22.ms2 and main_dimensions.ms2.

 

Mathematical functions available in MultiSurf

Name Argument(s) Result Synopsis
ABS 1, any units Same units as argument Absolute value
ACOS 1: unitless unitless arc cosine (radians)
ACOSD 1: unitless unitless arc cosine (degrees)
ALARM 2: any units Unitless ALARM has 2 arguments ALARM(x,y). The alarm "goes off" (goes into error) if (1) it is set (x > 0) AND (2) y < 0. Using a formula or expression for y, you can build various warning limits into a model.
ANGLE 3: point, point, point Unitless (degree) Angle of three points (angle at pt2 between the directions to pt1 and pt3)
ARCLEN 3: curve, unitless, unitless Length Arc distance along curve, from t1 to t2
AREA 2: surface, use_sym (0 or 1) Area = L^2 Area of surface, CompSurf, or TriMesh
ASIN 1: unitless unitless arc sine (radians)
ASIND 1: unitless unitless arc sine (degrees)
ATN 1, unitless Radian (unitless) Arc tangent
ATND 1, unitless Degree (unitless) Arc tangent (in degrees)
ATN2 2, both with same units Radian (unitless) Arc tangent(y/x)
ATN2D 2, both with same units Degree (unitless) Arc tangent(y/x) (in degrees)
BBOX 1. Entity or Entity List 2. Real scale factor 3. Real sign 4. Index, 1 to 3 for X, Y, or Z component Length The BBOX function gets information about the bounding box of an entity, or a set of entities specified by an Entity List. A bounding box is the smallest rectangular solid, aligned with the global coordinate system, that encloses the selected entities.
BSPL 1. KnotList, or *UNIFORM for uniformly spaced knots.
2. K, polynomial order (2 for linear, 3 for quadratic, 4 for cubic, etc.)
3. N, number of basis functions.
4. I, index indicating which basis function to evaluate (1 to N).
5. T, parameter (nominal range 0 to 1, but can be any real value)
unitless The BSPL function evaluates the so-called “B-spline basis functions”, which are the mathematical foundations of B-spline and NURBS curves and surfaces.
Example: BSPL( *UNIFORM, 3, 5, 2, 0.40) returns 0.3200.
In this case the knots are uniform (0, 0, 0, 1/3, 2/3, 1, 1, 1); the B-splines are quadratic (K = 3); there are N = 5 of them; I = 2 selects the second basis function; T is 0.40.
Errors:
222. NURB has too few knots for its order and number of control points.
223. NURB has too many knots for its order and number of control points.
234. Insufficient spacing between knots.
556. BSPL function: order less than 1.
557. BSPL function: number of basis functions less than 1.
558. BSPL function: index is out of range (1 to number of basis functions).
CEIL 1: any units Same units as argument CEIL(x) is the smallest integer that is greater than or equal to x.
CENTROID 3: entity, use_sym (0 or 1), index (1-3, for X,Y,Z coordinate) Length Coordinates of centroid
CLEAR 2: point, graphic entity Length Clearance
COS 1, radian (unitless) Unitless Cosine
COSD 1, degree (unitless) Unitless Cosine (of angle in degrees)
COSH 1: unitless unitless hyperbolic cosine
CURV   1/Length Curvature of host curve or snake, at t location of bead/ring.
If t is on a breakpoint, hi_side (0 or 1) controls whether curvature is measured below or above the break.
kind: 0 is 3-D curvature of curve or snake; 1 is normal curvature of snake; 2 is geodesic curvature of snake.
CURVINT 3: curve, t, real L times units of real Integral of real times ds along curve.
ds is the element of arc length along the curve.
t is a Variable.
real is a Formula descended from t.
DIST 2: point, point Length Distance between points
ERROR 1: entity Unitless Error code attached to entity (0 if no error).
EXP 1, unitless Unitless Exponential
FLOOR 1: any units Same units as argument FLOOR(x) is the greatest integer that is less than or equal to x.
FRAMEPOS 3: point, frame, index (1-3, for x,y,z coordinate) Length Coordinates of point in frame
GRAPH 2: graph, unitless Unitless Evaluation of graph
HYDRO 6: sp.gr., Zcg, sink, trim, heel, index various, depending on index Fixed-position hydrostatics based on the visible contours.
index is 1 to 29; selects one of 29 results, e.g. index = 6 for displacement volume;
index = 15 for wetted surface.
IF 3: any units Same as units of selected argument If arg1 >0, arg2; else arg3
LOG 1, unitless Unitless Natural logarithm
LOG10 1, unitless Unitless Base-10 logarithm
MASS 3: entity, use_sym, index M
ML
Mass, if use_sym is not 0, includes symmetry images.
Index = 0 returns Mass.
Index = 1, 2 or 3, the value returned is the mass moment with respect to X, Y or Z. This is the product of mass times the X, Y or Z coordinate of the centroid. Unit dimensions are ML.
MAX 2, both with same any units Same units as arguments Maximum
MIN 2, both with same any units Same units as arguments Minimum
PI 1; any units Unitless PI has 1 argument, but its value is immaterial; PI(x) = pi for any x.
ROUND 1, any units Same units as argument Rounding to integer
ROUND2 1, any units Same units as argument ( x, places) rounds x to the specified number of decimal places. E.g., ROUND2(PI(0),2) is 3.140000.
SIGN 1: any units Unitless SIGN(x) is +1 when x > 0, -1 when x < 0, 0 when x = 0.
SIN 1, radian (unitless) Unitless Sine
SIND 1, degree (unitless) Unitless Sine (of angle in degrees)
SINH 1: unitless unitless hyperbolic sine
SQRT 1, unit dimensions all multiples of 2 Unit dimensions of argument divided by 2 Square root
STRAIN 2: Surface/TriMesh, index Unitless Surface/TriMesh is a surface or TriMesh entity
index = 0 or 1, for minimum or maximum strain
This function reports the strain range for an Expanded Surface or Expanded TriMesh.
SURFCURV 5: magnet, hi_side_u, hi_side_v, kind, angle L^-1 for kind = 0 or 2; L^-2 for kind = 1 Surface curvature
kind = 0, normal curvature
kind = 1, Gaussian curvature
kind = 2, mean curvature
SURFINT 4: surface, u, v, real L^2 times units of real Integral of real times dA over surface
dA is the element of area on the surface
u and v are Variables
real is a Formula descended from u and v.
TAN 1, radian (unitless) Unitless Tangent
TAND 1, degree (unitless) Unitless Tangent (of angle in degrees)
TANH 1: unitless unitless Hyperbolic tangent
TPOS 1, bead or ring Unitless t parameter
UNITMASS 1: entity M for a point
ML^-1 for a curve
ML^-2 for a surface
ML^-3 for a solid
unit weight property of entity
UPOS 1, magnet or ring Unitless u parameter
VELOCITY 3: curve, t, hi_side Length Rate of change of arc length with respect to t
If t is on a breakpoint, hi_side (0 or 1) controls whether velocity is measured below or above the break.
VOLUME 2: solid, use_sym (0 or 1) Volume = L^3 Volume of solid
VPOS 1, magnet or ring Unitless v parameter
XPOS 1, point Length X coordinate
YPOS 1, point Length Y coordinate
ZPOS 1, point Length Z coordinate