I want to make a body by rotating of this function in a script:
(ln( ((v*pi)/1)-(pi/2) ) *(1/pi)+3)*sin(u)
(ln( ((v*pi)/1)-(pi/2) )*(1/pi)+3)*cos(u)
Are there any examples how I can do this?
Your Animation Nodes Node Setup would look like this:
Basically it takes a generated grid mesh and deforms it with your functions to your 3D object which also gets constructed at the end. I used Math Nodes everywhere, but if you find out how you could use expressions or phython scripts to do that. The problem which I faced with expressions was the type being a list. Math Nodes handle that automatically so you dont have to worry about that. The generated Object would look like this:
For Python scripting, you might look first at Spin mesh (to create solid of revolution)
Then with your formulae, observe the x and y are of the form
x = r * sin, y = r * cos
with r as function of v --- r(v) = (ln( ((v*pi)/1)-(pi/2) ) *(1/pi)+3)
So build a 'mesh' of single joined lines, say in the y, z plane.
To get the vertices (0,y,z), pick a series of z values and find the y's
y = r(v) same here as y = r(z).
Then use spin() to get your body of rotation.
You will see a lot of options for this operator also
z. But just pasting the terms you stated in your question doesn't work:
There is an error because there are 3 things wrong with you python code:
V minvalue in the options of the Add XYZ Math Surface operator cannot be set to a number greater 0 so we have to hack a bit:
The solution is to use a helper function in which
v is checked if it is greater than
0.5. If not, the helper function will set the result to 0. In the following image you can see all the options used to plot