#### 5.1 3-d plot of a tetrahedron (6.9.00)

##### 5.1.1 John J. Reinmann (23.10.01)

Can anyone show me an eﬃcient way to get a 3-D plot of the tetrahedron formed by the following four points in 3-space:

(1,4,-1), (2,0,0), (-1,-4,3), (4,5,7) ?



I would like each surface to have a diﬀerent color.

##### 5.1.2 Robert Israel (7.9.00)

Sure.

  pts:= [[1,4,-1], [2,0,0], [-1,-4,3], [4,5,7]];
triples:= combinat[choose](pts, 3);
colours:= [seq(colour=COLOUR(RGB,op(j)), j=_COLORRGB)];
plots[display](zip(plots[polygonplot3d], triples, colours),
scaling=constrained);



##### 5.1.3 Carl DeVore (7.9.00)

Here’s a proc to draw any tetrahedron with any four colors.

 DrawTetrahedron:= proc(Pts,Colors)
local it,k;
it:= combstruct[iterstructs](Combination(Pts), size= 3);
RETURN
(plots[display]
([seq
(plots[display]
(PLOT3D(POLYGONS(combstruct[nextstruct](it)))
,color= Colors[k]
)
,k= 1..4
)
], args[3..nargs]
)
)
end:

DrawTetrahedron
([[1,4,-1],[2,0,0],[-1,-4,3],[4,5,7]]
,[red,green,blue,yellow]
,axes= boxed
);



##### 5.1.4 John S Robinson (8.9.00)

This works:

> with(combinat):
> vertices:=[[1,4,-1], [2,0,0], [-1,-4,3], [4,5,7]];

vertices := [[1, 4, -1], [2, 0, 0], [-1, -4, 3], [4, 5, 7]]

> faces:=choose(vertices,3);

faces := [[[1, 4, -1], [2, 0, 0], [-1, -4, 3]],

[[1, 4, -1], [2, 0, 0], [4, 5, 7]],

[[1, 4, -1], [-1, -4, 3], [4, 5, 7]],

[[2, 0, 0], [-1, -4, 3], [4, 5, 7]]]

> PLOT3D(POLYGONS(op(faces)));



... but it was lucky you wanted a tetrahedron, since all triples of vertices are the faces.

I wish there were some way to plug our own co-ordinates into plotpolyhedra().

##### 5.1.5 Klaus Volpert (12.9.00)
with(plots):with(plottools):
a:=[1,4,-1]:
b:=[2,0,0]:
c:=[-1,-4,3]:
d:=[4,5,7]:
side1:=polygon([a,b,c],color=green):
side2:=polygon([a,b,d],color=red):
side3:=polygon([a,c,d],color=blue):
side4:=polygon([b,c,d],color=gold):
display([side1,side2,side3,side4]);



##### 5.1.6 Helmut Kahovec (14.9.00)

You may use gtetrahedron() of the geom3d package:

restart;
with(geom3d):
Warning, the name polar has been redefined

point(P1,1,4,-1),point(P2,2,0,0),point(P3,-1,-4,3),point(P4,4,5,7);

P1, P2, P3, P4

gtetrahedron(T,[P1,P2,P3,P4]);

T

draw(T,axes=BOXED,scaling=UNCONSTRAINED,labels=[x,y,z]);