/*
 *  shape.h
 *  SHAPE
 *
 *  Created by Tommy Grav on 4/19/05.
 *  Copyright 2005. All rights reserved.
 *
 */

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

#define PI 3.14159265358979323846
#define TWOPI 6.283185307179586476925287
#define DEG2RAD PI/180.
#define EPSILON 23.43*DEG2RAD
#define MAX(x,y) ((x) > (y)) ? (x) : (y)
#define MIN(x,y) ((x) < (y)) ? (x) : (y)
#define ABS(a) ((a) < 0 ? -(a) : (a))

// Typedefs
typedef struct {
    int v[3];
} VERTEX;


// Functions 
int ell2conv(int n, double *longitude, double *latitude) ;
int trifac(VERTEX *ifp, int n) ;
int fvector(double *vertex_pos, int vertice_start, int vertice_end, double *vector_out) ;
int fcrossproduct(double *vector_1, double *vector_2, double *vector_out) ;
int transform(double alpha, double beta, double gamma, double *vec0, double *vec1) ;
int ecl2ast(double *rotstate, double *pos_earth, double *pos_sun, double epoch, 
		double *new_pos_earth, double *new_pos_sun) ;
double fvector_dot(double *vector_1, double *vector_2) ;
double modangle_radians(double angle) ;
double conv2lc(VERTEX *ifp, double *vertex_pos, 
    int nfacets, double *cl, double *ast_pos_earth, double *ast_pos_sun) ;
double magnitude_corrections(double inmag, double *pos_earth, double *pos_sun, double *phase) ; 

// Globals
extern int debug;
