- Code: Select all
`#include <stdio.h>`

#include <math.h>

#define PI 3.1415926535897932384626433832795028841971693

int main ()

{

int i;

int realm;

double points[31];

int xval = 0;

int zval = 30;

double x = 0, y = 0, z = 0, w = -1;

double change;

FILE *output;

output = fopen("cc.off", "w");

fprintf (output, "4OFF\n14162 0 0 0\n");

for (i = 0; i <= 30; i++)

{

points[i] = sin(PI*i/60);

}

fprintf(output, "% .16f % .16f % .16f % .16f\n", x, y, z, w);

for (realm = -29; realm <=29; realm++)

{

change = 1 - cos(PI*realm/60);

for (i = 0; i <= 239; i++)

{

if ((i/60) % 2 == 0)

{

x = change*points[xval];

}

else

{

x = change*-1*points[xval];

}

if (i < 120)

{

y = change;

}

else

{

y = change*-1;

}

if (((i+30)/60) % 2 == 0)

{

z = change*points[zval];

}

else

{

z = change*-1*points[zval];

}

w = sin(PI*realm/60);

fprintf(output, "% .16f % .16f % .16f % .16f\n", x, y, z, w);

if ((i/30) % 2 == 0)

{

xval++;

zval--;

}

else

{

xval--;

zval++;

}

}

}

fprintf(output, " 0.0000000000000000 0.0000000000000000 0.0000000000000000 1.0000000000000000\n");

fclose (output);

return 0;

}

I loaded it in Stella4d and it calculated the convex hull fo me. Here's a projection of it:

While playing around with it I discovered it has a perfect sphere cross-section in one orientation!