Major improvement in the use of vectors

22 views
Skip to first unread message

Bruce Sherwood

unread,
Oct 11, 2017, 10:13:17 AM10/11/17
to Glowscript Users
It has been a problem that errors in the use of vectors and scalars, such as "x = 10 + vec(1,2,3)", did not generate an informative error message. Rather, such statements set x to "NaN", meaning "not a number", which caused errors when using x later in the program.

Now such errors give a message such as "Cannot add a scalar and a vector".

Also, if v was vector you couldn't say "v += vec(10,1,0)", but now you can. You can also use -=, *=, and /=.

Version 2.6 has been updated to provide these improvements.

There is one such issue that has not been addressed, which is that if v is a vector, v**2 is not caught as an error but gives the value "NaN".

Bruce

Bruce Sherwood

unread,
Oct 11, 2017, 10:39:46 AM10/11/17
to Glowscript Users
And now trying to raise a vector to a power gives an error message instead of producing "NaN".


Bruce Sherwood

unread,
Oct 12, 2017, 10:57:52 AM10/12/17
to Glowscript Users
Also, if on a graph you try to plot something that's not a number you get an informative message, either "Cannot plot a vector, only a vector component." or (if not a vector) "A quantity to plot must be an ordinary number."

Reply all
Reply to author
Forward
0 new messages