예제 #1
0
    def test_double_conversions(self):
        output = efr.fit_improved_B2AC(self.points.copy())
        general_1 = c2gconv.conic_to_general_1(output.copy())
        general_2 = c2gconv.conic_to_general_2(output.copy())
        general_3 = c2gconv.conic_to_general_reference(output.copy())
        e_1 = B2ACEllipse(*general_1)
        e_2 = B2ACEllipse(*general_2)
        e_3 = B2ACEllipse(*general_3)

        # Test correct center point.
        assert np.linalg.norm(self.e.center_point - e_1.center_point) < 1
        # assert np.linalg.norm(self.e.center_point - e_2.center_point) < 1
        assert np.linalg.norm(self.e.center_point - e_3.center_point) < 1

        # Test correct radii.
        assert np.linalg.norm(max(self.e.radii) - max(e_1.radii)) < 0.25
        assert np.linalg.norm(min(self.e.radii) - min(e_1.radii)) < 0.25
        # assert np.linalg.norm(max(self.e.radii) - max(e_2.radii)) < 0.25
        # assert np.linalg.norm(min(self.e.radii) - min(e_2.radii)) < 0.25
        assert np.linalg.norm(max(self.e.radii) - max(e_3.radii)) < 0.25
        assert np.linalg.norm(min(self.e.radii) - min(e_3.radii)) < 0.25

        # Test overlap
        assert overlap(self.e, e_1) > 0.98
        assert overlap(e_1, self.e) > 0.98
        # assert overlap(self.e, e_2) > 0.98
        # assert overlap(e_2, self.e) > 0.98
        assert overlap(self.e, e_3) > 0.98
        assert overlap(e_3, self.e) > 0.98
예제 #2
0
    def test_double_conversions(self):
        output = efr.fit_improved_B2AC(self.points.copy())
        general_1 = c2gconv.conic_to_general_1(output.copy())
        general_2 = c2gconv.conic_to_general_2(output.copy())
        general_3 = c2gconv.conic_to_general_reference(output.copy())
        e_1 = B2ACEllipse(*general_1)
        e_2 = B2ACEllipse(*general_2)
        e_3 = B2ACEllipse(*general_3)

        # Test correct center point.
        assert np.linalg.norm(self.e.center_point - e_1.center_point) < 1
        # assert np.linalg.norm(self.e.center_point - e_2.center_point) < 1
        assert np.linalg.norm(self.e.center_point - e_3.center_point) < 1

        # Test correct radii.
        assert np.linalg.norm(max(self.e.radii) - max(e_1.radii)) < 0.25
        assert np.linalg.norm(min(self.e.radii) - min(e_1.radii)) < 0.25
        # assert np.linalg.norm(max(self.e.radii) - max(e_2.radii)) < 0.25
        # assert np.linalg.norm(min(self.e.radii) - min(e_2.radii)) < 0.25
        assert np.linalg.norm(max(self.e.radii) - max(e_3.radii)) < 0.25
        assert np.linalg.norm(min(self.e.radii) - min(e_3.radii)) < 0.25

        # Test overlap
        assert overlap(self.e, e_1) > 0.98
        assert overlap(e_1, self.e) > 0.98
        # assert overlap(self.e, e_2) > 0.98
        # assert overlap(e_2, self.e) > 0.98
        assert overlap(self.e, e_3) > 0.98
        assert overlap(e_3, self.e) > 0.98
예제 #3
0
 def test_fit_ref(self):
     points = self.points.copy()
     output = efr.fit_improved_B2AC(points)
     general_form = c2gconv.conic_to_general_1(output)
     e_fitted = B2ACEllipse(*general_form)
     assert np.linalg.norm(self.e.center_point - e_fitted.center_point) < 1
     assert np.linalg.norm(max(self.e.radii) - max(e_fitted.radii)) < 0.25
     assert np.linalg.norm(min(self.e.radii) - min(e_fitted.radii)) < 0.25
     assert overlap(self.e, e_fitted) > 0.98
     assert overlap(e_fitted, self.e) > 0.98
예제 #4
0
 def test_fit_ref(self):
     points = self.points.copy()
     output = efr.fit_improved_B2AC(points)
     general_form = c2gconv.conic_to_general_1(output)
     e_fitted = B2ACEllipse(*general_form)
     assert np.linalg.norm(self.e.center_point - e_fitted.center_point) < 1
     assert np.linalg.norm(max(self.e.radii) - max(e_fitted.radii)) < 0.25
     assert np.linalg.norm(min(self.e.radii) - min(e_fitted.radii)) < 0.25
     assert overlap(self.e, e_fitted) > 0.98
     assert overlap(e_fitted, self.e) > 0.98