Regular quadrilateral spheres

calendar_today

27.03.2022

label

Modeling, VEX

mouse

Houdini 19.0

Description

Converting boxes and grids into evenly spaced quadrilateral spheres and disks.

1 Spherifying a box

Normalizing position values is a fast and intuitive way to spherify a box. By doing this, all points have the same distance towards the center which turns the entire mesh into a sphere. However, especially the corner regions will turn out quite dense.

CPP
        // Normalize point positions, set to unit length.
// Divide by 2 to scale the sphere to unit size.
v@P = normalize(v@P) / 2.0;
    

2 Regular quadrilateral sphere

A more regular quadrilateral sphere can be achieved with the code below.

Source: http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html

C
        function vector sphere(vector p){
    vector psq = p * p * 4.0;
    return set(p.x * sqrt(1.0 - (psq.y + psq.z) / 2.0 + (psq.y * psq.z) / 3.0),
               p.y * sqrt(1.0 - (psq.z + psq.x) / 2.0 + (psq.z * psq.x) / 3.0),
               p.z * sqrt(1.0 - (psq.x + psq.y) / 2.0 + (psq.x * psq.y) / 3.0));
}

pos = sphere(pos);
    

3 Mapping a square to a circle

This point wrangle maps a square sized from -1.0 to 1.0 to a unit circle.

Source: http://mathproofs.blogspot.com/2005/07/mapping-square-to-circle.html

C
        float bias = chf('bias');

vector pos = v@P;

float x = pos.x * sqrt(1.0 - (pos.y * pos.y) / 2.0);
float y = pos.y * sqrt(1.0 - (pos.x * pos.x) / 2.0);

pos = set(x, y, 0.0);
v@P = lerp(v@P, pos, bias);
    
download

Downloads

link

Related articles

favorite

140

label

Modeling

Adaptive Resampling of Curves

favorite

284

label

Modeling

Applying Scales to Mesh Surfaces

favorite

226

label

Modeling

Approximating subdivision surfaces

favorite

190

label

Modeling

Blending COPs SDFs into 3D Volume

favorite

272

label

Modeling

Branching Subdivision Curves

favorite

130

label

Modeling

Circuit Networks