/* @file  psEllipse.h
 * @brief functions to manipulate sparse matrices equations
 *
 * $Revision: 1.5 $ $Name: not supported by cvs2svn $
 * $Date: 2007-05-18 14:06:09 $
 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 */

#ifndef PS_ELLIPSE_H
#define PS_ELLIPSE_H

#include "psError.h"

/// @addtogroup MathOps Mathematical Operations
/// @{

// strucures to define elliptical shape parameters
typedef struct
{
    double major;                       // Major axis
    double minor;                       // Minor axis
    double theta;                       // Position angle
}
psEllipseAxes;

// strucures to define elliptical shape parameters
typedef struct
{
    double e0;				// Scale (Mxx + Myy)
    double e1;				// Polarization 1 (Mxx - Myy)
    double e2;				// Polarization 1 (2Mxy)
}
psEllipsePol;

typedef struct
{
    double x2;                          // Moment of xx
    double y2;                          // Moment of yy
    double xy;                          // Moment of xy
}
psEllipseMoments;

typedef struct
{
    double sx;                          // Shape parameter in x
    double sy;                          // Shape parameter in y
    double sxy;                         // Shape parameter in xy
}
psEllipseShape;

// conversions between elliptical shape representations
psEllipseMoments psEllipseAxesToMoments(psEllipseAxes axes);
psEllipseAxes psEllipseMomentsToAxes(psEllipseMoments moments, double maxAR);
psEllipseShape psEllipseAxesToShape(psEllipseAxes axes);
psEllipseAxes psEllipseShapeToAxes(psEllipseShape shape, double maxAR);

psEllipsePol psEllipseAxesToPol(psEllipseAxes axes);
psEllipsePol psEllipseShapeToPol(psEllipseShape shape);
psErrorCode psEllipsePolToAxes(const psEllipsePol pol, const float minMinorAxis, psEllipseAxes *axes);

/// @}
#endif
