def set_product_vectors(self, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0):
        self.logger.log('Set product vectors: x1 = {0}, y1 = {1}, z1 = {2},'
                        ' x2 = {3}, y2 = {4}, z2 = {5}'.format(x1, y1, z1, x2, y2, z2))

        self.vec1_x = x1
        self.vec1_y = y1
        self.vec1_z = z1
        self.vec2_x = x2
        self.vec2_y = y2
        self.vec2_z = z2
        self.button_products = 'disabled'
        if is_float(x1) and is_float(y1) and is_float(z1):
            if is_float(x2) and is_float(y2) and is_float(z2):
                self.button_products = 'normal'
                self.first_vector = Vector3d(float(x1), float(y1), float(z1))
                self.second_vector = Vector3d(float(x2), float(y2), float(z2))

                self.logger.log('First product vector: x = {0}, y = {1}, z = {2},'
                                ' Second product vector: x = {0}, y = {1},'
                                ' z = {2},'.format(self.first_vector.x,
                                                   self.first_vector.y,
                                                   self.first_vector.z,
                                                   self.second_vector.x,
                                                   self.second_vector.y,
                                                   self.second_vector.z))
 def test_calc_negative_vector_product(self):
     vec1 = Vector3d(-4.3, 2.5, -3.0)
     vec2 = Vector3d(3.6, 2.0, -6.6)
     vector_product = vec1.vector_product(vec2.x, vec2.y, vec2.z)
     vec_params = [-10.5, -39.18, -17.6]
     for val1, val2 in zip(vector_product, vec_params):
         self.assertAlmostEqual(val1, val2, 2)
 def test_calc_simple_vector_product(self):
     vec1 = Vector3d(1.0, 2.0, 3.0)
     vec2 = Vector3d(3.0, 2.0, 1.0)
     vector_product = vec1.vector_product(vec2.x, vec2.y, vec2.z)
     vec_params = [-4.0, 8.0, -4.0]
     for val1, val2 in zip(vector_product, vec_params):
         self.assertAlmostEqual(val1, val2, 0)
 def test_calc_zero_vector_product(self):
     vec1 = Vector3d(0.0, 0.0, 0.0)
     vec2 = Vector3d(0.0, 0.0, 0.0)
     vector_product = vec1.vector_product(vec2.x, vec2.y, vec2.z)
     vec_params = [0.0, 0.0, 0.0]
     for val1, val2 in zip(vector_product, vec_params):
         self.assertAlmostEqual(val1, val2, 0)
 def set_product_vectors(self, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0):
     self.vec1_x = x1
     self.vec1_y = y1
     self.vec1_z = z1
     self.vec2_x = x2
     self.vec2_y = y2
     self.vec2_z = z2
     self.button_products = 'disabled'
     if is_float(x1) and is_float(y1) and is_float(z1):
         if is_float(x2) and is_float(y2) and is_float(z2):
             self.button_products = 'normal'
             self.first_vector = Vector3d(float(x1), float(y1), float(z1))
             self.second_vector = Vector3d(float(x2), float(y2), float(z2))
 def test_calc_normalization_zero(self):
     vec = Vector3d(0, 0, 0)
     with self.assertWarnsRegex(Warning, 'Error! Division by zero.'):
         normalization = vec.calc_normalization()
     vec_params = [0.0, 0.0, 0.0]
     for val1, val2 in zip(normalization, vec_params):
         self.assertAlmostEqual(val1, val2, 0)
 def set_norm_vector(self, x=0, y=0, z=0):
     self.button_norms = 'disabled'
     self.vec0_x = x
     self.vec0_y = y
     self.vec0_z = z
     if is_float(x) and is_float(y) and is_float(z):
         self.button_norms = 'normal'
         self.norm_vector = Vector3d(float(x), float(y), float(z))
    def set_norm_vector(self, x=0, y=0, z=0):
        self.logger.log('Set norm vector: x = {0}, y = {1}, z = {2}'.format(x, y, z))

        self.button_norms = 'disabled'
        self.vec0_x = x
        self.vec0_y = y
        self.vec0_z = z
        if is_float(x) and is_float(y) and is_float(z):
            self.button_norms = 'normal'
            self.norm_vector = Vector3d(float(x), float(y), float(z))

            self.logger.log('Norm vector coordinates: x = {0}, y = {1}, z = {2}'.format(self.norm_vector.x,
                                                                                        self.norm_vector.y,
                                                                                        self.norm_vector.z))
 def test_calc_manhattan_norma_zeros(self):
     vec = Vector3d(0.0, 0.0, 0.0)
     norma = vec.calc_norma(norma_type='manhattan')
     self.assertAlmostEqual(norma, 0, 0)
 def test_calc_chebyshev_norma_1_3_4(self):
     vec = Vector3d(1.0, 3.0, 4.0)
     norma = vec.calc_norma(norma_type='chebyshev')
     self.assertAlmostEqual(norma, 4, 0)
 def test_calc_manhattan_norma_negative_numbers(self):
     vec = Vector3d(-3.3, 2.0, -4.8)
     norma = vec.calc_norma(norma_type='manhattan')
     self.assertAlmostEqual(norma, 10.1, 1)
 def test_can_create_vector(self):
     vec = Vector3d()
     self.assertTrue(isinstance(vec, Vector3d))
 def test_calc_manhattan_norma_1_3_4(self):
     vec = Vector3d(1.0, 3.0, 4.0)
     norma = vec.calc_norma(norma_type='manhattan')
     self.assertAlmostEqual(norma, 8, 0)
 def test_calc_manhattan_norma_3_4_5(self):
     vec = Vector3d(3.0, 4.0, 5.0)
     norma = vec.calc_norma(norma_type='manhattan')
     self.assertAlmostEqual(norma, 12, 0)
 def test_calc_euclid_norma_negative_numbers(self):
     vec = Vector3d(-3.3, 2.0, -4.8)
     norma = vec.calc_norma()
     self.assertAlmostEqual(norma, 6.15873, 4)
 def test_calc_zero_scalar_product(self):
     vec1 = Vector3d(0.0, 0.0, 0.0)
     vec2 = Vector3d(0.0, 0.0, 0.0)
     scalar_product = vec1.scalar_product(vec2.x, vec2.y, vec2.z)
     self.assertEqual(scalar_product, 0.0)
 def test_can_create_1_2_3_vector(self):
     vec = Vector3d(1, 2, 3)
     self.assertTrue(vec.is_equal(1.0, 2.0, 3.0))
 def test_calc_normalization_negative_numbers(self):
     vec = Vector3d(-3.3, 2.0, -4.8)
     normalization = vec.calc_normalization()
     vec_params = [-0.5358, 0.3247, -0.7793]
     for val1, val2 in zip(normalization, vec_params):
         self.assertAlmostEqual(val1, val2, 3)
 def test_calc_does_not_exist_type(self):
     vec = Vector3d(1.0, 3.0, 4.0)
     with self.assertWarnsRegex(Warning,
                                "Error! Input type doesn't exist."):
         norma = vec.calc_norma(norma_type='not type')
     self.assertAlmostEqual(norma, 0, 0)
 def test_calc_simple_scalar_product(self):
     vec1 = Vector3d(1.0, 2.0, 3.0)
     vec2 = Vector3d(3.0, 2.0, 1.0)
     scalar_product = vec1.scalar_product(vec2.x, vec2.y, vec2.z)
     self.assertEqual(scalar_product, 10.0)
 def test_calc_negative_scalar_product(self):
     vec1 = Vector3d(-4.3, 2.5, -3.0)
     vec2 = Vector3d(3.6, 2.0, -6.6)
     scalar_product = vec1.scalar_product(vec2.x, vec2.y, vec2.z)
     self.assertAlmostEqual(scalar_product, 9.32, 2)
 def test_calc_chebyshev_norma_z_max(self):
     vec = Vector3d(-4.0, 20.0, -34.0)
     norma = vec.calc_norma(norma_type='chebyshev')
     self.assertAlmostEqual(norma, 34, 0)
 def test_calc_euclid_norma_zeros(self):
     vec = Vector3d(0.0, 0.0, 0.0)
     norma = vec.calc_norma()
     self.assertAlmostEqual(norma, 0, 0)
 def test_calc_chebyshev_norma_zeros(self):
     vec = Vector3d(0.0, 0.0, 0.0)
     norma = vec.calc_norma(norma_type='chebyshev')
     self.assertAlmostEqual(norma, 0, 0)
 def test_can_not_create_1_2_3_vector(self):
     vec = Vector3d(1, 2, 3)
     self.assertTrue(not vec.is_equal(1.1, 2.1, 3.1))
 def test_calc_normalization_1_3_4(self):
     vec = Vector3d(1.0, 3.0, 4.0)
     normalization = vec.calc_normalization()
     vec_params = [0.196, 0.588, 0.784]
     for val1, val2 in zip(normalization, vec_params):
         self.assertAlmostEqual(val1, val2, 3)
 def test_calc_euclid_norma_1_3_4(self):
     vec = Vector3d(1.0, 3.0, 4.0)
     norma = vec.calc_norma()
     self.assertAlmostEqual(norma, 5, 0)
 def test_calc_normalization_3_4_5(self):
     vec = Vector3d(3.0, 4.0, 5.0)
     normalization = vec.calc_normalization()
     vec_params = [0.424, 0.5656, 0.707]
     for val1, val2 in zip(normalization, vec_params):
         self.assertAlmostEqual(val1, val2, 3)
 def test_calc_euclid_norma_3_4_5(self):
     vec = Vector3d(3.0, 4.0, 5.0)
     norma = vec.calc_norma()
     self.assertAlmostEqual(norma, 7.07, 2)