nanoCAD Platform Help

Mathematic functions to work with the surfaces

Function Comment
sin(alfa) cos(alfa) tg(alfa)

Trigonometric functions.

alfa - angle in degrees

Returns a real number

asin(c) acos(c) atg(c)

Arc-trigonometric functions.

c - number

Returns an angle in degrees.

DegToRad(deg)

Function converts degrees to radians.

deg - angle in degrees

RadToDeg(rad)

Function converts radians to degrees.

rad - angle in radians

int(value)

Function rounds a real value to integer

value - real number

abs(value)

Function gets the modulus of the number

sqrt(value)

Functions returns the square root of the number

min(a,b) max(a,b)

Function returns maximum and minimum numbers from a and b

iff(expr, a, b)

Function is analogue of the if arithmetic operator.

Returns a, if the result of the expression expr >= 1, b otherwise.

VecLen(vec)

Function returns the length of the vec vector.

VecUnit(vec)

Function gets the normal vector (of unit length) from the vec.

VecCodirect(vec1,vec2)

Function checks if the vec1 and the vec2 are codirectional. Returns 1 if the vec1 and the vec2 are codirectional, 0 otherwise.

anglePi(vec1, vec2)

Function returns the angle between the vec1 and vec2 in the interval from0 to PI.

angleTwoPi(vec1,vec2)

Function returns the angle between the vec1 and vec2  in the interval from0 to 2*PI.

Point() Point(x, y, z) Point(plane)

Function returns a point. Can be used as a point constructor. If it is without arguments, it returns the P(0,0,0) point. If the argument is a plane, it returns a base point.

Vector() Vector(x, y, z) Vector(plane)

Function returns a vector. Can be used as a vector constructor. If it is without arguments, it returns the V(1,0,0) vector. If the argument is a plane, it returns a normal.

Plane(pntBase,vecNormal)

Function is a constructor of the plane. Returns the plane containing the pntBase point and having the vecNormal normal.

getPerp(vec)

Function returns a vector, orthogonal to the vec vector.

rotateBy(vec1,rAngle,vecNormal)

Function rotates the vec1 vector by the rAngle angle (in degrees) in the plane, having the vecNormal normal. Returns the result of the operation.

getPerpendicular(pnt1,pnt2,pntFrom,pntBase)

Function returns the length of the perpendicular from the pntFrom point to the line, specified between the pnt1 and the pnt2 points. In the pntBase variable, the point of the perpendicular base on the specified line is returned.

getMiddle(pnt1, pnt2)

Function returns a point in the middle of the line, specified by the pnt1 and pnt2 points.

getLinesIntersect(pnt1,vec1,pnt2,vec2) 
getLinesIntersect(pnt11,pnt12,pnt21,pnt22)
     

Function returns a point of intersection of the lines, specified by the pairs of the points: [pnt11, pnt12] and [pnt21, pnt22] or by a point and a vector: [pnt1, vec1] and [pnt2, vec2].

if the lines do not intersect, the Z coordinate is -1 in the returned point.

getLocalNormal(vec1,vec2)

Function returns a vector product of the vec1 vector and the vec2.vector.

projectOnPlane(pnt,plane2,rDistance) 
projectOnPlane(plane1,plane2,rDistance)
     

Function returns a projection of the pnt point in the plane, placed in the rDistance distance from the plane2 plane.

If the plane is a first argument, the function returns the plane through the Point (plane1) point projection on the plane, placed in the rDistance from the plane2 plane and having a normal vector, coinciding with the normal vector of the plane2 plane.

Subtraction of the point from the plane

Example:

d = WP - pnt;

Operation returns the distance of pnt point from the WP plane. If point pnt is on side where normal of WP plane points, direction is positive, negative otherwise.

Formation of the string by the numbers

To the string variable you can add a number. The result is a string.

Example:

A = 1;         
B = 5;         
Str = "Type " + A + ". Modification " + B + ".";
      

The result is a string

"Type 1. Modification 5."

FmtText(text, number, formated_text,...,)

Returns an rtf text, if among the parameters there is even one formatted, ordinary otherwise.

Various numbers of the parameters can be a result of the function. Expressions can be used as parameters.

FmtSuper(Text); FmtSub(Text);

FmtSuper() - returns an rtf text, formatted as the Superscript (upper index) FmtSub() - for the Subscript (lower index).

Text can be a string or a number.

FmtDiv(Text1, Tex2, Splash)

FmtDiv() - returns a fraction,

if Splash != 0  the fraction will have a divisor.

Example of use:

a = "super"; b= 1; c = 3; strPosition = FmtText(         "beginning of the text",         "Upper index-", FmtSuper(a),         "Lower index-", FmtSub("sub"),         " Text",         "Frection- ",FmtDiv(b, c, TRUE),         "fraction without a divisor-",FmtDiv(b, c, FALSE) );
FmtDigit(rNumber, rDelimeter)

Returns a string, formatted by a decimal symbol.

rNumber - number or string, containing a number,

if the rDelimeter == 0  the divisor is a point,

if the rDelimeter == 1 the divisor is a comma,

if the rDelimeter == 2 the divisor is taken from the system local.

Example:

a = 1.5; 
Formatted = FmtDigit(a, 1) 
      

As a result the Formatted = "1,5"