# How to mathematically describe complex geometry?

Hello everyone!

I found an interesting design on Instagram profile called @architectura da jarano (has a lot of cool stuff) and went about to try to recreate it in Dynamo, but I quickly realized that my knowledge of geometry and math is insufficient for something like that. Anyhow here is the picture:

Could someone give me tips how to go about something like that? Is Dynamo even the right tool for something like that? Or maybe some inputs on material and literature where I could learn how to mathematically describe complex geometry?

My idea was to create such a curved surface, then to use Surface.PointAtParameter Node to create Points and then to use those Points as centres of the cubes, but I fail at the first step. I do not know how to describe such a surface mathematically and parametrically.

The end goal is to create a solid that has this kind of a surface as the outher shell.

HI
yes dynamo can deal with geometry very good, you could start learning from dynamo primer. also watch videos for this it could help

for mathematical section, as we know every shape has a one or combined math equations, you have to have a good knowledge of equations shapes. then you can decide what to use in xyz 2D, 3D plans.

see this topic it could help

also there is a good website i use that help me in giving exact values for the equations i use

3 Likes

This is a great starting point for learning the key concepts.

4 Likes

You donâ€™t have to mathematically describe geometry like that, quite often they are built off controllable curves and a surface formed from them. Some cases however, they are indeed described mathematically via a function, but you can often achieve some measure of the equivalent with OOTB nodes and a more Euclidean approach (this is the beauty of Dynamo/GH - you donâ€™t NEED to know the maths).

However, if you still want to learn the underlying maths, at least the basics (nothing wrong with that, in fact I encourage itâ€¦ one of the reasons I went back to uni) then I second @simon_murphy1 with the Essential Mathematics for CD, it has a lot of great explanations in there and will certainly improve your understanding of geometry and manipulation. Vector math is your friend right off the bat, and understanding curve (t) and surface domains (u, v) for subdividing.

2 Likes

As @Daniel_Woodcock1 mentioned above, you donâ€™t really need complicated math, but you can if you want to

Take the British Museum Great Court Roof as an example â€¦

Refering to The analytic and numerical definition of the geometry of the British Museum Great Court Roof by Christopher J K Williams it can be generated mathematically like this

BritishMuseumGreatCourtRoof-1.dyn (6.7 KB)

``````def z (x:var[]..[], y:var[]..[])
{
a = 22.245;
b = 36.625;
c = 46.025;
d = 51.125;

//Î»
lm = 0.5;

//ÎĽ
mu = 14.0;

hcen = 20.955;
hedg = 19.71;
r = Math.Sqrt(Math.Pow(x,2)+Math.Pow(y,2));

//Î¸
the = Math.Asin(y/r);

//Î·
eta = (1-(x/b)) * (1+(x/b)) * (1-(y/c)) * (1+(y/d))/
(1-((a*x)/(r*b))) * (1+((a*x)/(r*b))) * (1-((a*y)/(r*c))) * (1+((a*y)/(r*d)));

//Î¨
psi = (1-(x/b)) * (1+(x/b)) * (1-(y/c)) * (1+(y/d));

//Î±
alp = ((r/a)-1) * psi;

//Î˛
bet = (1-(a/r))/
(((Math.Sqrt(Math.Pow(b-x,2) + Math.Pow(c-y,2))) / ((b-x)*(c-y))) +
((Math.Sqrt(Math.Pow(b-x,2) + Math.Pow(d+y,2))) / ((b-x) * (d+y))) +
((Math.Sqrt(Math.Pow(b+x,2) + Math.Pow(c-y,2))) / ((b+x) * (c-y))) +
((Math.Sqrt(Math.Pow(b+x,2) + Math.Pow(d+y,2))) / ((b+x)*(d+y))));

z1 = ((hcen - hedg)*eta) + hedg;
z2 = alp * (((1-lm)*(((35.0+(10.0*psi))*0.5*(1+Math.Cos(2*the)))+(12.0*(0.5*(1-Math.Cos(2*the))+Math.Sin(the)))+((7.5+(12.0*psi))*(0.5*(1-Math.Cos(2*the))-Math.Sin(the)))-1.6))
- ((5.0*(1+Math.Cos(2*the)))+(10.0*(Math.Pow((0.5*(0.5*(1-Math.Cos(2*the))+Math.Sin(the))),2))*(1.0-(3.0*alp))))
+ (2.5*(Math.Pow((0.5*(0.5*(1-Math.Cos(2*the)-Math.Sin(the)))),2))*(Math.Pow(((r/a)-1),2))));
z3 = bet * ((lm*((1.75*(1+Math.Cos(2*the)))+(1.5*(1-Math.Cos(2*the)))+(0.3*Math.Sin(the))))
+ (1.05*(Math.Pow(Math.E,-mu*(1-(x/b)))+Math.Pow(Math.E,-mu*(1+(x/b))))*(Math.Pow(Math.E,-mu*(1-(y/c)))+Math.Pow(Math.E,-mu*(1+(y/d))))));
return = z1 + z2 +z3;
};

