Número de caras agregado
This commit is contained in:
@@ -14,6 +14,24 @@
|
|||||||
#define CMPLX(a,b) (a+I*b)
|
#define CMPLX(a,b) (a+I*b)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const int dim = 6;
|
||||||
|
|
||||||
|
int factorial(int n)
|
||||||
|
{
|
||||||
|
if(n == 1)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return n * factorial(n - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int numero_caras(int n)
|
||||||
|
{
|
||||||
|
if(n == 2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return (1 << (n - 3)) * factorial(n) / factorial(n - 2);
|
||||||
|
}
|
||||||
|
|
||||||
void riemman(float *d_surface, int * coords, int grid_size)
|
void riemman(float *d_surface, int * coords, int grid_size)
|
||||||
{
|
{
|
||||||
complex double eq;
|
complex double eq;
|
||||||
@@ -31,10 +49,8 @@ void riemman(float *d_surface, int * coords, int grid_size)
|
|||||||
|
|
||||||
void cube( float *d_surface, int * coord, int grid_size )
|
void cube( float *d_surface, int * coord, int grid_size )
|
||||||
{
|
{
|
||||||
unsigned char i;
|
for(int i = 0; i < dim; i++ )
|
||||||
|
d_surface[i] = ((float)coord[i]/grid_size) - 0.5;
|
||||||
for(int i=0; i<3; i++ )
|
|
||||||
d_surface[i]=(float)coord[i]/grid_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mobius(float *d_surface, int * coord, int grid_size)
|
void mobius(float *d_surface, int * coord, int grid_size)
|
||||||
@@ -73,18 +89,17 @@ typedef void (*function_t)(float *, int *, int);
|
|||||||
|
|
||||||
float *generate_data_surface(int grid_size, unsigned char *s)
|
float *generate_data_surface(int grid_size, unsigned char *s)
|
||||||
{
|
{
|
||||||
unsigned int i, j, k, o, p, l, n, m;
|
unsigned int i, j, k, o, p, n;
|
||||||
long size, q=0;
|
long size, q = 0;
|
||||||
function_t f;
|
function_t f;
|
||||||
float *d_surface;
|
float *d_surface;
|
||||||
|
|
||||||
const int dim =3;
|
|
||||||
int cara[dim];
|
int cara[dim];
|
||||||
|
|
||||||
f =cube ;
|
f =cube ;
|
||||||
*s = 3;
|
*s = 6;
|
||||||
|
|
||||||
size = grid_size * grid_size * 6 * (*s) * 6;
|
size = grid_size * grid_size * 6 * (*s) * numero_caras(dim);
|
||||||
d_surface = malloc((size + 1) * sizeof(float));
|
d_surface = malloc((size + 1) * sizeof(float));
|
||||||
d_surface[0] = size;
|
d_surface[0] = size;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user