10.014 CTD
  • Overview
  • Schedule
  • Administrative
    • Accessing Rhino remotely
    • Rhino for Mac
  • ASSIGNMENTS
    • Dates and rubrics
    • Generative design
      • Generative design
    • Parametric design
      • Parametric design
    • Simulated design
      • Simulated design
      • Simulated design
  • SESSION 1B
    • Computer Aided Design
    • Ranges and expressions 1
      • Ranges and expressions 2
      • Ranges and expressions 3
      • Ranges and expressions 4
      • Ranges and expressions 5
      • Ranges and expressions 6
  • SESSION 2A
    • Visual programming 1
      • Visual programming 2
      • Visual programming 3
      • Visual programming 4
    • Associative modelling 1
      • Associative modelling 2
      • Associative modelling 3
  • SESSION 2B
    • Logical Patterns 1
      • Logical patterns 2
      • Logical patterns 3
  • SESSION 3A
    • Spatial geometry 1
      • Spatial geometry 2
      • Spatial geometry 3
      • Spatial geometry 4
      • Spatial geometry 5
      • Spatial geometry 6
      • Spatial geometry 7
    • Curve geometry 1
      • Curve geometry 2
      • Curve geometry 3
      • Curve geometry 4
  • SESSION 3B
    • Surface geometry
    • Parametric modelling 1
      • Parametric modelling 2
      • Parametric modelling 3
      • Parametric modelling 4
  • SESSION 4A
    • Information nesting 1
      • Information nesting 2
      • Information nesting 3
    • Data landscapes 1
      • Data landscapes 2
      • Data Landscapes 3
      • Data landscapes 4
  • SESSION 4B
    • Mesh geometry 1
      • Mesh geometry 2
      • Mesh geometry 3
  • SESSION 5A
    • Space and time 1
      • Space and time 2
    • Modelling entities 1
      • Modelling entities 2
      • Modelling entities 3
  • SESSION 5B
    • Multibody dynamics 1
      • Multibody dynamics 2
    • Material elasticity 1
      • Material elasticity 2
      • Material elasticity 3
  • SESSION 6A
    • Form-finding 1
      • Form-finding 2
      • Form-finding 3
      • Form-finding 4
  • SESSION 6B
    • AI Image generation 1
      • AI Image generation 2
      • AI Image generation 3
  • APPENDIX
    • Spirograph 1
      • Spirograph 2
    • Curves
    • Swarm Intelligence 1
      • Swarm Intelligence 2
    • Hybrid programming 1
      • Hybrid programming 2
Powered by GitBook
On this page
  • Complex Patterns
  • Design Parameters
  1. SESSION 4A
  2. Data landscapes 1

Data landscapes 2

PreviousData landscapes 1NextData Landscapes 3

Last updated 8 months ago

Complex Patterns

To utilize complex expressions in python we need to load the mathematical functions library. This is expressed by adding the “import” statement prior to any other lines of code. It translates to “import all mathematical functions from the math module”.

The editor pops up after double clicking over the python component’s label. To make the text size larger you need to hold down the control key and use the scroll wheel of the mouse. To accept the code entered and close the python editor you need to click the “OK” button.

The python editor features also an additional “test” button which allows us to apply modifications without closing the window. This is very useful for experimentation as the graph is re-evaluated and the results are displayed on screen instantly.

Modular Arithmetic

Integer arithmetic functions are quite interesting as they produce repetitive patterns not unlike the sine and cosine, but they appear as “saw-tooth” forms. The modulo operation can be considered geometrically as a subdivision or repetition operation. Notice that this example uses the “interpolate” option of the surface, otherwise the “saw-tooth” form will not be as a sharp as in the figure below.

Clipping Functions

Another family of mathematical functions of interest are the “clipping set” including “min”, “max”, “ceil” and “floor”. These functions can help us introduce abrupt changes or discontinuities similar to modulo’s behaviour.

Practice

  • Instead of using min and max with a constant, try using another function for the second branch to appreciate the Boolean behaviour produced.

  • It is also perfectly valid to use conditional logic such as if expressions. What is the effect of conditionals with vastly different expressions per branch?

Design Parameters

We extensively used constant values in the expressions presented. This was often to perform simple operations such as translation and scaling. Instead of tweaking those and constantly updating the screen using the “test” button, it makes more sense to expose them as parameters connected to sliders. The topic of this section is creating a control structure around our expressions by exposing design parameters.

In graph above we incorporate translations by replacing x and y with x + ty and y + ty respectively. The parameters tx and ty represent displacements of the x and y inputs, or variables in the mathematical sense, supplied by the grid’s points.

For translation in the “z” direction we add a “tz” component which is equivalent to the idea of the “z + tz”. Therefore, the complete expression including translations becomes z = sin( ( x + tx ) * ( y + ty ) + tz.

The ability to control translation allows us to traverse the domain of a function using sliders. For complex functions this offers an intuitive approach to detect interesting instances and to visualize the surface in an animated sense as seen in the figure.

Scaling follows the same concept but using multiplication instead of addition. We apply sx, sy and sz factors by multiplying each of the original parameters. Again for the “z” direction we need to scale the entire expression. This is because if we assume our original function sin( x * y ) = z as in f( x, y ) = z, to achieve scaling we need sz * f( x, y ). This expands to the complete form seen below which supports both translation and scaling z = sz * sin( ( x + tx ) * ( y + ty ) ) + tz.

Scaling enables operations such as zooming within the domain of function. Here you need to also consider that our base grid has a finite resolution and that the surface drawn represents only an approximation of the true function’s shape. So modifying the scale sometimes interferes with the grid as the value from one point to the next changes too rapidly for the surface to accurately capture.

Practice

  • Try to use the translation and scaling parameters such the highly undulating region of this surface is captured with higher fidelity.

  • Translation and scaling are generic and useful but not the only possible parameters we may apply. Try to define a parameter that captures the number of repetitions using either trigonometric or modular expressions.

The ceil(value) and floor(value) functions produce the closest integer from a real number. For example ceil(3.4) = ceil(3.5) = ceil(3.6) = 4, i.e. the decimal places are dropped and integer is rounded rightwards in the real line sense. In the same spirit floor(3.4) = floor(3.5) = floor(3.6) = 3 i.e. the number are rounded leftwards. Applying those functions to smooth surfaces, such an inverted paraboloid as seen below, produces the effect of terracing [].

The min(a, b) and max(a, b) functions return the smallest and largest of the parameters passed respectively. In fact they are so simple we can write them as min = a if( a < b ) else band in the same spirit we can write max = a if( a > b ) else b The effect of the “min” and “max” functions resemble solid Boolean operations []. In the example below we clip a wave surface above and below a horizontal plane at level z = 1 using the min and max functions.

Python’s math library (or module) has many more functions [] to experiment with compared with what is available in the expressions component editor.

>
>
>
15KB
4B-Data-Landscapes-02.gh
Python editor
Running the python script
Results of modulo