Jupyter VPython 2.0.2

71 views
Skip to first unread message

Bruce Sherwood

unread,
Feb 23, 2017, 7:41:10 AM2/23/17
to Project Jupyter
There is a new version 2.0.2 of Jupyter VPython, the 3D graphics module (pip install vpython or pip install vpython --upgrade; see vpython.org for more details):

* It supports extrusion and 3D text objects.

* There are important improvements to the way compound objects work.

* The axis and up attributes of an object are now always perpendicular to each other.

EXTRUSION AND 3D TEXT
The extrusion object lets you specify a 2D shape and a path along which to extrude that shape. Here is an example and the documentation:
 
    
The text object creates an extrusion of a specified text, making 3D text available in a scene. Here is an example and the documentation:


CHANGES TO COMPOUND OBJECTS
Working with compound objects in GlowScript 2.1 uncovered some significant design issues which later versions of GlowScript addressed. Here are the changes to the compound object, which are part of the Jupyter VPython 2.0.2 release:
 
1) The compound object is now very similar to the box object. In GlowScript 2.1 (and up till now in Jupyter VPython), the bounding box (size) was vector(1,1,1), the actual bounding box was not known, and size could only be changed multiplicatively. In later versions of GlowScript the bounding box (size) is the actual size of the object, which can be changed by setting size to the desired value.
 
2) Now, when you create a compound object, the value of "pos" is set to the computed center of the object. If you specify "pos" when creating the object, the object is moved so that its center is located at the new location.

3) As with other objects such as box or cylinder, changing the axis of an extrusion or compound object not only rotates the object but its length (size.x) is set equal to the magnitude of the axis vector. Similarly, changing the size sets the magnitude of the axis vector to be equal to the length (size.x).
 
Here is the documentation on the updated compound object:
 
    
AXIS AND UP KEPT PERPENDICULAR TO EACH OTHER
Jupyter VPython 2.0.2 incorporates changes implemented in GlowScript 2.4 that fixed a long-standing error in changing "axis" without updating "up" to remain perpendicular to axis (and vice versa). The result was that rotating an object by continually changing its axis could cause abrupt changes in the appearance of the object. This was noticeable only if an object had a texture or a compound object lacked symmetry, which is presumably why the problem doesn't seem to have been noted for many years.

Here is an example of a program running in GlowScript 2.3 that illustrates the problem. Note that "up" doesn't change, and there's a problem when "axis" and "up" point in the same direction:


Here is the same program running GlowScript 2.4 (or Jupyter VPython 2.0), which works properly. Note that "axis" and "up" are always perpendicular to each other:


For further details, see 


GLOWSCRIPT VPYTHON CLOSER TO TRUE VPYTHON
The RapydScript Python-to-JavaScript transpiler used with GlowScript VPython now comes closer to handling standard Python syntax, which will facilitate moving programs between GlowScript and Juptyer environments. The new transpiler is RapydScript-NG, developed by Kovid Goyal. For example, among its features is that it provides most of the standard Python string methods: capitalize, strip, lstrip, rstrip, islower, isupper, isspace, lower, upper, swapcase, center, count, endswith, startswith, find, rfind, index, rindex, format, join, ljust, rjust, partition, rpartition, replace, split, rsplit, splitlines, and zfill.

Matthias Bussonnier

unread,
Feb 23, 2017, 12:30:38 PM2/23/17
to jup...@googlegroups.com
Thanks you for the detail announce !
--
M
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/2485b4f8-f66a-49b6-9ce9-11f084182634%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Bruce Sherwood

unread,
Feb 26, 2017, 6:34:15 PM2/26/17
to Project Jupyter
With crucial help from John Coady, there is a version 2.0.6 that works successfully at mybinder.org:


It lets you run Jupyter VPython programs even on computers or mobile devices that do not have Python installedHere is an explanation of the Binder mechanism. Because the Binder servers are shared among a large number of people, performance can vary a great deal from day to day and from hour to hour.

Also, this version 2.0.6 fixes a bug in the use of the shapes library when using Python 2.7.
Reply all
Reply to author
Forward
0 new messages