Data landscapes 1
Scalar fields
Last updated
Scalar fields
Last updated
This session builds on the concepts of grids and information nesting. We focus here on a subset of surfaces with mathematical form of “f( x, y ) = z”. They are sometimes known as scalar fields [], depth maps [] or heightmap [] surfaces, because we are in control only of values in the vertical “z” direction. Visually they resemble terrains.
Scalar fields have numerous applications including: video games e.g. for open-world maps; economics e.g. associate price and quantity to profit; engineering e.g. mapping control variables to production yields; architecture e.g. create landscapes designs and building components.
Apart from this session being a soft introduction to the broader realm of surfaces, we aim here to develop the techniques required for approaching the second assignment of the term. We will model scalar field surfaces, expose parameters to define families of designs, explore their shape to find interesting instances, catalouge their differences and variations and convert them into 3D printable geometries.
We begin with constructing a 2D grid of points using the “series” components and the Cartesian product operation. Our control parameters are related to the number of points per grid direction, namely “nx” and “ny”.
While the “nx” and “ny” parameters are rather abstract, in the sense that they control the number of points per direction, the also have a “physical” meaning. If we assume that the working document units are millimetres, then the grid also coincides with a rectangle of “nx” by “ny” millimetres.
Next we decompose the point grid into coordinates, apply a function against their “x” and “y” coordinates, and reconstruct the points with the same “x” and “y” coordinates but transformed “z”. This is the general scheme for producing scalar fields.
The surface produced is a plane because for each direction of the grid the function applied is a line of the form “y = x”. Combining the two lines using addition for the “z” coordinate i.e. “z = x + y” produces a diagonally inclined plane.
To generate a surface we use the “surface from points” component. It constructs parametric spline surfaces using a grid of points. The concept of spline curve and surface are very similar. For curves we need a sequence of control points, while for surfaces we need a grid of control points.
The component requires points to be supplied in a list instead of grid. So we need to flatten the point grid into a list. This is a counter-intuitive convention we just have to follow. In addition, it requires the number of columns, or rows depending on grafting order, such that it can reconstruct the grid shape using the grid folding technique we discussed in a previous session.
Practice
The component has a third parameter named as “interpolate”. It has the same effect of approximation versus interpolation curves. Change the default value from false to true to produce a surface that passes through the supplied points.
Try to connect the “nx” instead of “ny” parameter for “u count” to observe the peculiar result produced. If you find yourself in a situation where the results appear in similar fashion you will know that it is only a matter of providing the correct stride value.
We can use python expressions to produce the same result. The syntax is exactly the same in this scenario. Perhaps moving forward in the term it is a better idea to also practice using python expressions instead of the “expression” component.
Practice
In the expression editor we can symbolically express the square of a number using the caret “x ^ 2” notation. This works for all powers “xy“. Experiment with more complex polynomial surfaces.
In python we can symbolically express the square of a number using the double-star “x ** 2” notation. Again this works for every power “xy“. Try using real numbers instead of integer powers.
To explore more interesting geometries we can use the “expression” component. In the example below we generate a paraboloid surface using . The surface is a simple parabola of the form applied for each of direction of the grid. The division is performed for scaling in the vertical direction such that the surface is not extremely stretched due to squaring acceleration behaviour.