Author Message
ufoace

Joined: 11 Mar 2013
Posts: 46 Posted: Sun Apr 07, 2013 1:08 pm    Post subject: Spirographs Hello! Spirographs are a very awesome pattern that are easy to code and have million of combinations, from central symmetries to axial symmetries and even chaos, and can be traced from a cylinder, a cube, perhaps all the formulas from sin and cos are a spirograph? Could someone please tell me the formula for this kind using a tube?: http://www.mi.sanu.ac.rs/vismath/taylor2009/index.html here are some cool pages for spirographs http://www.eddaardvark.co.uk/python_patterns/spirograph.html http://maxwelldemon.com/2010/01/14/spirographs-and-the-third-dimension/    Furan

Joined: 05 Oct 2010
Posts: 64
Location: Prague, Czech Republic Posted: Mon Apr 08, 2013 6:51 am    Post subject: It's pretty easy once you get the main curve. Follow the same technique as for the slanted cylinder: Get a parametrical representation of the knot. X=X(t) Y=Y(t) Z=Z(t) Derivate according to t. You'll get the tangencial vector u. cross u with (0,0,1) to get one orthogonal vector B cross B with u to get the second orthogonal vector C. Normalize. Parametric surface x = X(t) + R * (bx*cos(phi) + cx*sin(phi)) y = Y(t) + R * (by*cos(phi) + cy*sin(phi)) z = Z(t) + R * (bz*cos(phi) + cz*sin(phi)) t = 0...2pi usually phi=0...2pi You may find some useful segments of code here: http://www.fractalforums.com/theory/a-generalization-of-triplex-zpplusc/    Furan

Joined: 05 Oct 2010
Posts: 64
Location: Prague, Czech Republic Posted: Mon Apr 08, 2013 10:51 am    Post subject: I completely forgot I had this all along:

 Code: a=3 Trifold knot curve: x = a*sin(t)+2*a*sin(2*t) y = a*cos(t)-2*a*cos(2*t) z = -a*sin(3*t) t=0..2*pi Inner functions: u1(u) = 2*cos(u)+8*cos(2*u) u2(u) = -2*sin(u)+8*sin(2*u) u3(u) = -6*cos(3*u) v1(u) = u2(u) v2(u) = -u1(u) v3(u) = 0 // omitted w1(u) = -12*cos(3*u)*(cos(u)+4*cos(2*u)) w2(u) = 12*cos(3*u)*(sin(u)-4*sin(2*u)) w3(u) = -68-32*cos(3*u) normv(u) = sqrt(32*cos(3*u)+68) normw(u) = sqrt(8)*sqrt(795+36*cos(9*u)+217*cos(6*u)+652*cos(3*u)) xp(u,v) = v1(u)*cos(v)/normv(u)+w1(u)*sin(v)/normw(u) yp(u,v) = v2(u)*cos(v)/normv(u)+w2(u)*sin(v)/normw(u) zp(u,v) = w3(u)*sin(v)/normw(u) Trifold Knot Surface: r=1 x = a*sin(u)+2*a*sin(2*u)+r*xp(u,v) y = a*cos(u)-2*a*cos(2*u)+r*yp(u,v) z = -a*sin(3*u)+r*zp(u,v) u=0..2*pi v=0..2*pi    ufoace

Joined: 11 Mar 2013
Posts: 46 Posted: Tue Apr 09, 2013 10:35 am    Post subject: Thank you Furan, that is extremely helpful! I will be attempting to write an isosurface version so that I can multiply the spirographs more easily with different functions. I am working on an interactive isosurface platform (see video that end, contact anyone if you want a copy - i was going to mix the spirographs with perlin noise function bended around inside the spirograph for an exploration area. what is confusing me is the mathematical complexity of bending an isosurface cylinder around the line made by a circle or a parabole, if the cylinder runs along x, it' s easy, and if it runs along x*x, parabolic shape, I don' t how the formula copes with the changing vectors.... hmm maybe from this solution also: http://k3dsurf.s4.bizhat.com/viewtopic.php?t=108&postdays=0&postorder=asc&start=75 Here is the interactive platform I am working on, it lets you walk on /fly around isosurfaces. i can t do parametric on it: http://youtu.be/ygeCClSxrhU   Furan

Joined: 05 Oct 2010
Posts: 64
Location: Prague, Czech Republic Posted: Wed Apr 10, 2013 4:54 am    Post subject: Well, I am struggling with the very same problem. The thing is, the spirograph isn't really a function, because for given [x,y,z] you cannot directly define unique position t. Therefore I had to use the "Initial guess" and find it with Newton-Rhapson. So one solution, that I just didn't have time to implement, is to enable the engine to cope with it: For the i-th integration step on the ray, run the initial guess and compare it with (t, phi, r)_i-1 If it's on the same level, you can start iterating from i-1 values. The initial guess also may be a function of (t, phi, r)_i-1 and Jacobian J_i-1 and just transform the ray vector to the local coordinates t,phi,r. They are curved, but still you can get a good approximation, especially if you take smaller steps at high curvatures. Ok, now I have seen your video. Nice work!!! I would love to shoot some zombies in a semi-fractal world Well, that changes things. Now I'd suggest to leave it in parametrical coordinates and following the process I had just described, calculate the isofunction on a very fine cubic grid (1024x1024x1024). So for every [x,y,z] you will get deltaR(r,t,phi) as the shortest outer distance from the knot surface. (Negative for points inside, or the other way). Apply perlin noise and other features on this discrete deltaR(x,y,z) function. Than by linear interpolation or a more sophisticated method find points deltaR=0 and generate polygonal mesh.    Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT Page 1 of 1

 Jump to: Select a forum MathMod----------------MathMod Progress & featuresMathematical Models CollectionHow toBugsMathMod for WindowsMathMod for Linux/UnixMathMod For MACOSXMathMod TutorialsOther Mathematical ToolsOpen Discussion K3DSurf----------------K3DSurf Discuss/DiscussionsHow toK3DSurf math related questionsK3DSurf for WindowsK3DSurf for MacOSK3DSurf for LinuxOnline K3DSurf: J3DSurfNewsBugsOnline DocumentationAccount Activation Issue ?/ Problème d'activation de votre compte ?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum