def test_octant(self): x = Vector((1/2,0,0)) y = Vector((0,1/2,0)) z = Vector((0,0,1/2)) tet = Tetrahedron(x.length(), y.length(), z.length(), (x-y).length(), (x-z).length(), (y-z).length()) self.assertAlmostEqual(tet.xyz_volume(), 1/6, 5) # good to 5 places
def test_xyz_cube(self): a = Vector((0.5, 0.0, 0.0)) b = Vector((0.0, 0.5, 0.0)) c = Vector((0.0, 0.0, 0.5)) tet = Tetrahedron(a.length(), b.length(), c.length(), (a-b).length(), (b-c).length(), (c-a).length()) self.assertAlmostEqual(6*tet.xyz_volume(), 1.0, 4) # good to 4 places
def test_octahedron(self): a = Vector((1,0,0)) b = Vector((0,1,0)) c = Vector((0.5,0.5,sqrt(2)/2)) tet = Tetrahedron(a.length(), b.length(), c.length(), (a-b).length(), (b-c).length(), (c-a).length()) self.assertAlmostEqual(tet.ivm_volume(), 1.0, 5) # good to 5 places
def test_xyz_cube(self): a = Vector((0.5, 0.0, 0.0)) b = Vector((0.0, 0.5, 0.0)) c = Vector((0.0, 0.0, 0.5)) R_octa = Tetrahedron(a.length(), b.length(), c.length(), (a - b).length(), (b - c).length(), (c - a).length()).xyz_volume() self.assertAlmostEqual(6 * R_octa, Decimal(1), 4) # good to 4 places
def test_quarter_octahedron(self): a = Vector((1, 0, 0)) b = Vector((0, 1, 0)) c = Vector((0.5, 0.5, root2 / 2)) tet = Tetrahedron(a.length(), b.length(), c.length(), (a - b).length(), (b - c).length(), (c - a).length()) self.assertAlmostEqual(tet.ivm_volume(), Decimal(1), 5) # good to 5 places
def test_octant(self): x = Vector((0.5, 0, 0)) y = Vector((0, 0.5, 0)) z = Vector((0, 0, 0.5)) tet = Tetrahedron(x.length(), y.length(), z.length(), (x - y).length(), (x - z).length(), (y - z).length()) self.assertAlmostEqual(tet.xyz_volume(), Decimal(1) / Decimal(6), 5) # good to 5 places
def test_s3(self): D_tet = Tetrahedron(D, D, D, D, D, D) a = Vector((0.5, 0.0, 0.0)) b = Vector((0.0, 0.5, 0.0)) c = Vector((0.0, 0.0, 0.5)) R_cube = 6 * Tetrahedron(a.length(), b.length(), c.length(), (a-b).length(), (b-c).length(), (c-a).length()).xyz_volume() self.assertAlmostEqual(D_tet.xyz_volume() * sqrt(9/8), R_cube, 4)
def test_s3(self): D_tet = Tetrahedron(D, D, D, D, D, D) a = Vector((0.5, 0.0, 0.0)) b = Vector((0.0, 0.5, 0.0)) c = Vector((0.0, 0.0, 0.5)) R_cube = 6 * Tetrahedron(a.length(), b.length(), c.length(), (a - b).length(), (b - c).length(), (c - a).length()).xyz_volume() self.assertAlmostEqual(D_tet.xyz_volume() * S3, R_cube, 4)