Generate geometry based on mathematical formulas

mathematica
dynamo
revit

#1

Hello there!
I am new to Dynamo and atm am trying to learn how to generate geometry based on mathematical formulas. As reference I am using a book called “Morphing: A Guide to Mathematical Transformations for Architects and Designers” and in it different shapes and curves are explained through math formulas and functions.
My question is how do i implement them in Dynamo and Revit. I have tried the Math section (where I believe my answer lies) but to no avail. No doubt it’s due to my lack of knowledge of the program and syntax, but I would really appreciate some help.
I am attaching a random page from the book so you can see what exactly the format is.
Thanks in advance !

EDIT:
I realized the photo is of too poor a quality to read the fine print so these are the lines under the last scheme (I assume the others have a similar method)
{ (u,v) | 0<=u>=2pi, 0<=v>=pi }

x= ((13/10) +sin(u))cos(v)
y=(2/3cos(u)+((13/10)+sin(u))sin(v)
z= sin(100v)/100-sin(3u)/10+cos(u)


#2

You could first take a look at the example files:
http://dynamoprimer.com/en/Appendix/A-4_example-files.html
There are several packages that would help to meet your goal, such as DynaShape for instance:


See also:
http://dynamoprimer.com/en/Appendix/A-3_packages.html
Lastly, someone shared this interesting link here once:


#3

@Yna_Db thanks for the quick reply.
I based my efforts on this particular section of the primer
http://dynamoprimer.com/en/04_The-Building-Blocks-of-Programs/4-2_math.html
although I understood the basic idea behind it, but this completely eludes me
"{ (u,v) | 0<=u>=2pi, 0<=v>=pi }".
I will keep looking through the Primer examples you linked and will definitely check out that package

and thanks for the maths link


#4

Where does this come from? I don’t see it on the page you mentioned.
It looks that u and v values will be comprised between 0 and 2pi, and 0 and pi, but I would rather have used <= only for that, I would be curious to see that in its context


#5

They are but I think I’m comprising my values the wrong way cause I can’t use them after for my formulas (sorry if this description is a bit unclear)


#6

Ah, OK, I see. I have to leave now but quickly, as I said, I would rather try this way:
0<=u<=2pi, 0<=v<=pi
because as it’s written, it looks like a contradiction.
I am sure someone else will help with it…


#7

I’m not sure if Dynamo’s geometry kernel can handle self-intersecting surfaces like the ones in the pictures. The x,y, z formulas describe the basic shape. You then have to apply additional shearing and reversing of the individual “layers” of points to get the end result:

I had to generate each “band” of the surface separately, otherwise the Surface.ByLoft node would fail.


#8

It is exactly that… I thought something looked funny but it was really late and I dismissed it lol
Will give it a fresh go today with your suggestion

@Dimitar_Venkov
Thank you so much! I will look at your code more carefuly when i open up dynamo and will try to figure out the other shapes in a similar manner. only question i have is about the last two lines of the first code block ( the second more than the first actually) but i think they will clear up once i try it your way and see what they do


#9

Gave this a try, very similar to the above example by @Dimitar_Venkov
Just a little variation towards the end

u = 0..360..#10;
v = 0..180..#10;

x = ((13/10) + Math.Sin(u))*Math.Cos(v);
y = ((2/3)*Math.Cos(u))+((13/10)+Math.Sin(u))*Math.Sin(v);
z = Math.Sin(100*v)/100-Math.Sin(3*u)/10+Math.Cos(u);

p = Point.ByCoordinates(x,y,z);
c = NurbsCurve.ByPoints(p);

d = c.Rotate(Point.Origin(),Vector.ByCoordinates(0,0,1),0..360..2);
e = List.DropItems(List.Sublists(d,0..1,1),-1);

f = Surface.ByLoft(e);
g = Solid.ByJoinedSurfaces(f);

#10

@h.hristov31

If you want a whole form try with u an v with the same range.