sum of vectors errors?!

24 views
Skip to first unread message

EDUCATIA SUPERLATIV

unread,
Nov 24, 2025, 5:39:11 AM (11 days ago) Nov 24
to VPython-users
Hi,

I have this code
    let sqr3t = 1.732050
    let Bpoz =  vec(pozCenter.x, pozCenter.y, pozCenter.z)
    let ssqrt = 3*sqr3t-0.75*sqr3t
    let Apoz =  Bpoz + vec(ssqrt, 3, 0)
   time_label.text =  Apoz
I code gives errors at SUM of Vectors (Bpoz + vec...)
In  time_label.text is shown two vectors not only one!

What am I doing wrong?

Best regards,
Ciprian


EDUCATIA SUPERLATIV

unread,
Nov 24, 2025, 6:35:08 AM (11 days ago) Nov 24
to VPython-users
I solved by calculating SUM of vectors each-by-each direction!
But, in the DOCS is explained that SUM of vectors should work!

Best regards,

Michael Burns-Kaurin

unread,
Nov 24, 2025, 10:01:38 AM (11 days ago) Nov 24
to vpytho...@googlegroups.com
What are time_label and pozCenter?

What you describe, sounds like it's doing text concatenation??

--
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/8898f4c2-cf02-4ac4-a7e5-6d13171f3fffn%40googlegroups.com.

EDUCATIA SUPERLATIV

unread,
Nov 24, 2025, 11:55:30 AM (11 days ago) Nov 24
to VPython-users
time_label is a label, let time_label = label({pos:vecTime, text:timeini,...
pozCenter is a vector. Both are defined!

Label can show vectors as   time_label.text =  Apoz, whre Apoz is a vector
But here the error is from the SUM of vectors!
time_label shows two vectors, not only one. 
Like this ”<x1,y1,z1><x2, y2, z2>”
Why?

Michael Burns-Kaurin

unread,
Nov 24, 2025, 3:43:47 PM (10 days ago) Nov 24
to vpytho...@googlegroups.com

EDUCATIA SUPERLATIV

unread,
Nov 25, 2025, 5:53:43 AM (10 days ago) Nov 25
to VPython-users
Yes, in pure Python, but I'm using it in HTML!
Probably here could be an error!!!

Or...
Should I use it in a sentence exactly like this: ”Apoz = Bpoz["+"](vec(ssqrt, 3, 0));”? 
What is the difference?

Best regards,
Ciprian

John

unread,
Nov 25, 2025, 11:43:03 AM (10 days ago) Nov 25
to VPython-users
If you go to the glowscript example provided earlier

https://glowscript.org/#/user/burnskaurinmichael/folder/MyPrograms/program/labelplay/edit

and click on  Share or export this program

you can see the options to share it in HTML. It also includes in the entire HTML file and the javascript with lines like

Bpoz = vec(pozCenter.x, pozCenter.y, pozCenter.z);

and 


Apoz = Bpoz["+"](vec(ssqrt, 3, 0));


Reply all
Reply to author
Forward
0 new messages