News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. September 22, 2014, 02:13:44 PM


Login with username, password and session length



Pages: [1] 2 3 4   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Not fractal but funny; general torus knots DE routine  (Read 2838 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« 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.html

It 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 huh?

(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  grin many points;

Code:
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 algorythm

Don'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 kiss
« Last Edit: January 18, 2012, 10:19:34 AM by DarkBeam » Logged

Formulas are never too much (?)

David Makin
Global Moderator
Fractal Senior
******
Posts: 2269



Makin' Magic Fractals
WWW
« 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 smiley

http://www.josleys.com/articles/ams_article/Lorenz3.htm
http://www.josleys.com/show_gallery.php?galid=306
http://www.josleys.com/show_gallery.php?galid=303

Unfortunately they aren't something I've looked into - as is probably obvious from this reply wink
« Last Edit: January 15, 2012, 09:17:07 PM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #2 on: January 15, 2012, 10:44:27 PM »

David I am wondering a simpler method, there must be smiley
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 wink

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 wink
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 wink

Will check more tomorrow cheers!
« Last Edit: January 15, 2012, 10:52:26 PM by DarkBeam » Logged

Formulas are never too much (?)

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #3 on: January 16, 2012, 11:23:16 AM »

The torus is done, with dIFS is easy to create crazy combinations. cheesy


* zzz.jpg (16.76 KB, 391x352 - viewed 712 times.)
Logged

Formulas are never too much (?)

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #4 on: January 16, 2012, 11:30:04 AM »

Four flavours of torus wink

Sorry for the flood but I can't enclose more than one image per post :smiley


* zzz.jpg (18.74 KB, 957x240 - viewed 50 times.)
Logged

Formulas are never too much (?)

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #5 on: January 17, 2012, 06:01:11 PM »

I've completed the routine!  wink wink wink Whew very hard to find the correct one. cry

It needs a torsion factor;

Code:
Tfactor = (a + b/polyfoldOrder) * atan2(y,x)
x := sqrt(x^2+y^2)-R1
Rotate(x,z,Tfactor)

Then ... another angle;

Code:
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 shocked or it does not work. Anyway some plots enclosed. smiley smiley smiley

It plots very fast btw wink


* zzz.jpg (51.01 KB, 801x710 - viewed 42 times.)
« Last Edit: January 17, 2012, 06:09:47 PM by DarkBeam » Logged

Formulas are never too much (?)

knighty
Fractal Bachius
*
Posts: 570


« Reply #6 on: January 17, 2012, 06:51:38 PM »

the wave Awesome! the wave
 Repeating Zooming Self-Silimilar Thumb Up, by Craig
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #7 on: January 17, 2012, 07:35:23 PM »

the wave Awesome! the wave
 Repeating Zooming Self-Silimilar Thumb Up, by Craig

 embarrass embarrass embarrass Omg thanks so much.  smiley grin drinking beer together
Logged

Formulas are never too much (?)

Syntopia
Fractal Bachius
*
Posts: 587



syntopiadk
WWW
« 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...


* db.jpg (11.86 KB, 400x249 - viewed 677 times.)
Logged
bib
Global Moderator
Fractal Senior
******
Posts: 2003



@bib993
WWW
« Reply #9 on: January 17, 2012, 08:43:41 PM »

Cool!! shocked But are these done in M3D? If yes, where is the m3f ?
Logged

Between order and disorder reigns a delicious moment. (Paul ValÚry)
Jesse
Download Section
Fractal Schemer
*
Posts: 1018


« Reply #10 on: January 17, 2012, 11:57:10 PM »

You see me impressed too, Darkbeam!
I was wondering if this would be even possible, but you already gave the answer  smiley
Also the DE's seems to be very good, respect!

ps:
bib, look here for formulas:
http://www.fractalforums.com/mandelbulb-3d/re-custom-formulas-and-transforms-release-t9810/



* knots.jpg (36.35 KB, 480x360 - viewed 666 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #11 on: January 18, 2012, 09:49:31 AM »

 embarrass embarrass embarrass

You are confusing me... Too much honor Azn

Okay, let's have a look to the theorical blabla that made this possible, then I will try to decipher my own formula again for all the other people wink

And it's not a DE for the trefoil only, but for all sorts of torical knots cheesy

They all share the same principle dancing banana dancing chilli dancing banana

Don't look at the orientations and all other details, it's only a sketch for having a rough idea of what the f*** the transform does. If you can have it wink


* knottish.GIF (16.06 KB, 801x569 - viewed 48 times.)
« Last Edit: January 18, 2012, 11:05:01 AM by DarkBeam » Logged

Formulas are never too much (?)

DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #12 on: January 18, 2012, 10:07:26 AM »

Code:
// 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 wink
« Last Edit: January 18, 2012, 10:32:24 AM by DarkBeam » Logged

Formulas are never too much (?)

cKleinhuis
Administrator
Fractal Senior
*******
Posts: 5595


formerly known as 'Trifox'


WWW
« Reply #13 on: January 18, 2012, 10:48:30 AM »

nice, i like the 2 folded strings as well,  Smiling Mandelbrot




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 ? wink smiley horsie riding

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!
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 5595


formerly known as 'Trifox'


WWW
« Reply #14 on: January 18, 2012, 11:03:26 AM »

i tried the d.IFS.torusIFS, i just got a single torus, and could change the position, hybrids where copies, and the box parameters gave me the rectangular torus??
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1] 2 3 4   Go Down
  Print  
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
General introduction to Fractal Geometry General Discussion Jules Ruis 2 1342 Last post November 13, 2006, 05:17:10 PM
by Office_Shredder
3D Fractal Flame Animation - Torus function Best Fractal Animation doncasteel8587 0 1412 Last post November 19, 2006, 05:06:27 PM
by doncasteel8587
There's still something funny going on Mandelbulb 3d kameelian 6 784 Last post May 03, 2011, 10:18:37 PM
by Jesse
Waves & Knots Mandelbulb3D Gallery Maya 0 96 Last post September 25, 2012, 09:53:24 PM
by Maya
Conformally converting a square to a torus requires a fractal structure Fractal News across the World msltoe 0 201 Last post December 27, 2013, 08:15:29 PM
by msltoe

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 2.048 seconds with 30 queries. (Pretty URLs adds 0.16s, 2q)