package commons.graph;
import commons.graph.model.Point;
public class Calculator
{

private Calculator()
{}

public static final double PI2 = 2 * Math.PI;

/**
 * Calculates a number of random points on a circular path with a finite radius. 
 * @param pointsWanted the number of points that the caller needs.
 * @param pointPoolFactor the size of the pool of points as a multiple of pointsWanted.
 * @param radius the radius of the circular path on which the points lie.
 * @return an array of points.
 */
public static Point[] randomCircularPath (int pointsWanted, double radius)
{
   Point points[] = new Point[pointsWanted];
   
   for (int i = 0; i < pointsWanted; i++)
      points[i] = randomCircularPoint(radius);
   return points;
}

/**
 * Calculates one points on a circular path with a given radius. The point is randonly
 * selected from a pool of generated points. 
 * @param pointPoolSize the size of the pool of points.
 * @param radius the radius of the circular path on which the points lie.
 * @return a points.
 */
public static Point randomCircularPoint (double radius)
{
   double alpha = Math.random() * PI2;
   return circularPoint(radius, alpha);
}

/**
 * Calculates one points on a circular path with a given radius and a given
 * alpha. 
 */
public static Point circularPoint (double radius, double alpha)
{
   double x = radius * Math.cos(alpha);
   double y = radius * Math.sin(alpha);
   return new Point(x, y);
}
}
