Skip to content
Snippets Groups Projects
Commit 19d6be9f authored by Austin Sanders's avatar Austin Sanders
Browse files

Fixed matrix inversion in computeDistortedFocalPlaneCoordinates

parent 363546b7
No related branches found
No related tags found
No related merge requests found
...@@ -87,13 +87,18 @@ void computeDistortedFocalPlaneCoordinates( ...@@ -87,13 +87,18 @@ void computeDistortedFocalPlaneCoordinates(
double t1 = detLine - lineOrigin - iTransL[0]; double t1 = detLine - lineOrigin - iTransL[0];
double t2 = detSample - sampleOrigin - iTransS[0]; double t2 = detSample - sampleOrigin - iTransS[0];
double determinant = m11 * m22 - m12 * m21; double determinant = m11 * m22 - m12 * m21;
double p11 = m11 / determinant; double p11 = m22 / determinant;
double p12 = -m12 / determinant; double p12 = -m12 / determinant;
double p21 = -m21 / determinant; double p21 = -m21 / determinant;
double p22 = m22 / determinant; double p22 = m11 / determinant;
distortedX = p11 * t1 + p12 * t2; distortedX = p11 * t1 + p12 * t2;
distortedY = p21 * t1 + p22 * t2; distortedY = p21 * t1 + p22 * t2;
std::cout << t1 << ", " << t2 << std::endl;
std::cout << p11 << ", " << p12 << std::endl;
std::cout << p21 << ", " << p22 << std::endl;
}; };
// Compue the image pixel for a distorted focal plane coordinate // Compue the image pixel for a distorted focal plane coordinate
......
...@@ -81,6 +81,22 @@ TEST(UtilitiesTests, computeDistortedFocalPlaneCoordinatesSumming) { ...@@ -81,6 +81,22 @@ TEST(UtilitiesTests, computeDistortedFocalPlaneCoordinatesSumming) {
EXPECT_DOUBLE_EQ(undistortedFocalPlaneY, 0); EXPECT_DOUBLE_EQ(undistortedFocalPlaneY, 0);
} }
TEST(UtilitiesTests, computeDistortedFocalPlaneCoordinatesAffine) {
double iTransS[] = {-10.0, 0.0, 0.1};
double iTransL[] = {10.0, -0.1, 0.0};
double undistortedFocalPlaneX, undistortedFocalPlaneY;
computeDistortedFocalPlaneCoordinates(
11.0, -9.0,
0.0, 0.0,
1.0, 1.0,
0.0, 0.0,
iTransS, iTransL,
undistortedFocalPlaneX, undistortedFocalPlaneY);
EXPECT_NEAR(undistortedFocalPlaneX, -10.0, 1e-12);
EXPECT_NEAR(undistortedFocalPlaneY, 10.0, 1e-12);
}
TEST(UtilitiesTests, computeDistortedFocalPlaneCoordinatesStart) { TEST(UtilitiesTests, computeDistortedFocalPlaneCoordinatesStart) {
double iTransS[] = {0.0, 0.0, 10.0}; double iTransS[] = {0.0, 0.0, 10.0};
double iTransL[] = {0.0, 10.0, 0.0}; double iTransL[] = {0.0, 10.0, 0.0};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment