/// <summary>
 /// Initializes a new instance of the <see cref="CircularCurve" /> class.
 /// </summary>
 /// <param name="radius">The radius.</param>
 /// <param name="center">The center.</param>
 /// <param name="tolerance">Tolerance to apply to the curve.</param>
 public CircularCurve(
     double radius,
     CartesianCoordinate center,
     double tolerance = DEFAULT_TOLERANCE)
     : base(
         vertexMajor(radius, center),
         center,
         CartesianOffset.Separation(vertexMajor(radius, center), center),
         tolerance)
 {
 }
        /// <summary>
        /// Coordinates of where a perpendicular projection intersects the provided coordinate.
        /// The first coordinate is of the closer intersection.
        /// Returns infinity if the point is coincident with the circular curve center.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="referenceArc">The line to which a perpendicular projection is drawn.</param>
        /// <returns>CartesianCoordinate.</returns>
        /// <exception cref="NotImplementedException"></exception>
        public static Tuple <CartesianCoordinate, CartesianCoordinate> CoordinatesOfPerpendicularProjection(CartesianCoordinate point, CircularCurve referenceArc)
        {
            if (point == referenceArc.Center)
            {
                return(new Tuple <CartesianCoordinate, CartesianCoordinate>(
                           new CartesianCoordinate(double.PositiveInfinity, double.PositiveInfinity),
                           new CartesianCoordinate(double.PositiveInfinity, double.PositiveInfinity)
                           ));
            }

            LinearCurve ray = new LinearCurve(referenceArc.Center, point);

            CartesianCoordinate[] intersectionCoordinates = referenceArc.IntersectionCoordinate(ray);

            double distance1 = CartesianOffset.Separation(point, intersectionCoordinates[0]);
            double distance2 = CartesianOffset.Separation(point, intersectionCoordinates[1]);
            CartesianCoordinate intersectionClose = (distance1 < distance2) ? intersectionCoordinates[0] : intersectionCoordinates[1];
            CartesianCoordinate intersectionFar   = (distance1 < distance2) ? intersectionCoordinates[1] : intersectionCoordinates[0];

            return(new Tuple <CartesianCoordinate, CartesianCoordinate>(intersectionClose, intersectionFar));
        }