2.3.1 The Formex data model

The most important geometrical object in pyFormex is the Formex class. A Formex can describe a variety of geometrical objects: points, lines, surfaces, volumes. The most simple geometrical object is the point, which in three dimensions is only determined by its coordinates (x,y,z), which in pyFormex will be numbered (0,1,2) for convenience. Higher order geometrical objects are defined by a collection of points. In pyFormex terms, we call the number of points of an object its plexitude.

A Formex is a collection of geometrical objects of the same plexitude. The objects in the collection are called the elements of the Formex. A Formex whose elements have plexitude $n$ is also called an $n$-plex Formex. Internally, the coordinates of the points are stored in a numerical array2.1 with three dimensions. The coordinates of a single point are stored along the last axis (2) of the Formex; all the points of an element are stored along the second axis (1); different elements are stored along the first axis (0) of the Formex. The figure 2.2 schematizes the structure of a Formex.

Figure 2.2: The structure of a Formex
 
Formex.png

Warning: The beginning user should be aware not to confuse the three axes of a Formex with the axes of the 3D space. Both are numbered 0..2. The three coordinate axes form the components of the last axis of a Formex.

For simplicity of the implemented algorithms, internally pyFormex only deals with 3D geometry. This means that the third axis of a Formex always has length 3. You can however import 2D geometry: all points will be given a third coordinate $z=0.0$. If you restrict your operations to transformations in the $(x,y)$-plane, it suffices to extract just the first two coordinates to get the transformed 2D geometry.

The Formex object F can be indexed just like a $NumPy$ numerical array: F[i] returns the element with index $i$ (counting from $0$). For a Formex with plexitude $n$, the result will be an array with shape $(n,3)$, conttaining all the points of the element. Then, F[i][j] will be a $(3,)$-shaped array containing the coordinates of point $j$ of element $i$. Finally, F[i][j][k] is a floating point value representing a single coordinate of that point.



Footnotes

... array2.1
pyFormex uses the NumPy ndarray as implementation of fast numerical arrays in Python.