Based on Ben Doherty’s“generative components theoretical frameworks the stuff you need to know”
www.notionparallax.co.uk
Theoretical geometry gives us an infinite universe to work in. There is no concept of up, or of where we are in a finite sense.
To make this work for us, we pick a spot and call it the ‘origin’.
4 | WWW.BENTLEY.COM
The way of describing space that is most common is the Cartesian grid ({X,Y,Z} triples)
The positive part of the Z axis can be considered ‘up’, as is the convention in building design.
5 | WWW.BENTLEY.COM
Thus we have an origin (location) and
3 axes that define… 3 planes that are all at 90 degrees to each other.
(The yellow line indicates the currently active plane).
This is a GC- CoordinateSystem.
6 | WWW.BENTLEY.COM
Almost anything can go into this box.
Single values are easy to understand.
Simple computations are easy, too.
Scientific calculator stuff can be found in the function list.
12 | WWW.BENTLEY.COM
fx
5
5+2
Sin(5)
Value
Simple expression
Function
Almost anything can go into this box.
Single values are easy to understand.
Simple computations are easy, too.
Scientific calculator stuff can be found in the function list.
Compound statements follow BODMAS
13 | WWW.BENTLEY.COM
5
5+2
Sin(5)
Value
Simple expression
Function
Complex expression(1/Sin(5)) + 90
BODMAS
B ( ) Brackets first
O Orders (Powers, Roots)
DM / * Division and Multiplication (left to right)
AS + - Addition and Subtraction (left to right)
Power: xy Pow(x,y) expl. x½ Pow(x,0.5)
Root: x Sqrt(x)
x Pow(x,(1/3))
14 | WWW.BENTLEY.COM
2
3
BODMAS
B Brackets first
O Orders (Powers, Roots)
DM Division and Multiplication (left to right)
AS Addition and Subtraction (left to right)
15 / (3 + 2) = ?
15 / 3 + 2 = ?
(15 / 3) + 2 = ?
15 | WWW.BENTLEY.COM
BODMAS
B Brackets first
O Orders (Powers, Roots)
DM Division and Multiplication (left to right)
AS Addition and Subtraction (left to right)
15 / (3 + 2) = 3
15 / 3 + 2 = 7
(15 / 3) + 2 = 7
16 | WWW.BENTLEY.COM
IN COMPUTING, THERE ARE NEVER TOO MANY ROUND BRACKETS
17 | WWW.BENTLEY.COM
5
5+2
Sin(5)
Value
Simple expression
Function
Complex expression
Named variable
Expression with named variable
(1/Sin(5)) + 90
dave
Once a variable is defined (named) it can take on a value and be used in place of a value.
Dave <> dave
dave = 8
dave*2
This circle’s radius is defined using a single value.
That is how you’d expect it to work from experience.
18 | WWW.BENTLEY.COM
5
This circle’s radius is defined using a list.
Lists are really where the power of GC kicks in.
19 | WWW.BENTLEY.COM
{3,4,4.5,5}
{ , , , , , , }Type‘Curly Brackets’ { }to define a list.
Things in a list are indexed from 0.
Indexing uses ‘Square Brackets’ [ ]
List length counts how many items are in the list, starting with 1 (here it is 5).
20 | WWW.BENTLEY.COM
[0] [1] [2] [3] [4]
Lists can have empty containers (null).
Lists can be of different types.
21 | WWW.BENTLEY.COM
[0] [1] [2] [3] [4]
If we declare a variable called ‘dave’ as a list having the contents {A,B,C,D,E,F,G}
Then we can refer to any item of that list individually by its index.
Remember to count indices from 0.
22 | WWW.BENTLEY.COM
dave = {A,B,C,D,E,F,G} [0] [1] [2] [3] [4] [5] [6]
dave[4] = ?
dave[4] = ‘E’
Point
A point is 0 dimensional.
It has no size, volume, nothing.
We use a symbol for it, so that we can see it.
The Point symbol is different from the CoordinateSystem symbol.
25 | WWW.BENTLEY.COM
Point
Its handles allow moving it using constraints.
Moves can be constrained to the X,Y, and Z axes, respectively.
Using the angular handles moves are constrained to the respective planes.
26 | WWW.BENTLEY.COM
Line
If we have 2 points, there is a line that runs through them.
Strictly, lines are infinite, and line segments are bounded, but common usage refers to bounded segments as lines.
28 | WWW.BENTLEY.COM
BSplineCurve
The math behind splines is complicated, but the geometric description is actually quite easy.
This is one of the reasons why they are used frequently.
30 | WWW.BENTLEY.COM
Solid
There are lots of ways of making solids, but they are the only truly 3d objects in GC, as they have volume.
That is not to say that the rest of the things are not 3d, it is just a technical geometry distinction.
3 > 2 > 1
We can reduce dimensions, too.
Solids intersected with a plane or surface produce a closed curve.
3 > 2 > 1 > 0
Curve to curve intersections produce points.
Be careful of extra points!
Circles and other curves are known for this problem.
3 > 2 > 1 > 0
Curve curve intersections produce points.
Be careful of extra points!
Circles are classic for this problem.
3 > 2 > 1 > 0
Curve curve intersections produce points.
Be careful of extra points!
Or no points!
Circles are classic for this problem.
Almost everything we have seen so far is an object.
Including input variables.
In computing, objects are not equal.
They have Type.
42 | WWW.BENTLEY.COM
dave = 8
Objects have properties
they can be values, or sub-objects
either way, they have a type
the ”dot” operator accesses an object’s properties
Type
some.name = “john” string
some.leftLeg.foot.shoesize = 9.5 double
some.rightLeg.foot.shoewidth = “wide” string
some.carDrivingLicence = true bool(ean)
object property
dot operator
44 | WWW.BENTLEY.COM
Data come in different kinds, like freight on a train.
Each kind of freight requires a matching kind of freight car.
Computers are similarly picky, they only deal with what they have been prepared to handle.
So a type is a kind, a breed, a species, a flavor of data.
46 | WWW.BENTLEY.COM
Object-oriented computing implements the idea that data and their methods, the pieces of program that manipulate these data, are bundled in packages.
The general term for this is Class, i.e. a Class is a data type that includes the methods.
Methods determine how objects behave.
We’ll ignore for now other characteristics of OOPS.
47 | WWW.BENTLEY.COM
“Simple” Variable Types (selection)
bool (Boolean) Answer to a logical question (true, false)
int (integer) Whole numbers (0, 5, -4, 1000, -500)
double Real or decimal numbers(0.5, -7.8 ,15.0, 158.5436)
string Some text (“hello world”, “450”, “dave”)
48 | WWW.BENTLEY.COM
GC Classes = Feature Types (selection)
Point GC’s feature type point
Plane
CoordinateSystem GC’s combination of point, directions, planes
Direction GC’s “ray”
Line
Curve more general than Line, Arc, BSplineCurve
BSplineSurface
Solid
User defined You can define your own feature types
49 | WWW.BENTLEY.COM
50 | WWW.BENTLEY.COM
In GC, classes are called Feature Types.
For GC features the behavior is mostly generative. It is important to us how a feature gets first generated and subsequently updated.
For simplicity, GC calls these methods Update Methods.
51 | WWW.BENTLEY.COM
Each Update Method has its specific inputs.
How do we know what to enter in each input box?
inputName: type
What is (repl.)?
What is an “IPoint”?
This circle’s radius is defined using a list.
1 radius 1 circle
4 radii 4 circles
= replication
(repl.) = replicatable53 | WWW.BENTLEY.COM
{3,4,4.5,5}
55 | WWW.BENTLEY.COM
{2,4,6,8}
2
XTranslation: double (repl.)
YTranslation: double (repl.)
[0] [1] [2] [3] [0] [1] [2] [3]
56 | WWW.BENTLEY.COM
{2,4,6,8}
{2,4,6,8}
XTranslation: double (repl.)
YTranslation: double (repl.)
[0] [1] [2] [3] [0] [1] [2] [3]
[0] [1] [2] [3]
57 | WWW.BENTLEY.COM
{2,4,6,8,10,12}
{2,4,6,8}
XTranslation: double (repl.)
YTranslation: double (repl.)
[0] [1] [2] [3] [4] [5] [0] [1] [2] [3]
[0] [1] [2] [3]
ReplicationOption.CorrespondingIndexingToggle Replication
58 | WWW.BENTLEY.COM
{2,4,6,8,10,12}
{2,4,6,8}
XTranslation: double (repl.)
YTranslation: double (repl.)
[0] [1] [2] [3] [4] [5] [0][0] [1] [0] [2] [0] [3] [0] [4] [0] [5] [0]
[0] [1] [2] [3]
ReplicationOption.AllCombinations
[0][1] [1] [1] [2] [1] [3] [1] [4] [1] [5] [1]
[0][2] [1] [2] [2] [2] [3] [2] [4] [2] [5] [2]
[0][3] [1] [3] [2] [3] [3] [3] [4] [3] [5] [3]
Toggle Replication
Observations:
As in the geometry itself, there is dimensionality in the data, too.
1 singleton Point 0d
1 repl. parameter 1d
2 repl. parameters AND CorrespondingIndexing 1d
2 repl. parameters AND AllCombinations 2d
3 repl. parameters AND AllCombinations 3d
n repl. parameters AND AllCombinations nd
59 | WWW.BENTLEY.COM
Observations:
Lists use nested Curly Brackets {} to indicate dimensionality of their nesting (property: List.Rank).
0d a1
1d {a1,a2,a3}
2d {{a1,a2,a3},{b1,b2},{c1,c2,c3,c4}}
3d {{{a1,a2,a3,a4,a5},{b1,b2}},{{{c1,c2,c3},{d1,d2,d3,d4,d5,d6}},{{{e1},{f1,f2},{g1,g2,g2}},{{{h1,h2,h3,h4},{i1,i2,i3},{j1,j2}}}
60 | WWW.BENTLEY.COM
Object-oriented computing is very strict about membership in a class or feature type.
However, you can sometimes stuff one data type into another slot (casting) but the type is generally a good hint as to what is required.
There are some specific casting functions.
In GC, casting works only for simple variable types, not for feature types.
62 | WWW.BENTLEY.COM
Interfaces draw on similar properties and methods of feature types to let us use one feature type in place of another one.
This softens the class boundaries for more flexible modeling options.
Interfaces are prefixed with an “I”.
63 | WWW.BENTLEY.COM
Plane is like a Point because of X,Y,Z location.
CoordinateSystem is like a Point because of X,Y,Z location.
Plane is like a Direction because of Plane’s normal vector.
Etc.
64 | WWW.BENTLEY.COM
Generally we are much less interested in numeric descriptions of where things are, and how big they are.
We are much more into relationships.
The coffee is constrained in the cup.
66 | WWW.BENTLEY.COM
image: Ben Doherty @ notionparallax.co.uk
In a normal CAD program, even if we put the coffee in the place that is inside the cup, it’s just numerically defined as being there.
If we move the cup then the coffee remains where it was placed initially, partially or entirely outside the cup.
67 | WWW.BENTLEY.COM
image: Ben Doherty @ notionparallax.co.uk
68 | WWW.BENTLEY.COM
image: Ben Doherty @ notionparallax.co.uk
In a relational system, when we move the cup, the coffee moves.
In a relational system we
build
relationships and behaviors.
i.e. relations and dependencies not one-off specifics.
Cartesian space
Unless you are a quantum physicist or a theoretical mathematician, 3dimensional Cartesian space is all you will ever need (almost).
Descartes added the orthogonal coordinate system to the principled Euclidian space.
70 | WWW.BENTLEY.COM
In Euclidian space (originally defined in 2d space, i.e. on a plane, eg. a sheet of paper) there are straight lines that can be parallel.
In non-Euclidian space (eg.the surface of a sphere), Euclidian rules do not apply, for example, there are no straight lines (but arcs, circles, curves).
71 | WWW.BENTLEY.COM
72 | WWW.BENTLEY.COM
On the surface, Euclidian (top) and non-Euclidian (bottom) 2d “spaces”.
In 3d, these are curved surfaces, which would peacefully coexist or intersect with any straight lines through space…
Parameter Space
This is an embedded space.
From within the line the universe only extends as far as the end of the line.
This space is defined as 1 unit (of self), regardless of its size externally.
The parameter is the T value
73 | WWW.BENTLEY.COM
Line.StartPoint T = 0.0
Line.EndPointT = 1.0
T = 0.35
While on a Line the T-parameter space is homogenous, this is not the case for BSplineCurves.
T = 0.5 is not necessarily the geometric centre, it is the parametric centre.
Parametric distances between control points are equal, if they are equally weighted…
74 | WWW.BENTLEY.COM
T = 0.25 T = 0.5
T = 0.75
T = 0.0
T = 1.0
The analog is true for surfaces, with the 2d parameter space being a 1 by 1 “square”.
Instead of the Cartesian 3d XYZ coordinates they are 2d UV coordinates.
75 | WWW.BENTLEY.COM
U = 0
.0
U = 1
.0
U = 0
.0
U = 1
.0V = 0.0
V = 1.0
A UV coordinate tuple {0.2, 0.7} can be sampled into an XYZ coordinate triplet {x,y,z}, for example by placing a Point.ByParametersOnSurface().
One way to think about how UV parametric space deals with distortion is to draw a grid on a balloon and then blow it up & squeeze it about a bit. The grid changes shape, but the relationships (topology) stay the same.
76 | WWW.BENTLEY.COM
U = 0
.0
U = 1
.0
U = 0
.0
U = 1
.0V = 0.0
V = 1.0
UV = {0.2,0.7}XYZ = {70,30,3.969}
There are also update methods using cylindrical or spherical coordinate systems.
These are handy for cylindrical and spherical things, but also for survey data.
77 | WWW.BENTLEY.COM
By using parallel representations of your geometry it’s possible to build control rigs, analysis dashboards, alternative models that exhibit different behaviors, like fabrication models, etc.
79 | WWW.BENTLEY.COM
T = x
Radius = x * val
Splines are very ‘cool’, but they are not easily buildable; therefore, contractors and manufacturers are a bit worried about them.
Splines were developed independently by a pair of French automotive engineers – Pierre Étienne Bézier at Renault and Paul de Casteljau at Citroën – working on early CAD systems back in the 1960s.
They take some understanding to do them right!
81 | WWW.BENTLEY.COM
2
3
4
5
The order of a B-spline refers to how many control points each segment looks to for it’s shape, i.e. the minimum number of points for a B-spline of degree (order - 1).
An order 2 B-spline is a straight line (degree 1).
The degree of a B-spline indicates the highest exponent in the system of equations.
These diagrams explain the construction of Bezier curves.
82 | WWW.BENTLEY.COM
lineardegree = 1order = 2
quadraticdegree = 2order = 3
cubicdegree = 3order = 4
quadricdegree = 4order = 5
P0
P1
P0
P1
P2
P0
P1
P2
P3
P0
P1
P2
P3
P4
Q0
Q1
Q0
Q1
Q2
Q0
Q1
Q2
Q3
R0
R1
R0
R1
R2
S0S1
t’
t’
t’
t’
t’
t’
t’
t’
t’
t’
t’
t’
t’t’
t’
t’
The third order spline is tangent to all of the segments of the control frame.
4th and 5th are less easy to visualize in their construction.
83 | WWW.BENTLEY.COM
2
3
4
5
MANY THANKS TO
Ben Doherty at notionparallax.co.ukfor the idea & approach, > 65% of text, some imagery, etc.
86 | WWW.BENTLEY.COM