Example #1
0
 def test_squared_length_batch(self):
     result = vector3.squared_length([
         [1., 1., 1.],
         [-1., -1., -1.],
         [0., 2., 7.],
     ])
     expected = [
         3.,
         3.,
         53.,
     ]
     np.testing.assert_almost_equal(result, expected, decimal=5)
Example #2
0
 def test_squared_length_batch(self):
     result = vector3.squared_length([
         [1.,1.,1.],
         [-1.,-1.,-1.],
         [0.,2.,7.],
     ])
     expected = [
         3.,
         3.,
         53.,
     ]
     np.testing.assert_almost_equal(result, expected, decimal=5)
 def update(self, delta, camera):
     from Claver.assistant.avatar.entities.Player import Player
     self.__velocity.y += Player.GRAVITY * self.__gravityEffect * delta
     change = Vector3(
         (self.__velocity.x, self.__velocity.y,
          self.__velocity.z))  # create a copy by value - not by reference
     change *= delta  # scale vector
     self.__position += change  # add two vectors together
     distance = vector3.squared_length(camera.getPosition() -
                                       self.__position)
     self.__updateTextureCoordInfo()
     self.__elapsedTime += delta
     return self.__elapsedTime < self.__lifeLength
Example #4
0
 def test_squared_length_single_vector(self):
     result = vector3.squared_length([1., 1., 1.])
     np.testing.assert_almost_equal(result, 3., decimal=5)
Example #5
0
 def test_squared_length_single_vector(self):
     result = vector3.squared_length([1.,1.,1.])
     np.testing.assert_almost_equal(result, 3., decimal=5)