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
  1. SESSION 2A
  2. Associative modelling 1

Associative modelling 2

Symbolic expressions to epicycles

PreviousAssociative modelling 1NextAssociative modelling 3

Last updated 9 months ago

Symbolic Expressions

Composing mathematical expressions using basic arithmetic components gets out of hand pretty quickly. The reason is because addition for instance is a trivial operation yet when expressed as a component it requires significant amount visual real estate. As a result, performing basic arithmetic does not seem to scale very well in the sense of visual complexity escalation. Moreover, it is difficult to parse simple mathematical expressions by trying to detect and follow the flow of components and wires.

Using symbolic expressions for basic math logic is the preferred modelling approach. In this visual programming environment we can use a range of symbolic expression systems. Those are found in the “maths” palette and include spreadsheet-like syntax as well as established programming languages such as C#, Visual Basic and Python.

We will use the “expression” and “python script” components extensively in this part of the term. Since basic mathematical expressions are pretty much exactly the same across the programming world, it will not be too confusing. Let’s simplify the above graph using “expression” components.

After placing an “expression” component in the graph we typically edit its input and output parameters. You will notice that when we zoom-in close enough to its input parameter list, we are able to add or remove parameters by clicking the buttons that appear. Components that support this functionality are known as variable parameter components. Notice also that unfortunately we cannot change the output parameter number; the “expression” component always outputs one.

To edit the component’s expression we need to double-click over it, causing a pop-up window, the expressions designer, to appear. The syntax used in this visual editor is not unlike spreadsheet formulas. We proceed with expressing the circle’s points using two expressions, one for each coordinate, and remove the clutter caused by the basic arithmetic and trigonometry components. The process of reorganizing and often simplifying logic is also known as refactoring.

For demonstrating the scenario of using multiple input parameters in an “expression” component we may also compact the normalisation logic. The “expression” requires the “index” values created by the “series” component and the number of range items “count” i.e. the value of the “slider” component.

Simple expressions are so prevalent that there is yet another way to achieve the same result without even using the “expressions” component. Component’s input allow us to directly encode an expression transforming the values accepted via wires before being processed by the component.

We may apply the normalization logic directly via the “series” component by entering the formula “1 / ( x – 1 )” in its “step” input parameter. This is achieved via the context menu above the parameter’s label. The notation is using a variable named “x” instead of the parameter’s name “step”; a peculiarity we just have to live with. Observe how the “points of unit circle” has been compacted in a much more legible way below.

Practice

  • Familiarize yourself with other mathematical components in the “maths” palette. Recreate some of the previously created range transformations modeled using the spreadsheet for practice.

  • You may apply an input parameter expression directly into the the “x” and “y” coordinates of the “construct point” component. Note however that sometimes too much compaction is equally confusing as using numerous components.

20KB
1_2_ExpressionsComposition.gh
Mathematical expression in component form - Verbose and hard to read?
Expression component is found in the 'Maths' palette
Expression component
Expression editor/designer
Normalisation
Writing expression directly via input parameter