MoI discussion forum
MoI discussion forum

Full Version: [script] FxGraph - 2D/3D Function plotter

Show messages:  1-2  3-22  23-42  43-62  63-82  83-91

From: bemfarmer
20 Jan 2014   [#3]
Superb script MAX !
Just assigned it to my SHIFT+F shortcut.

This script replaces a bunch of one-shot scripts.
It can create an unbounded number of curves.
It uses the fast method of scripting mostly in .htm file.
Other math functions could be added. Maybe for a catenary? Have to investigate the math, it uses hyperbolic trig, or exponentials.

? If a version were created for a U parameter, nested with a V parameter, it might do 3d curves ?

Do not know if it would do integration or differentiation? i.e Euler spiral?

- Brian
From: bemfarmer
20 Jan 2014   [#4]
exp(x) give an "unknown command" error.

Edit: pow(x,2) works. (n needs to be a number:-), (pow(x,n) is not a correct entry)

log(x) works for minX = 0

- Brian
From: Max Smirnov (SMIRNOV)
20 Jan 2014   [#5] In reply to [#4]
Thank you! :)

Frenchy Pilou (PILOU)
>> Waiting the 3D!
Not now. It was in the beta version of this script, but I haven't finished it.

Brian
>> exp(x) give an "unknown command" error
fixed

>>pow(x,2) works
pow(2,x) and pow(x,x) also works perfectly

>> log(x) works for minX = 0
I set "x=minx+1/10e8" because of "Unexpected condition error" with y=1/x function. For example, y=x/0 correctly works (infinity message appears). I don't know why..

>>If a version were created for a U parameter, nested with a V parameter, it might do 3d curves ?
Yes, I think so.
From: bemfarmer
20 Jan 2014   [#6]
Thankyou Max

Formula for a catenary: y = 2 * (exp(x/2) + exp(-x/2))/2

A more general formula is avalue * (exp(x/avlaue) + exp(-x/avalue))/2
But in this case, avalue is just a scaling factor, so by using Scaling in MoI, the avalue is changeable.
For example doing a Scaling of 4, on a pre-created catenary, changes the avalue=2 to avalue = 8.

It might be nice to have a few parameters like avalue, bvalue ... ?

I should have referred to using U and V as creating a series of 3d curves which might be loft-able to a surface or solid.

- Brian
From: bemfarmer
20 Jan 2014   [#7]
Tried out version 1.1 a little. Looks good.

I suspect a version depending upon a rotational parameter t or theta,
with x = some function of t,
and y = some function of t,
would be possible?

- Brian
From: Frenchy Pilou (PILOU)
21 Jan 2014   [#8] In reply to [#5]
<<< y=x/0 correctly works (infinity message appears)

Seems normal, no ? ;)
If the language has not an automatically barrier for impossible operation!
From: Max Smirnov (SMIRNOV)
21 Jan 2014   [#9] In reply to [#7]
The script has been updated with a new R(t) function.
xy(t) is possible. I'll think about it.
From: Frenchy Pilou (PILOU)
21 Jan 2014   [#10]
Tricky the fact to use variables!


From: Michael Gibson
21 Jan 2014   [#11] In reply to [#9]
This is really cool Max, to have a more general purpose curve constructor that can be used for a lot of different possible formulas!

- Michael
From: wastzzz
21 Jan 2014   [#12]
Epic, funny and useful! Thank you.
From: Max Smirnov (SMIRNOV)
22 Jan 2014   [#13]
v1.2d
- [Added] R(t)3D mode. Add ^ symbol at the beginning of a R(t) formula to draw 3D graph.

^pow(t,a)/pow(10,2*a-2);-100;100;500;3

From: Frenchy Pilou (PILOU)
22 Jan 2014   [#14] In reply to [#13]
Born of the 3D world! ;)


From: Max Smirnov (SMIRNOV)
6 Sep 2014   [#15]
This is my new script - FxGraph3D which allows drawing 3D parametric surfaces.
x = X(u,v), y = Y(u,v), z = Z(u,v), where u,v are the parametric domain parameters.




Here is some interesting parametric equations.
http://msenux.redwoods.edu/Math4Textbook/Plotting/ParametricSurfaces.pdf
From: Michael Gibson
6 Sep 2014   [#16] In reply to [#15]
Very cool Max!

- Michael
From: wastzzz
7 Sep 2014   [#17] In reply to [#15]
Thank you!
From: Max Smirnov (SMIRNOV)
7 Sep 2014   [#18]
Version 1.0
Changes since 0.6:
[fixed] some bugs
[added] Command line parameters support. Click X(u,v), Y(u,v) or Z(u,v) label to copy values to the clipboard.

Examples:
_FxGraph3D (u);(v);rnd;-10;10;-10;10;10;15;;;;U
_FxGraph3D u*a+rnd-0.5;v*b+rnd-0.5;rnd*c-c/2;-10;10;-10;10;50;50;2;2;40;P
_FxGraph3D 2*(1-exp(u/(6*pi)))*cos(u)*cos(v/2)*cos(v/2);2*(-1+exp(u/(6*pi)))*sin(u)*cos(v/2)*cos(v/2);1-exp(u/(3*pi))-sin(v)+exp(u/(6*pi))*sin(v);0;20;0;6.283185307179586;50;50;;;;V
_FxGraph3D (2+v*sin(u))*sin(2*pi*v);v*cos(u);(2+v*sin(u))*cos(2*pi*v)+2*v-v;0;3.14;0;1.3;50;50;;;;V
_FxGraph3D sin(u);cos(u);u*u/300;0;60;0;1.3;100;0;;;;V

Michael, Thank you!
From: jotero (TOROLF)
7 Sep 2014   [#19]
Hello all :)

It's nice and what do do with the curves?

X():cos(2*u)*cos(v) + 1.0 *cos(u)
Y():sin(v)
Z():-sin(2*u)*cos(v) + 1.0*sin(u)

[u]:0, 2*pi
[v]:0, 2*pi

And how do I get now to my mathematical NURBS model...?

http://imaginary.org/gallery/k3dsurf

Cu
Torolf
From: Frenchy Pilou (PILOU)
7 Sep 2014   [#20]
Cool!
French version ; ) http://moiscript.weebly.com/fx-graph-3d.html


From: bemfarmer
7 Sep 2014   [#21]
Very nice script!

Fermat Spiral:
_FxGraph3D a*c*sqrt(v)*cos(v);b*c*sqrt(v)*sin(v);0;0;1;0;6.283185307179586;0;50;1;1;1;UV

This can be pasted to the command window in Moi.
1. Highlight and CTRL-C the entire Fermat Spiral equation line above, _FxGraph3D...;UV
2. In Moi, press TAB key, and CTRL-V paste, then press Return. Voila

The a, b, and c values will scale the curve.
A negative c will rotate the curve.
A negative a and positive b will Mirror the curve.
a, b, and c are not really needed, as Moi can do these actions already.

- Brian

I just did a Fermat Spiral script, but can now delete it :-)
Or add some bells and whistles.


Image Attachments:
FermatYinYang.PNG 


From: Max Smirnov (SMIRNOV)
7 Sep 2014   [#22]
Sphere
_FxGraph3D cos(u)*cos(v)*a;sin(u)*cos(v)*b;sin(v)*c;0;6.283185307179586;-1.5707963267948966;1.5707963267948966;50;50;1;1;1;V

Torus
_FxGraph3D cos(u)*(cos(v)+a/b)*b;sin(u)*(cos(v)+a/b)*b;sin(v)*b;-3.141592653589793;3.141592653589793;-3.141592653589793;3.141592653589793;50;50;20;10;;UV

Spiral
_FxGraph3D cos(u/c)*(cos(v)+a/b)*b;sin(u/c)*(cos(v)+a/b)*b;sin(v)*b+u;0;50;0;6.283185307179586;100;20;10;3;2;UV

Conic Spiral
_FxGraph3D cos(u)*(u/(a*pi)*cos(v)+b)*c;sin(u)*(u/(a*pi)*cos(v)+b)*c;u*sin(v)/(a*pi)*c;0;9.42477796076938;0;6.283185307179586;100;20;1.5;5;1;U

Knot
_FxGraph3D cos(u)*cos(v)+c*cos(u)*(b+sin(u*a)/2);sin(u)*cos(v)+c*sin(u)*(b+sin(a*u)/2);sin(v)+2*cos(a*u);0;18.84955592153876;0;6.283185307179586;300;10;1.666666;2;3;UV

Dini's Surface
_FxGraph3D cos(u)*sin(v);sin(u)*sin(v);cos(v)+log(tan(v/2))+a*u;0;12.566370614359172;0.1;2;300;10;0.3;;;U

Enneper surface
_FxGraph3D u*cos(v)-pow(u,2*a-1)/(2*a-1)*cos((2*a-1)*v);-u*sin(v)-pow(u,2*a-1)/(2*a-1)*sin((2*a-1)*v);2/a*pow(u,a)*cos(a*v);0;1.2;0;6.283185307179586;50;27;4;;;UV

Show messages:  1-2  3-22  23-42  43-62  63-82  83-91