/*
   File:        geometry.h
   Author:      Jeff Schneider, Jeremy Kubica
   Created:     Sat Mar 22 15:41:57 EST 2003
   Description: miscellanous geometric computations

   Copyright 2003, Carnegie Mellon University
*/

#ifndef GEOMETRY_H
#define GEOMETRY_H

#include "amut.h"
#include "amdmex.h"

double circle_intersection_area(double x1, double y1, double r1,
				double x2, double y2, double r2);


/* --- Added: 11/13/2003 by Jeremy Kubica ------------------------- */
/* --- Functions for computing the distance between a point and a   */
/*     quadratic curve. */

/* Computes the (weighted) euclidean distance from a point
   a quadratic curve:

   y = a*x^2 + b*x + c

   where the square of the distance is computed as

   ----
   \      [    pt_d - y_d    ]^2
    >     [ ---------------- ]
   /      [     metric_d     ]
   ---- d

   If metric==NULL then metric_d = 1 for all d.
*/
double dist_quad_curve_to_point(dyv* a, dyv* b, dyv* c, dyv* pt, dyv* metric);


/* Computes the (weighted) euclidean distance from a point
   a bounded quadratic curve:

   y = a*x^2 + b*x + c   where xmin <= x <= xmax

   where the square of the distance is computed as

   ----
   \      [    pt_d - y_d    ]^2
    >     [ ---------------- ]
   /      [     metric_d     ]
   ---- d

   If metric==NULL then metric_d = 1 for all d.
*/
double dist_bounded_quad_curve_to_point(dyv* a, dyv* b, dyv* c,
                                        double xmin, double xmax,
                                        dyv* pt, dyv* metric);

#endif /* #ifdef GAUSSIAN_H */
