DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« on: January 15, 2012, 06:10:04 PM » |
|
Hi there, I found this thingy http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page7.htmlIt opens an interesting question to me, hope you are able to find the answer. In Mandelbulb, routines must be calculated pixel by pixel. So we can manipulate x,y,z and the next iter will compute the function with those new values for x,y,z. Okay! In DIFS mode, that is awesome, I can define a function R, that defines the estimation of the distance from the surface of the fractal of the given pixel. How do I find such a distance in the case of the knot? Inverting the relationships is not easy because it is not a "function" so distance is not unique I think. I need to find the minimum distance of course... Any idea (For example ok, tan(2*t) = y/x but atan() is not unique. Same goes for asin(z/R) ) Direct relationship Point (x,y,z) belongs to the "knot" if it is one of those infinitely ^2 many points; For 0<t<2pi and 0<R<1.5; (for example) (or in alternative, -pi<t<+pi) x=R*cos(2*t) * (3 - cos(3*t)) y=R*sin(2*t) * (3 - cos(3*t)) z=R*sin(3*t) problem; How can I check if a point (x,y,z) belongs to the knot?Better; Given a point (x,y,z) find the minimum possible positive value for R that satisfies the relationship using an efficient algorythmDon't post approximate solutions like calculate the direct relationship 200 times and see what's the nearest point, because it is not really good... Thanks
|
|
« Last Edit: January 18, 2012, 10:19:34 AM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
David Makin
|
|
« Reply #1 on: January 15, 2012, 09:05:16 PM » |
|
Given the method for standard DE for Mandys and Julias I'd guess an analytical method using the derivatives may provide a solution ? You have x = f(t), y= g(t) and z = h(t) therefore I'd guess something involving f', g' and h' might help ? Of course the best solution to your problem which I presume is rendering 3D knots is not to test if a point is on the knot or to get the minimum distance to a point on the knot but rather to intersect a viewing ray directly with the knot, i.e. find (the smallest positive) a in (x0,y0,z0)+a*(dx,dy,dz) = ( R*cos(2*t) * (3 - cos(3*t)), R*sin(2*t) * (3 - cos(3*t)), R*sin(3*t) ) given x0,y0,z0 and dx,dy,dz. I'd guess there is a very quick way to render 3D knots given the quantities of such images (and animations) that Jos Leys has produced http://www.josleys.com/articles/ams_article/Lorenz3.htmhttp://www.josleys.com/show_gallery.php?galid=306http://www.josleys.com/show_gallery.php?galid=303Unfortunately they aren't something I've looked into - as is probably obvious from this reply
|
|
« Last Edit: January 15, 2012, 09:17:07 PM by David Makin »
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #2 on: January 15, 2012, 10:44:27 PM » |
|
David I am wondering a simpler method, there must be Let us take a torus. Distance from a torus is; pow(sqr(sqrt(xx + yy)-R1)+zz-R2, something) if xx is sqr(x) and so on So if i juggle a bit with this I can get many things first of all using min and max instead of powers and roots gives us a squared tube. I think that with a poly fold and a twist factor a knot will pop up The reference plane is defined by; sqrt(xx+yy) and z. Rotations and folds must act in this plane. atan2(y,x) is the planar angle useful for 3d twists like mobius strips and knots Will check more tomorrow cheers!
|
|
« Last Edit: January 15, 2012, 10:52:26 PM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #3 on: January 16, 2012, 11:23:16 AM » |
|
The torus is done, with dIFS is easy to create crazy combinations.
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #4 on: January 16, 2012, 11:30:04 AM » |
|
Four flavours of torus Sorry for the flood but I can't enclose more than one image per post :
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #5 on: January 17, 2012, 06:01:11 PM » |
|
I've completed the routine! Whew very hard to find the correct one. It needs a torsion factor; Tfactor = (a + b/polyfoldOrder) * atan2(y,x) x := sqrt(x^2+y^2)-R1 Rotate(x,z,Tfactor) Then ... another angle; Angle = (pi/2 - atan2(x,z)) * polyfoldOrder / twopi Angle = roundInt(angle) Angle = Angle / polyfoldOrder * twopi Rotate(x,z,Angle) x = x + R3 ... plus other things or it does not work. Anyway some plots enclosed. It plots very fast btw
|
No sweat, guardian of wisdom!
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #7 on: January 17, 2012, 07:35:23 PM » |
|
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
Syntopia
|
|
« Reply #8 on: January 17, 2012, 08:43:20 PM » |
|
Yes, very impressive, DarkBeam!
I tried to implement your formula, but there are many parameters... What should the params for R1,R3,a,b, and polyfoldOrder be for something like the upper left corner picture?
And, indeed, what is a polyfold? A search on Wikipedia took me to some frightening places discussing symplectomorphisms and Floer homologies...
|
|
|
|
bib
|
|
« Reply #9 on: January 17, 2012, 08:43:41 PM » |
|
Cool!! But are these done in M3D? If yes, where is the m3f ?
|
|
|
Logged
|
Between order and disorder reigns a delicious moment. (Paul Valéry)
|
|
|
|
lycium
|
|
« Reply #11 on: January 18, 2012, 12:10:57 AM » |
|
DE for a trefoil knot?! i too am impressed, great work luca
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #12 on: January 18, 2012, 09:49:31 AM » |
|
|
|
« Last Edit: January 18, 2012, 11:05:01 AM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #13 on: January 18, 2012, 10:07:26 AM » |
|
// we modify copies of the variables not the variables ;) x = Vec.x; y = Vec.y; z = Vec.z; // try any + or - integer for a & b. Neg values change the handedness // If you are greedy use only b and set a = 1. Less user friendly btw Mobius = (a + b/polyfoldOrder) * atan2(y,x) x := hypot(x,y)-R1 // from now on we will not use y anymore - act on z-rho section Rotate(x,z,Mobius) // now do the magic polyfold. But polyfoldOrder must be integer too! // I stole this transform from PolygonalBarnsleym in sam.ufm ! It generates those kaleidoscope things with ease Angle = (pi/2 - atan2(x,z)) * polyfoldOrder / twopi Angle = roundInt(angle) Angle = Angle / polyfoldOrder * twopi Rotate(x,z,Angle) x = x - R3 // final steps now ... dun dun dunnn ... Mag = hypot(x,z) - R2 // Done :D return Mag;
// Replace hypot() with max() or min() and see what happens ... ;)
// My settings R1 = 2 , R2 = .4 , R3 = .5 // trefoil is of order 2, then a = b = 1 (the simplest knot) I hope that it's all ... and that it works for everyone. Syntopia please try it
|
|
« Last Edit: January 18, 2012, 10:32:24 AM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
cKleinhuis
|
|
« Reply #14 on: January 18, 2012, 10:48:30 AM » |
|
nice, i like the 2 folded strings as well, ehrm, when i see this right, we can now start to begin include DE's for any other shape ? any chance for including a supershape-DE ? and today is the no wikipedia day, we need to survive without, thanks to paul bourke http://paulbourke.net/geometry/supershape3d/
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
|