I want to make a body by rotating of this function in a script:
Function
X equation
(ln( ((v*pi)/1)-(pi/2) ) *(1/pi)+3)*sin(u)
Y equation
(ln( ((v*pi)/1)-(pi/2) )*(1/pi)+3)*cos(u)
Z equation
v
Are there any examples how I can do this?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.
Sign up to join this communityI 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)
v
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.
With the addon Add Mesh: Extra Objects enabled, you can add with Add
> Mesh
> Math Function
> XYZ Math Surface
lots of different mathematical surfaces.
You will see a lot of options for this operator also x
, y
and 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:
log()
, not ln()
V min
value 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