[cairo] Exposing some computational matrix API
Behdad Esfahbod
behdad at behdad.org
Sun May 25 00:01:37 PDT 2008
Hi,
I suggest we expose the following matrix functions that we have code for
anyway:
cairo_status_t
cairo_matrix_compute_determinant (cairo_matrix_t *matrix,
double *determinant);
/**
* Computes |Mv| and det(M)/|Mv| for v=[1,0] if x_basis, and v=[0,1] otherwise.
*/
// currently named _cairo_matrix_compute_scale_factors
cairo_status_t
cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
cairo_bool_t x_basis,
double *basis_scale,
double *normal_scale);
/**
* Computes max(|Mv|) and min(|Mv|) over all v s.t. |v|=1.
*/
// currently named _cairo_matrix_transformed_circle_major_axis
cairo_status_t
cairo_matrix_compute_axis_scale_factors (const cairo_matrix_t *matrix,
double *major_scale,
double *minor_scale);
/**
* Computes max((Mv).x) and max((Mv).y) over all v s.t. |v|=1.
*/
cairo_status_t
cairo_matrix_compute_max_scale_factors (const cairo_matrix_t *matrix,
double *x_scale,
double *y_scale);
This one is new, but not hard to implement:
cairo_status_t
cairo_matrix_compute_rank (cairo_matrix_t *matrix,
int *rank);
All will return CAIRO_STATUS_INVALID_MATRIX or CAIRO_STATUS_SUCCESS.
The "compute" naming as opposed to "get" is there to suggest that these
are not exactly cheap operations.
Naming suggestions? Return value suggestions? Other suggestions?
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list