Trying to build a tetrahedron

59 views
Skip to first unread message

Gilles Dubois

unread,
Jul 4, 2025, 6:25:15 AMJul 4
to VPython-users
Hi !
This is just a test program .
Although I know that it would be much simpler using simple triangles,  I will need my 'polygon' object for future applications. So it's an opportunity to test it. It seems to work.
I make 4 copies of the same basic equilateral triangle designed as a general 'polygon'.
I rotate 3 of them, taking the edges as axis, with angle pi/3.
I notice that there is a gap between original (green) and rotated images (yellow , blue, red) and I don't understand why.
Can anybody explain ?
Capture d’écran du 2025-07-04 12-23-27.png

Kevin Karplus

unread,
Jul 4, 2025, 10:40:18 AMJul 4
to vpytho...@googlegroups.com
I've not looked at your code closely, but are you rotating about the (0,0,0) point instead a point on the edge?

Professor Emeritus, UC, Santa Cruz
Affiliations for identification only.




--
You received this message because you are subscribed to the Google Groups "VPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vpython-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vpython-users/3acf5c5a-65d2-4d95-8793-30ca4eb4bf39n%40googlegroups.com.

Gilles Dubois

unread,
Jul 4, 2025, 11:43:00 AMJul 4
to vpytho...@googlegroups.com

Hi Kevin !

I know about rotation around a point in the plane but I know only about rotation around an axis in space. a,b,c are the vertexes of all three copies which cover each other. Any rotation axis is specified by a vector difference of two vertexes and as origin a point which is a vertex, hence on a edge. So my idea was to simulate some kind of unfolding the three faces, leaving the base on the ground. The inclinations as well as the dimensions of the 'walls' seem to be correct, but actually it seems we are turning not around the correct axis. I want to develop polytopes as origamis.

John

unread,
Jul 4, 2025, 2:05:57 PMJul 4
to VPython-users
Have a look at some of the vpython demo programs that perform rotations, maybe you can get some insights from them to achieve what you are trying to do. Maybe you can try animating your rotations to see what the rotation is doing.

https://glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/BoxLightTest
Message has been deleted
Message has been deleted

Kevin Karplus

unread,
Jul 4, 2025, 4:51:08 PMJul 4
to vpytho...@googlegroups.com
I think I see the problem.  You set the position, but not the origin, of the compound object.  I think the origin is then the center of the bounding box, which is not (0,0,0).  I think it might have worked if you had set the origin, but not the position.

Professor Emeritus, UC, Santa Cruz
Affiliations for identification only.



Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Gilles Dubois

unread,
Jul 5, 2025, 6:49:35 AMJul 5
to VPython-users
You're right Kevin !
Here is a corrected version link
Another mistake was the value of the angle acos(1/3) and not pi/3
Thanks to all of you for your help.

Gilles Dubois

unread,
Jul 5, 2025, 6:49:35 AMJul 5
to vpytho...@googlegroups.com

I tried some of your suggestions

Here is a simplified version with only one copy of the base triangle turning endlessly with animation.

What we can see :

  • Direction of axis of rotation is good
  • position 'a' is correct, exactly what it should be

So instruction origin=a (from Official help) is ignored or misinterpreted.

    Don't know what to do ...

Gilles Dubois

unread,
Jul 5, 2025, 6:49:35 AMJul 5
to VPython-users
You're right Kevin !
I arrived to the same conclusion after a long conversation with Mr Grok.
And an additional error for the value of rotation angle correct value is acos(1/3) and not pi/3
So here is a link to the correct version
Of course I could avoid the compound problem by using simple triangles, but my purpose is to go farther so to have the right tools from the beginning
Thanks again to all of you !
Le vendredi 4 juillet 2025 à 22:51:08 UTC+2, kar...@soe.ucsc.edu a écrit :

Gilles Dubois

unread,
Jul 5, 2025, 6:49:35 AMJul 5
to VPython-users

Hi John !

I tried some of your suggestions

Here is a simplified version with only one copy of the base triangle turning endlessly with animation.

What we can see :

  • Direction of axis of rotation is good
  • position 'a' is correct, exactly what it should be

So instruction origin=a (from Official help) is ignored or misinterpreted.

    Don't know what to do ...


Gilles Dubois

unread,
Jul 5, 2025, 6:49:36 AMJul 5
to VPython-users
Hi John !

I tried some of your suggestions

Here is a simplified version with only one copy of the base triangle turning endlessly with animation.

What we can see :

  • Direction of axis of rotation is good
  • position 'a' is correct, exactly what it should be

So instruction origin=a (from Official help) is ignored or misinterpreted.


Le vendredi 4 juillet 2025 à 20:05:57 UTC+2, john...@shaw.ca a écrit :

Gilles Dubois

unread,
Jul 5, 2025, 6:49:48 AMJul 5
to VPython-users
Thank you Kevin !
Le vendredi 4 juillet 2025 à 22:51:08 UTC+2, kar...@soe.ucsc.edu a écrit :

Gilles Dubois

unread,
Jul 5, 2025, 6:49:48 AMJul 5
to VPython-users
You're right Kevin but I cannot answer, all my messages are wiped out

Le vendredi 4 juillet 2025 à 22:51:08 UTC+2, kar...@soe.ucsc.edu a écrit :

Gilles Dubois

unread,
Jul 5, 2025, 6:49:49 AMJul 5
to VPython-users
You're right Kevin !
Here is a corrected version link
Another mistake was the value of the angle acos(1/3) and not pi/3
Thanks to all of you for your help.

Le vendredi 4 juillet 2025 à 22:51:08 UTC+2, kar...@soe.ucsc.edu a écrit :

Gilles Dubois

unread,
Jul 5, 2025, 6:49:49 AMJul 5
to VPython-users
Sorry but it seems to me I am black-listed. Impossible to send any additional message


Le vendredi 4 juillet 2025 à 22:51:08 UTC+2, kar...@soe.ucsc.edu a écrit :

John

unread,
Jul 5, 2025, 7:15:09 AMJul 5
to VPython-users
When having a conversion with Grok AI about Web VPython, I find it helpful to feed Grok the all the online links to the VPython documentation and tell Grok to use it as context when answering the question. I have collected the links in the following attached file. Just paste all of these links into the Grok prompt when having a conversation about Web Vpython.
vpython_doc_links.txt

Gilles Dubois

unread,
Jul 5, 2025, 9:46:49 AMJul 5
to VPython-users
Very good initiative John !
I don't know if Grok learns but it seems to me that he already knows a lot about Vpython. I see that my messages, all of them more or less the same content, have been restored , and now, although I'm recognized as the author I cannot cancel them. Maybe I should ask Grok what happened ? After a short experience I went back to Pycharm. Difficult for me to use other editors it is so smart, so useful, so secure. Trinket is good for publishing  anyway but, according my experience,  refuses inclusions for Python files located in the same directory. 
Reply all
Reply to author
Forward
0 new messages