[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    [cairo] Exposing some computational matrix API
From:       Behdad Esfahbod <behdad () behdad ! org>
Date:       2008-05-25 7:01:37
Message-ID: 1211698898.31079.35.camel () behdad ! behdad ! org
[Download RAW message or body]

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

_______________________________________________
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic