/* LICENSE:
  =========================================================================
    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
    All rights reserved.
  ========================================================================= */

#ifndef GAUSSIAN2_H_
#define GAUSSIAN2_H_

#include <math.h>

#include "DogTypes.h"
#include "Geometry.h"

/*
 * A class for manipulating two-dimensional gaussian distributions.
 * the mean is represented by a vector2d (x,y).
 * the major-axis and minor-axis standard deviations are given,
 * The angle of the major axis with x is also given.
 */

class Gaussian2 {
 public:
  /* Data members */
  
  vector2d mean;
  double sMaj, sMin, thetaMaj; /* Aligned with major and minor axes */
  double sx, sy, psxsy;  /* Aligned with x,y axis */
  ulong time;
  uchar pad[4]; // make structure 8 byte aligned under Linux

  /* Public member functions */
  Gaussian2();
  Gaussian2(ulong timestamp, vector2d m, double s1, double s2, double c,
	    bool global);
  Gaussian2(const Gaussian2& g);
  void setsxsy(double sigma_x, double sigma_y, double correlation);
  void setsMajsMin(double sigma_maj, double sigma_min, double angle);
  friend Gaussian2 G2Multiply(Gaussian2 g1, Gaussian2 g2);
  friend Gaussian2 G2Add(const Gaussian2 &g1, const Gaussian2 &g2);
  double ang_dev();
  double dist_dev();
  double eval(vector2d point);
  double evalLog(vector2d point);
};
  

#endif
