X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsupport%2Fxform.cpp;fp=libctsupport%2Fxform.cpp;h=03cc14eae2d47ec3b94455872cc777340f623cda;hp=1134f0a1d3c8c8f51bdaabecfce4d95e9253a420;hb=1a050c98763fbbc0662731b0b76953acede6f5d7;hpb=c8b19dfaffba9f06d8b6c40cb1bb83a8964867f7 diff --git a/libctsupport/xform.cpp b/libctsupport/xform.cpp index 1134f0a..03cc14e 100644 --- a/libctsupport/xform.cpp +++ b/libctsupport/xform.cpp @@ -22,16 +22,16 @@ /* NAME - * rotate2d Rotates an array of 2 dimensional vectors + * rotate2d Rotates an array of 2 dimensional vectors * * SYNOPSIS * rotate2d (x, y, n, angle) - * double x[], y[] Array of points - * int n Number of points in array - * double angle Rotation angle (counter-clockwise) + * double x[], y[] Array of points + * int n Number of points in array + * double angle Rotation angle (counter-clockwise) */ -void +void rotate2d (double x[], double y[], int n, double angle) { double cos_theta = cos (angle); @@ -47,16 +47,16 @@ rotate2d (double x[], double y[], int n, double angle) /* NAME - * xlat2d Translates an array of 2 dimensional vectors + * xlat2d Translates an array of 2 dimensional vectors * * SYNOPSIS * xlat2d (x, y, n, xoffset, yoffset) - * double x[], y[] Array of points - * int n Number of points in array - * double xoffset, yoffset Offset to translate points by + * double x[], y[] Array of points + * int n Number of points in array + * double xoffset, yoffset Offset to translate points by */ -void +void xlat2d (double x[], double y[], int n, double xoffset, double yoffset) { for (int i = 0; i < n; i++) { @@ -67,16 +67,16 @@ xlat2d (double x[], double y[], int n, double xoffset, double yoffset) /* NAME - * scale2d Scale an array of 2 dimensional vectors + * scale2d Scale an array of 2 dimensional vectors * * SYNOPSIS * scale2d (x, y, n, xoffset, yoffset) - * double x[], y[] Array of points - * int n Number of points in array - * double xfact, yfact x & y scaling factors + * double x[], y[] Array of points + * int n Number of points in array + * double xfact, yfact x & y scaling factors */ -void +void scale2d (double x[], double y[], int n, double xfact, double yfact) { for (int i = 0; i < n; i++) { @@ -86,7 +86,7 @@ scale2d (double x[], double y[], int n, double xfact, double yfact) } -void +void indent_mtx2 (GRFMTX_2D m) { m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; @@ -94,7 +94,7 @@ indent_mtx2 (GRFMTX_2D m) m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; } -void +void xlat_mtx2 (GRFMTX_2D m, const double x, const double y) { indent_mtx2 (m); @@ -102,7 +102,7 @@ xlat_mtx2 (GRFMTX_2D m, const double x, const double y) m[2][1] = y; } -void +void scale_mtx2 (GRFMTX_2D m, const double sx, const double sy) { indent_mtx2 (m); @@ -110,7 +110,7 @@ scale_mtx2 (GRFMTX_2D m, const double sx, const double sy) m[1][1] = sy; } -void +void rot_mtx2 (GRFMTX_2D m, const double theta) { double c = cos(theta); @@ -121,7 +121,7 @@ rot_mtx2 (GRFMTX_2D m, const double theta) m[1][0] = -s; m[1][1] = c; } -void +void mult_mtx2 (const GRFMTX_2D m1, const GRFMTX_2D m2, GRFMTX_2D result) { GRFMTX_2D temp; @@ -130,7 +130,7 @@ mult_mtx2 (const GRFMTX_2D m1, const GRFMTX_2D m2, GRFMTX_2D result) for (int col = 0; col < 3; col++) { temp[row][col] = 0; for (int calc = 0; calc < 3; calc++) - temp[row][col] += m1[row][calc] * m2[calc][col]; + temp[row][col] += m1[row][calc] * m2[calc][col]; } } @@ -139,7 +139,7 @@ mult_mtx2 (const GRFMTX_2D m1, const GRFMTX_2D m2, GRFMTX_2D result) result[r][col] = temp[r][col]; } -void +void xform_mtx2 (const GRFMTX_2D m, double& x, double& y) { double xt = x * m[0][0] + y * m[1][0] + m[2][0];