Jump to content
Sign in to follow this  
konstantin magnus

Regular quad sphere

Recommended Posts

Sphere HDA with more regular quads:

quad_sphere.jpg.e4f5e418081302deb6da1b42589d8e56.jpg
Left: Normalized box with dense corner regions.
Right: More regular quad mesh (see code below).

// Turns unit size box into sphere
// Source: http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html

vector pos = v@P * 2.0;

float x2 = pos.x * pos.x;
float y2 = pos.y * pos.y;
float z2 = pos.z * pos.z;

float x = pos.x * sqrt(1.0 - (y2 + z2) / 2.0 + (y2 * z2) / 3.0);
float y = pos.y * sqrt(1.0 - (z2 + x2) / 2.0 + (z2 * x2) / 3.0);
float z = pos.z * sqrt(1.0 - (x2 + y2) / 2.0 + (x2 * y2) / 3.0);

pos = set(x, y, z);
v@P = pos;

 

konstantin.quad_sphere.1.0.hdalc

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×