Ask Your Question
1

tetrahedron with each face differently colored?

asked 1 year ago

Tintin1 gravatar image

updated 1 year ago

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.

Preview: (hide)

Comments

1 Answer

Sort by » oldest newest most voted
2

answered 1 year ago

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

Preview: (hide)
link

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: 1 year ago

Seen: 179 times

Last updated: Oct 06 '23