/* We must make maximum error ≤ tolerance, so compute the ∆ needed:  */
int _cairo_pen_vertices_needed(double tolerance, double radius, const cairo_matrix_t *matrix)
/* We must make maximum error ≤ tolerance, so compute the ∆ needed:  */
int _cairo_pen_vertices_needed(double tolerance, double radius, const cairo_matrix_t *matrix)
{
    double major_axis = _cairo_matrix_transformed_circle_major_axis (matrix,
								     radius);
    int num_vertices;
    if (tolerance >= 4*major_axis) { 
	num_vertices = 1;
    } else if (tolerance >= major_axis) {
	num_vertices = 4;
    } else {
	num_vertices = ceil (2*M_PI / acos (1 - tolerance / major_axis));
	if (num_vertices % 2)
	    num_vertices++;
	if (num_vertices < 4)
	    num_vertices = 4;
    }
    return num_vertices;
}