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.