Odd behavior from list of vectors

18 views
Skip to first unread message

Josh Gates

unread,
Mar 12, 2018, 11:31:31 AM3/12/18
to glowscri...@googlegroups.com
Does anybody know why this:
a = [vector(1,0,2),vector(1,1,2),vector(-2,1,3),vector(4,4,2)]
b = vector(1,1,1)
c = vector(-2,1,3)
print (b in a, c in a)

would return:
False,False?

Thanks,
jg

--
Joshua Gates

Bruce Sherwood

unread,
Mar 12, 2018, 11:45:58 AM3/12/18
to Glowscript Users
I was unable to make A == B work for vectors in GlowScript VPython; one must use the function A.equals(B), which the list machinery doesn't know about.

I should try again, but I'm not hopeful.

Bruce

Josh Gates

unread,
Mar 12, 2018, 12:00:16 PM3/12/18
to Glowscript Users
Thanks for the help - I can make that work. 

Bruce Sherwood

unread,
Mar 12, 2018, 12:33:32 PM3/12/18
to Glowscript Users
I did just now try again and failed again. The basic problem is that RapydScript does some complex operations involving equality of objects that are incompatible with me trying to do some, too.

Bruce
Reply all
Reply to author
Forward
0 new messages