Let's try to model objects using equations

In this example, we do a single division of infinite space. With this division, we create a solid object called halfspace. So, let’s try to define the object using x[1], x[2], x[3].

Let’s try the following halfspace program and polygonize with hfp.

line 1: my_model(x[3], a[1])
line 2: {
line 3:   my_model = x[1];
line 4: }


In the resulting image from polygonization, you will see the halfspace solid object, represented by an infinite plane clipped in a bounding box. Please, remember that the bounding box size is controlled by the hfp polygonizer program and has a default size of 20 with each coordinate varying from -10 to 10 (ref. Change the size of the bounding box and Change the grid density of the bounding box). The halfspace program uses the rule: x >= 0. This rule is the default for the program. Furthermore, y is up and +x is in the left hand direction. The first line of the halfspace program defines the number of variables in two arrays that your program will use. In line 1 of the above halfspace program, x is a reserved symbol for an array of function variables; the number in the bracket following a defines the number of variables in the array. In line 3, x represents the array of point coordinates, and the letter in the bracket that follows x is an index to the array. Therefore, please remember the following default index for the first 3 variables in the x array:

x[1] -> x
x[2] -> y
x[3] -> z

So, x[1] is the location on the x axis dividing infinite space in the yz plane. So, x[2] is the location on the y axis dividing infinite spcae in the xz plane. So, x[3] is the location on the z axis dividing infinite space in the xy pane. For example, x[1] + 5 or x[1] - 5 moves the location of the yz plane - or + 5 on the x axis respectively.

How can we know what is the inside and the outside of the halfspace solid object? We can not understand from viewing the image, because in this object, we only see one plane. We can know the inside and the outside of the halfspace solid object by revealing the normal vectors (normals) of the polygonized surface of the plane (see Change the display mode of an object). You may reveal the normals by selecting the seventh choice of the “Display Mode” in the “View” menu. Normal vectors are perpendicular vectors to the outside of an object.


Let’s try to consider +/-y >= 0, +/-z >= 0.
Let’s try to write xyz >= 0 in HyperFun.
Let’s try to write 100 - x^2*y^2 - y^2*z^2 - z^2*x^2 >= 0 in HyperFun.
Let’s try to write other equations variously.

hyperfun/tut_eq.txt · Last modified: 2008/12/11 10:19 by admin
This site contains HyperFun and other software that is free to use and modify under the provisions of the CGPL agreement unless otherwise stated.
Project hosted by the Digital Materialization Group
HyperFun CGPL HyperFun on SourceForge Creative Commons License Valid CSS Driven by DokuWiki