Skip to content

Instantly share code, notes, and snippets.

@paniq
Created February 17, 2015 23:59
Show Gist options
  • Save paniq/3a8f847fa024448e68c1 to your computer and use it in GitHub Desktop.
Save paniq/3a8f847fa024448e68c1 to your computer and use it in GitHub Desktop.
Decocube
// example for an implicit surface that is not lipschitz continuous
float decocube(vec3 p) {
float r = (0.8*0.8);
float a = ((p.x+p.y)-r);
float b = ((p.y+p.z)-r);
float c = ((p.z+p.x)-r);
vec3 u = (p-1.0);
float q = ((a*a)+(u.z*u.z));
float s = ((b*b)+(u.x*u.x));
float t = ((c*c)+(u.y*u.y));
return ((q*s*t)-0.04);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment