using System;
using Spherical;
/*=====================================================================

  File:      Circle.cs for Spatial Sample
  Summary:   Implements a circular region of interest on the celestial sphere.
  Date:	     August 10, 2005

---------------------------------------------------------------------
  This spatial search library was developed by Alexander Szalay, Robert Brunner, 
  Peter Kunszt, and Gyorgy Fekete at the Department of Physics and Astronomy, 
  The Johns Hopkins University, in collaboration with Jim Gray, Microsoft Research.
  Details of the algorithms can be found at http://www.sdss.jhu.edu/htm/.
 
======================================================= */

namespace Spherical.HTM
{
	/// <summary>
	/// Summary description for Circle.
	/// </summary>
	public class Circle 
	{
        //private Circle(Region  reg) {
        //    init();
        //    _reg = reg;				// this convex gets inserted into region
        //}
        //private Circle(){
        //}

        public static Convex Make(double ra, double dec, double radius)
        {
            double x, y, z;
            Cartesian.Radec2Xyz(ra, dec, out x, out y, out z);
            return Make(x, y, z, radius);
        }
        public static Convex Make(double x, double y, double z, double radius)
        {
            Convex con = new Convex();
            double arg = Math.PI * radius / 10800.0;
            double d;
            d = Math.Cos(arg);
            con.Add(new Halfspace(x, y, z, false, d));
            return con;
        }

	}
}
