HyperFun: Operators and Expressions

There are two types of expressions permissible in the language: 'functional' expression and 'logical' expression.

• Functional expression
• The functional expression is a conventional numerical expression built with using:

• F-rep library functions
• An extendible F-rep library contains functions representing geometric primitives and transformations. Each function has its own set of arguments, all of which are functional expressions. The result is a real number.
Examples of library functions:

• Sphere: hfSphere;
• Ellipsoid: hfEllipsoid;
• Torus with x, y, z axes: hfTorusX, hfTorusY, hfTorusZ;
• Cylinder with x, y, z axes: hfCylX, hfCylY, hfCylZ;
• Block: hfBlock;
• Blobby object: hfBlobby;
• Metaball object: hfMetaball;
• Soft object: hfSoft;
• Scaling tranformation: hfScale3D;
• Shift (translation): hfShift3D;
• Rotation around x, y, z axes: hfRotate3DX, hfRotate3DY, hfRotate3DZ;
• Blending union: hfBlendUni;
• Blending intersection: hfBlendInt;
• Twisting around x, y, z axes: hfTwistX, hfTwistY, hfTwistZ;
• Stretch: hfStretch3D;
• Tapering along x, y, z axes: hfTaperX, hfTaperY, hfTaperZ.

There can be references in the functional expression to geometric objects defined in the same program or saved in the special library. The form of a corresponding call stems from a syntax of object's head.
Example:

Sphere(xx,aa)

• Logical expression

The logical expression is built of functional expressions as its arguments, with using relational and boolean operators. The functional expression value '0' is treated as boolean 'false'; other values are treated as 'true' in the logical expressions.

There are the following relational operators:

'<', '>', '<=', '>=', '=', '/='.

There are two infix boolean operators ('and', 'or') and one being used in prefix form ('not').
Examples:

i < 4;

(x[1] = a[1] and (2 <= xx[3] < 5.5))

In both kinds of expressions, parentheses can be used by a traditional manner and are recommended for usage to make expressions structure more clear. The rules of precedence in the expressions are also traditional. Note only that the special geometric operators have lower precedence (and accordingly are executed later) than the arithmetic operators.