def test_thin_should_determine_percision_if_none_specified_for_diferent_scale(self):
     PT = PointThinner()
     points = np.array([[1000.0, 0.0, 0.0], [1000.1, 0.0, 0.0], [2000.0, 0.0, 0.0], [2001.0, 0.0, 0.0], ])
     expected = np.array([[1000.0, 0.0, 0.0], [2000.0, 0.0, 0.0], [2001.0, 0.0, 0.0]])
     result = PT.thin(points)
     result.sort(axis=0)
     self.assertTrue(np.array_equal(result, expected))
Example #2
0
    def test_thin_thins_large_arrays_fast(self):
        percision = 2
        points = np.random.random([1000000, 3]).astype('float16')
        PT = PointThinner(percision)
        start = time.time()
        result = PT.thin(points)
        end = time.time() - start

        self.assertLess(end, 1)
    def test_thin_thins_large_arrays_fast(self):
        percision = 2
        points = np.random.random([1000000, 3]).astype('float16')
        PT = PointThinner(percision)
        start = time.time()
        result = PT.thin(points)
        end = time.time() - start

        self.assertLess(end, 1)
    def test_thin_removes_points_within_a_specified_distance_in_single_plane_percision_2(self):
        points = np.array([[1.0, 0.0, 0.0], [1.001, 0.0, 0.0], [2.0, 0.0, 0.0], [2.01, 0.0, 0.0], ])
        expected = np.array([[1.0, 0.0, 0.0], [2.0, 0.0, 0.0], [2.01, 0.0, 0.0]])
        percision = 2

        PT = PointThinner(percision)
        result = PT.thin(points, )

        result.sort(axis=0)
        self.assertTrue(np.array_equal(result, expected))
 def test_thin_thins_large_arrays(self):
     percision = 0
     points = np.random.random([10000, 3]).astype('float16')
     PT = PointThinner(percision)
     result = PT.thin(points)
     self.assertEqual(len(result), 8)
     
     percision = 1
     PT = PointThinner(percision)
     result = PT.thin(points)
     self.assertTrue(len(result) < 10000)
Example #6
0
 def test_thin_should_determine_percision_if_none_specified(self):
     PT = PointThinner()
     points = np.array([
         [1.0, 0.0, 0.0],
         [1.0001, 0.0, 0.0],
         [2.0, 0.0, 0.0],
         [2.001, 0.0, 0.0],
     ])
     expected = np.array([[1.0, 0.0, 0.0], [2.0, 0.0, 0.0],
                          [2.001, 0.0, 0.0]])
     result = PT.thin(points)
     result.sort(axis=0)
     self.assertTrue(np.array_equal(result, expected))
Example #7
0
    def test_thin_removes_points_within_a_specified_distance_in_single_plane_percision_2(
            self):
        points = np.array([
            [1.0, 0.0, 0.0],
            [1.001, 0.0, 0.0],
            [2.0, 0.0, 0.0],
            [2.01, 0.0, 0.0],
        ])
        expected = np.array([[1.0, 0.0, 0.0], [2.0, 0.0, 0.0],
                             [2.01, 0.0, 0.0]])
        percision = 2

        PT = PointThinner(percision)
        result = PT.thin(points, )

        result.sort(axis=0)
        self.assertTrue(np.array_equal(result, expected))
Example #8
0
    def test_thin_thins_large_arrays(self):
        percision = 0
        points = np.random.random([10000, 3]).astype('float16')
        PT = PointThinner(percision)
        result = PT.thin(points)
        self.assertEqual(len(result), 8)

        percision = 1
        PT = PointThinner(percision)
        result = PT.thin(points)
        self.assertTrue(len(result) < 10000)
Example #9
0
 def save_points(self, path, filename):
     with open(os.path.join(path, filename), 'w') as afile:
         thinner = PointThinner()
         converter = GLConverter()
         PLYWriter(converter, thinner).write_cartisien_points(afile, self.raw_points_xyz)
     self.dismiss_popup()