Jump to content

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...