private void back_and_forth(double mirror) { CameraUniversalOmni model = createModel(mirror); UniOmniPtoS_F64 pixelToUnit = new UniOmniPtoS_F64(); pixelToUnit.setModel(model); UniOmniStoP_F64 unitToPixel = new UniOmniStoP_F64(); unitToPixel.setModel(model); List<Point2D_F64> listPixels = new ArrayList<>(); listPixels.add(new Point2D_F64(320, 240)); listPixels.add(new Point2D_F64(320, 200)); listPixels.add(new Point2D_F64(320, 280)); listPixels.add(new Point2D_F64(280, 240)); listPixels.add(new Point2D_F64(360, 240)); listPixels.add(new Point2D_F64(280, 240)); listPixels.add(new Point2D_F64(240, 180)); for (Point2D_F64 pixel : listPixels) { Point3D_F64 circle = new Point3D_F64(10, 10, 10); pixelToUnit.compute(pixel.x, pixel.y, circle); // directly forward on unit sphere // it should be on the unit circle assertEquals(1.0, circle.norm(), GrlConstants.DOUBLE_TEST_TOL); Point2D_F64 found = new Point2D_F64(); unitToPixel.compute(circle.x, circle.y, circle.z, found); assertEquals(pixel.x, found.x, GrlConstants.DOUBLE_TEST_TOL_SQRT); assertEquals(pixel.y, found.y, GrlConstants.DOUBLE_TEST_TOL_SQRT); } }
private void centerIsCenter(double mirror) { CameraUniversalOmni model = createModel(mirror); UniOmniPtoS_F64 alg = new UniOmniPtoS_F64(); alg.setModel(model); Point3D_F64 found = new Point3D_F64(10, 10, 10); alg.compute(320, 240, found); // directly forward on unit sphere assertEquals(0, found.x, GrlConstants.DOUBLE_TEST_TOL); assertEquals(0, found.y, GrlConstants.DOUBLE_TEST_TOL); assertEquals(1, found.z, GrlConstants.DOUBLE_TEST_TOL); }