Logo by Sockratease - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. April 19, 2024, 03:52:36 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   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: Project a cube into a sphere (not Riemann's way)  (Read 2087 times)
0 Members and 1 Guest are viewing this topic.
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« on: September 29, 2013, 12:29:39 PM »

I was fascinated by this image;

http://fav.me/d68vh4p

It clearly uses a 3D map; cube to sphere. Any idea to achieve this result (starting from x,y,z coords)? cheesy
Logged

No sweat, guardian of wisdom!
knighty
Fractal Iambus
***
Posts: 819


« Reply #1 on: September 29, 2013, 09:31:34 PM »

Hey Darkbeam, nice to see you're back! smiley

[warning! I haven't tested this]
One way to achieve cube to sphere transform is:

\vec{f(\vec{v})}=\vec{v}\frac{||\vec{v}||_{\infty}}{||\vec{v}||_2}

or:
Code:
Linf=max(x,y,z)
L2=sqrt(x²+y²+z²)
mult=Linf/L2
xt=x*mult
yt=y*mult
zt=z*mult

the inverse, which actually is what you need, is just:

\vec{f^{-1}(\vec{v})}=\vec{v}\frac{||\vec{v}||_2}{||\vec{v}||_{\infty}}

(trying to learn latex btw!  embarrass)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #2 on: September 29, 2013, 11:08:50 PM »

It is very nonconformal cheesy but yes, I think it may be just ok - because you are a wiz smiley
Anybody can render a spheric Menger with it... Please smiley
I have to be sure smiley
Logged

No sweat, guardian of wisdom!
knighty
Fractal Iambus
***
Posts: 819


« Reply #3 on: September 30, 2013, 10:34:11 PM »

Indeed it's not conformal. Did the test. smiley
Fragmentarium script:
Code:
#info Menger Distance Estimator.
#define providesInit
#include "fast-Raytracer.frag"
#include "MathUtils.frag"
#group Menger

// Number of iterations.
uniform int Iterations;  slider[0,10,20]

// Scale parameter. A perfect Menger is 3.0
uniform float Scale; slider[0.00,3,4.00]

uniform vec3 RotVector; slider[(0,0,0),(1,0,0),(1,1,1)]

// Scale parameter. A perfect Menger is 3.0
uniform float RotAngle; slider[0.00,00,360]

// Scaling center
uniform vec3 Offset; slider[(-2,-2,-2),(1,1,1),(2,2,2)]

mat3 rot;
float sc,sr;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
vec3 o=abs(Offset);
sc = max(o.x,max(o.y,o.z));
sr=sqrt(dot(o,o)+1.);
}

float DE(vec3 p)
{
#if 1
vec3 ap=abs(p);
float Linf=max(max(ap.x,ap.y),ap.z);//infinity norm
float L2=length(p);//euclidean norm
float multiplier=L2/Linf;
p*=multiplier;//Spherify transform.
float dd=multiplier*1.6;//to correct the DE. Found by try and error. there should be better formula.
#else
float dd=1.;
#endif
float r2=dot(p,p);
for(int i = 0; i<Iterations && r2<100.; i++){
p=abs(p);
if(p.y>p.x) p.xy=p.yx;
      if(p.z>p.y) p.yz=p.zy;
      if(p.y>p.x) p.xy=p.yx;
p.z=abs(p.z-1./3.*Offset.z)+1./3.*Offset.z;
p=p*Scale-Offset*(Scale-1.); dd*=Scale;
p=rot*p;
r2=dot(p,p);
}
#if 1
return (sqrt(r2)-sr)/dd;//bounding volume is a sphere
#else
p=abs(p); return (max(p.x,max(p.y,p.z))-sc)/dd;//bounding volume is a cube
#endif
}


* SpherifyMenger.jpg (88.41 KB, 640x640 - viewed 282 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #4 on: September 30, 2013, 10:49:20 PM »

I think it's the craziest script ever, but it seems wonderful as ever, cheesy congrats buddy! cheesy
Logged

No sweat, guardian of wisdom!
Nahee_Enterprises
World Renowned
Fractal Senior
******
Posts: 2250


use email to contact


nahee_enterprises Nahee.Enterprises NaheeEnterprise
WWW
« Reply #5 on: October 01, 2013, 01:06:39 PM »

    Indeed it's not conformal.   Did the test.  smiley
    Fragmentarium script:
            #info Menger Distance Estimator.
              ...........
 

Nicely done !!!     cheesy
 
Logged

knighty
Fractal Iambus
***
Posts: 819


« Reply #6 on: October 04, 2013, 10:25:38 PM »

Thanks!  grin
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #7 on: October 04, 2013, 11:21:37 PM »

haha, nice one
Logged

---

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

Related Topics
Subject Started by Replies Views Last post
D'Riemann Movies Showcase (Rate My Movie) The Rev 2 949 Last post October 16, 2010, 11:31:03 PM
by The Rev
Riemann Phoenix Mandelbulb3D Gallery Dermis 0 826 Last post November 27, 2013, 05:13:50 PM
by Dermis
Revisiting the Riemann sphere (again) (new) Theories & Research « 1 2 » msltoe 26 2208 Last post January 05, 2017, 12:27:56 PM
by jehovajah
Riemann Sphere Msltoe Mandelbulber Gallery Buddhi 7 1910 Last post January 04, 2016, 05:46:41 AM
by M Benesi
Riemann Sphere + Abox Mandelbulber Gallery Buddhi 0 2466 Last post March 21, 2016, 08:32:50 PM
by Buddhi

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

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