Skip to content

Instantly share code, notes, and snippets.

@jhorikawa
Created April 19, 2020 09:06
Show Gist options
  • Save jhorikawa/cfb38fd66fc7f23e2962269bdb5d21ac to your computer and use it in GitHub Desktop.
Save jhorikawa/cfb38fd66fc7f23e2962269bdb5d21ac to your computer and use it in GitHub Desktop.
Houdini VEX script to wrap sphere with curve.
int res = chi("res");
float rad = chf("rad");
int poly = addprim(0, "polyline");
for(int i=0; i<res; i++){
float ang = $PI * 2 * chf("angmult") * i / (res - 1.0);
float rang = $PI * i / (res - 1.0);
float r = sin(rang) * rad;
float h = cos(rang) * rad;
float x = cos(ang) * r;
float z = sin(ang) * r;
int pt = addpoint(0, set(x, h, z));
addvertex(0, poly, pt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment