#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>

#include "rand_mersenne.h"


/* Constantes */

#define D_PI 6.28318530717958647692
#define T_PI 3.14159265358979
#define EPSILON  1e-12

#define CARRE(x) ((x)*(x))
#define CUBE(x) ((x)*(x)*(x))

#define DISQUE 0
#define COS 1
#define EXP 2

#define SUBDIVISION 0
#define EQUIANGULAIRE 1
#define HEALPIX 2


/* Structures */

typedef struct pointSphere
{
	double theta;
	double phi;
	double ri;
}pointSphere_t;

typedef struct point4d
{
	double x, y, z;
	double t;
}point4d_t;




/* Variables globales */

double Ray, r_min, L;
int motif, maillage;
int nb_sommets;
point4d_t *liste_sommets;
double *liste_triee_y;
double *liste_phi;
double *liste_coord_x, *list_coord_y;
int k1, k2, k3, k4;


/* Fonctions */

void lecture_equi(FILE *file1);
void ecriture_equi(FILE *file2);

double W_values(double theta, double phi, int i, int ny);
void last_step(double ri, double Wi, double theta, double phi);

void synthese_map();

void shaper_disque(point4d_t pt_car, double Wi, double A, double coef, int inf_ind, int sup_ind);
void shaper_cos2(point4d_t pt_car, double Wi, double A, double ri, double coef, int inf_ind, int sup_ind);
void shaper_exp(point4d_t pt_car, double Wi, double A, double ri, double coef, int inf_ind, int sup_ind);

//	Maillage ˇquiangulaire
int dicho_equi_inf(double theta_inf);
int dicho_equi_sup(double theta_sup);





