Dylan Beaudette wrote:
I needed some functionality to print the transformation matrix, very simple
patch - it might be useful to others.
It prints out the matrix along with a small note:
Transformation Matrix
---------------------
28155.882288 0.013530 1.002469
-5301.399323 0.997547 -0.009172
---------------------
the patch is attached.
Perhaps diagnostics like this might be a general use.
--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341
Index: lib/vector/transform/transform.c
RCS file: /home/grass/grassrepository/grass6/lib/vector/transform/transform.c,v
retrieving revision 1.2
diff -r1.2 transform.c
146a147,152
> printf("Transformation Matrix\n");
> printf("------------------------------------------\n");
> printf("%f %f %f \n", B0, B1, B2);
> printf("%f %f %f \n", B3, B4, B5);
> printf("------------------------------------------\n");
First, patches should use either unified or context format (preferably
unified). However ...
Library code shouldn't be unconditionally printing diagnostic
information (especially not to stdout); use G_debug() instead.
If you need to print this information in normal use (without debugging
enabled), add a separate get_transformation_matrix() function to that
file.
Alternatively, you can implement it within your module using
transform_b_into_a(), i.e.:
double B0, B1, B2, B3, B4, B5;
transform_b_into_a(0, 0, &B0, &B3);
transform_b_into_a(1, 0, &B1, &B4);
B1 -= B0; B4 -= B3;
transform_b_into_a(0, 1, &B2, &B5);
B2 -= B0; B5 -= B3;
--
Glynn Clements <glynn@gclements.plus.com>