Ask Your Question
1

tetrahedron with each face differently colored?

asked 2023-09-11 00:32:52 +0200

Tintin1 gravatar image

updated 2023-09-11 01:02:11 +0200

I am running the code

G = tetrahedron(color='blue') 
G.show(aspect_ratio=[1,1,1])

It tried the following:

G = tetrahedron(color=['blue',"green","red","yellow]) 
G.show(aspect_ratio=[1,1,1])

without success.

I want the tetrahedron to be colored for each face differently. Can I do that?

For cubes,

G = cube(color=['red', 'green', 'blue'], opacity=0.9)
G.show(aspect_ratio=[1,1,1])

gives the required coloring.

edit retag flag offensive close merge delete

Comments

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-10-06 23:34:22 +0200

dan_fulea gravatar image

We take the tetrahedron as it comes, so we do not get wet with the definition of the faces, then manufacture the same faces with our objects in a disjoint, disconnected manner, each object comes with its own color.

T = tetrahedron()
colors = ('blue', 'lightgreen', 'tan', 'gray')
sum([polygon3d(face, color=color) for face, color in zip(T.face_list(), colors)])

This gave me after playing with the picture in the browser to show three faces at least:

tetrahedron

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2023-09-11 00:32:52 +0200

Seen: 93 times

Last updated: Oct 06 '23