Ask Your Question

Revision history [back]

The tetratrahedron function only constructs a regular tetrahedron, it seems, so you need to construct yours by hand. The polygons3d function works for this: you specify a list of vertices and also a list of polygons made up of those vertices. For example:

faces = [(0,1,2), (0,1,3), (0,2,3), (1,2,3)]
vertices = [(0,0,0), (1,0,0), (0,1,0), (0,0,1)]
T1 = polygons3d(faces, vertices, color='red')

will use the specified vertices and then construct triangles using vertices numbered 0,1,2 from the list, and vertices 0,1,3, etc. You can write a function that does this:

def Tetrahedron(vertices, color='red'):
    faces = [(0,1,2), (0,1,3), (0,2,3), (1,2,3)]
    return polygons3d(faces, vertices, color=color)

T1 = Tetrahedron([(0,0,0), (1,0,0), (0,1,0), (0,0,1)], color='red')
T2 = Tetrahedron([(1,0,0), (0,1,0), (0,0,1), (1,0,1)], color='green')
T3 = Tetrahedron([(0,1,0), (0,0,1), (1,0,1), (0,1,1)], color='blue')
T1+T2+T3