def test_vector3f_init(): a = pyjet.Vector3F() assert a.x == 0.0 assert a.y == 0.0 assert a.z == 0.0 b = pyjet.Vector3F(1, 2, 3) assert b.x == 1.0 assert b.y == 2.0 assert b.z == 3.0 c = pyjet.Vector3F(y=2, x=1, z=3) assert c.x == 1.0 assert c.y == 2.0 assert c.z == 3.0
def testInit(self): a = pyjet.Vector3F() self.assertEqual(a.x, 0.0) self.assertEqual(a.y, 0.0) self.assertEqual(a.z, 0.0) b = pyjet.Vector3F(1, 2, 3) self.assertEqual(b.x, 1.0) self.assertEqual(b.y, 2.0) self.assertEqual(b.z, 3.0) c = pyjet.Vector3F(y=2, x=1, z=3) self.assertEqual(c.x, 1.0) self.assertEqual(c.y, 2.0) self.assertEqual(c.z, 3.0)
def test_vector3f_setters(): a = pyjet.Vector3F(1, 2, 3) a[0] = 4 a[1] = 5 a[2] = 6 assert a[0] == 4 assert a[1] == 5 assert a[2] == 6
def testSetters(self): a = pyjet.Vector3F(1, 2, 3) a[0] = 4 a[1] = 5 a[2] = 6 self.assertEqual(a[0], 4) self.assertEqual(a[1], 5) self.assertEqual(a[2], 6)
def test_vector3f_calc(): a = pyjet.Vector3F(1, 2, 3) b = pyjet.Vector3F(4, 6, 8) c = a + b assert c.x == 5.0 assert c.y == 8.0 assert c.z == 11.0 c = a - b assert c.x == -3.0 assert c.y == -4.0 assert c.z == -5.0 c = a * b assert c.x == 4.0 assert c.y == 12.0 assert c.z == 24.0 c = a / b assert c.x == approx(1.0 / 4.0) assert c.y == approx(1.0 / 3.0) assert c.z == approx(3.0 / 8.0)
def testCalc(self): a = pyjet.Vector3F(1, 2, 3) b = pyjet.Vector3F(4, 6, 8) c = a + b self.assertEqual(c.x, 5.0) self.assertEqual(c.y, 8.0) self.assertEqual(c.z, 11.0) c = a - b self.assertEqual(c.x, -3.0) self.assertEqual(c.y, -4.0) self.assertEqual(c.z, -5.0) c = a * b self.assertEqual(c.x, 4.0) self.assertEqual(c.y, 12.0) self.assertEqual(c.z, 24.0) c = a / b self.assertAlmostEqual(c.x, 1.0 / 4.0) self.assertAlmostEqual(c.y, 1.0 / 3.0) self.assertAlmostEqual(c.z, 3.0 / 8.0)
def testInit(self): a = pyjet.BoundingBox3F() self.assertGreater(a.lowerCorner.x, a.upperCorner.x) self.assertGreater(a.lowerCorner.y, a.upperCorner.y) self.assertGreater(a.lowerCorner.z, a.upperCorner.z) b = pyjet.BoundingBox3F((-1, -2, -3), (4, 2, 5)) self.assertEqual(b.lowerCorner.x, -1.0) self.assertEqual(b.lowerCorner.y, -2.0) self.assertEqual(b.lowerCorner.z, -3.0) self.assertEqual(b.upperCorner.x, 4.0) self.assertEqual(b.upperCorner.y, 2.0) self.assertEqual(b.upperCorner.z, 5.0) l, c = pyjet.Vector3F(-1, -2, -3), pyjet.Vector3F(4, 2, 5) c = pyjet.BoundingBox3F(l, c) self.assertEqual(c.lowerCorner.x, -1.0) self.assertEqual(c.lowerCorner.y, -2.0) self.assertEqual(c.lowerCorner.z, -3.0) self.assertEqual(c.upperCorner.x, 4.0) self.assertEqual(c.upperCorner.y, 2.0) self.assertEqual(c.upperCorner.z, 5.0)
def test_bounding_box3f_init(): a = pyjet.BoundingBox3F() assert a.lowerCorner.x > a.upperCorner.x assert a.lowerCorner.y > a.upperCorner.y assert a.lowerCorner.z > a.upperCorner.z b = pyjet.BoundingBox3F((-1, -2, -3), (4, 2, 5)) assert b.lowerCorner.x == -1.0 assert b.lowerCorner.y == -2.0 assert b.lowerCorner.z == -3.0 assert b.upperCorner.x == 4.0 assert b.upperCorner.y == 2.0 assert b.upperCorner.z == 5.0 l, c = pyjet.Vector3F(-1, -2, -3), pyjet.Vector3F(4, 2, 5) c = pyjet.BoundingBox3F(l, c) assert c.lowerCorner.x == -1.0 assert c.lowerCorner.y == -2.0 assert c.lowerCorner.z == -3.0 assert c.upperCorner.x == 4.0 assert c.upperCorner.y == 2.0 assert c.upperCorner.z == 5.0
def test_vector3f_getters(): a = pyjet.Vector3F(1, 2, 3) assert a[0] == 1 assert a[1] == 2 assert a[2] == 3
def testGetters(self): a = pyjet.Vector3F(1, 2, 3) self.assertEqual(a[0], 1) self.assertEqual(a[1], 2) self.assertEqual(a[2], 3)