4
$\begingroup$

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?

$\endgroup$
  • 2
    $\begingroup$ Please use the search function first. You have a parenthesis mismatch. I have not figured out how to use log with this addon. $\endgroup$ – Leander Jun 4 '18 at 9:47
  • $\begingroup$ As it stands, your expressions have mismatched brackets - (e.g. the right bracket just before +3 in the X equation) - so they are ambiguous .. $\endgroup$ – Robin Betts Jun 4 '18 at 9:47
  • 1
    $\begingroup$ try animation nodes. I already tried it and it works for this type of things. $\endgroup$ – HenrikD Jun 4 '18 at 10:02
  • $\begingroup$ @Hen Would you mind writing that into an answer with easy to follow steps how one could create this mathematical surface? $\endgroup$ – Leander Jun 4 '18 at 10:59
  • $\begingroup$ @Leander I am currently not at my PC but in 3h I could do that. $\endgroup$ – HenrikD Jun 4 '18 at 11:15
1
$\begingroup$

Your Animation Nodes Node Setup would look like this:

Node Setup

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:

LogCylinder

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

Add an XYZ Math Surface

With the addon Add Mesh: Extra Objects enabled, you can add with Add > Mesh > Math Function > XYZ Math Surface lots of different mathematical surfaces.how to add

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:error There is an error because there are 3 things wrong with you python code:

  1. The python function for the natural logarithm $\ln$ in Blender is log(), not ln()
  2. As @Leander pointed out there is a paranthesis mismatch. In this explanation I will just assume that closure of the first "(" is on the very end of each term.
  3. $\ln(x)$ is not defined for values of $x<0$. Your code without sine/cosine part in maths is $\frac{1}{\pi}\ln(\frac{v\pi}{1}-\frac{\pi}{2})) +3$ or simplyfied $\frac{\ln(\pi(v-0.5))}{\pi} +3$. Here we easily spot that we have to prevent $v$ from being less or equal than $0.5$, because otherwise the $\ln$ is undefined and an error will be raised. Unfortunately the 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

result

$\endgroup$
  • $\begingroup$ I never knew Math Function exists and I am seeing Mechanical beneath. I will explore them today. Thank you for posting this. $\endgroup$ – Rita Geraghty stands by Monica May 13 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.