x =-36.6..36.6..#30;
y = -51.125..46.025..#30;
p = NurbsSurface.ByPoints(Point.ByCoordinates(x<1>,y<2>).Translate(Vector.ByCoordinates(0,0,z(x<1>,y<2>)))).Trim(Plane.ByOriginNormal(Point.ByCoordinates(0,0,19.71),Vector.ZAxis()),Point.Origin());
``````

However, a decent approximation of the same can be quickly achieved without any math like this â€¦

BritishMuseumGreatCourtRoof-2.dyn (7.4 KB)

``````cen1 = Circle.ByCenterPointRadius(Point.Origin(),15);
edg1 = Rectangle.ByWidthLength(73,97).Translate(Vector.YAxis(),3);
pnt1 = (edg1.Explode())<1>.PointAtParameter((0..1..#10)<2>);
pnt2 = cen1.ClosestPointTo(pnt1);
pnt3 = Line.ByStartPointEndPoint(pnt1,pnt2).PointAtParameter(0.5).Translate(Vector.ZAxis(),6);
pnt4 = List.Transpose(Arc.ByThreePoints(pnt1,pnt3,pnt2))<1>.PointAtParameter((0..1..#10)<2>);
pnt5 = Point.PruneDuplicates(List.Flatten(pnt4<1>,-1),0.001);
srf1 = Surface.ByLoft(List.AddItemToFront(edg1,List.RestOfItems(NurbsCurve.ByControlPoints(pnt5,3,true))));``````
4 Likes

Ha, that roof is actually the roof that convinced me to go do my degreeâ€¦ Its just gorgeous. I remember seeing this in a magazine and decided I wanted to learn more about geometry and maths.

But as you can see @Vikram_Subbaiah does an awesome job at approximating the surface with barely any code when compared to the mathematical version. Bloody good effort codeblocking the maths Vikram! Soooo, not knowing all the math doesnâ€™t mean you canâ€™t create some awesome stuff!

2 Likes

Hey,

Hereâ€™s something you might find funâ€¦ Itâ€™s one of my Dynamo training graphsâ€¦ Just a bunch of unconstrained points arranged in a grid.

It is a silly example, but is shows how you can do some form finding with Dynamo.

If you hit the graph into background mode and automatic, youâ€™ll see the nodes go red, then you can click on them and drag them around.

Obviously youâ€™d never use this in quite this manner, but combining it with a more conventional set of nodes and code might be useful.

Hope that helps,

Mark

NURBS Surface By Points.dyn (171.2 KB)

5 Likes

You neednâ€™t create a surface. A grid of points distorted with attractors should do.
Here is a start. You might want to refine it.

gmtry.dyn (41.5 KB)

3 Likes

Nice! Thanks a bunch

1 Like