HyperFun: Program
The program in HyperFun consists of one or few
objects
defined sequentionally.
The previous objects can be used in functional
expressions
of the following ones.
Example of a program:
-- The program contains the definitions of three objects
-- Definition of object "Parallelepiped"
Parallelepiped(x[3], a[6])
{
Parallelepiped = (x[1] - a[1]) & (-(x[1] - a[1]) + a[4]) &
(x[2] - a[2]) & (-(x[2] - a[2]) + a[5] &
(x[3] - a[3]) & (-(x[3] - a[3]) + a[6]);
}
-- Definition of object "Sphere"
Sphere(x[3], a[1])
{
Sphere = a[1]^2 - x[1]^2 - x[2]^2 - x[3]^2;
}
-- Definition of object "CSGobj" with using previosly defined objects
CSGobj(x[3], a[1])
{
array param[6];
param = [-9.0, -8., -9, 18.0, 16., 18];
rad = 10.;
block = Parallelepiped(x, param);
CSGobj = block \ Sphere(x,rad);
}