Skip to content

Commit a0cfd87

Browse files
authored
Merge pull request #6 from trinketapp/v3.2.0
V3.2.0
2 parents 1083775 + d71dc3c commit a0cfd87

193 files changed

Lines changed: 2610 additions & 4437 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ForInstalledPython/glow.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GlowScriptOffline/GlowScript.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
<script type="text/javascript" src="glowscript_libraries/jquery.min.js"></script>
4343
<script type="text/javascript" src="glowscript_libraries/jquery-ui.custom.min.js"></script>
4444
<script type="text/javascript" src="glowscript_libraries/editor.js"></script>
45-
<script type="text/javascript" src="glowscript_libraries/RSrun.3.1.min.js"></script>
46-
<script type="text/javascript" src="glowscript_libraries/glow.3.1.min.js" charset="UTF-8"></script>
45+
<script type="text/javascript" src="glowscript_libraries/RSrun.3.2.min.js"></script>
46+
<script type="text/javascript" src="glowscript_libraries/glow.3.2.min.js" charset="UTF-8"></script>
4747
<script type="text/javascript" src="glowscript_libraries/split.min.js"></script>
4848
<script type="text/javascript" src="glowscript_libraries/Roboto_Medium_ttf_sans.js"></script>
4949
<script type="text/javascript" src="glowscript_libraries/NimbusRomNo9L_Med_otf_serif.js"></script>
@@ -60,7 +60,7 @@
6060
<input type="file" id="read_local_file"/>
6161

6262
<script>
63-
var gsversion = '3.1'
63+
var gsversion = '3.2'
6464
var printpane = false
6565
var exporting = false // not currently in export mode
6666
var lastprintwidth = null

GlowScriptOffline/VPythonDocs/MathJax.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" --><head>
22
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
33
<!-- InstanceBeginEditable name="doctitle" -->
4-
<title>VPython Help</title>
4+
<title>MathJax</title>
55
<!-- InstanceEndEditable -->
66
<!-- InstanceBeginEditable name="head" -->
77
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
@@ -12,10 +12,10 @@
1212
<div id="wrapper">
1313
<div id="leftmenu">
1414
<p class="Normal"><a href="index.html">&nbsp;&nbsp;Home</a></p>
15-
<p class="Normal">&nbsp;&nbsp;If you're new to Python <br />
16-
&nbsp;&nbsp;and VPython: <a href="VisualIntro.html">Introduction</a></p>
17-
<p class="Normal">&nbsp;&nbsp;A VPython <a href="VPython_Intro.pdf" target="_blank">tutorial</a></p>
18-
<p class="Normal"><a href="videos.html">&nbsp;&nbsp;Introductory Videos</a></p>
15+
<p class="Normal">&nbsp;&nbsp; <a href="VisualIntro.html">Overview of Python &amp; VPython<br>
16+
</a></p>
17+
<p class="Normal"><a href="https://trinket.io/matter-interactions/courses/00_welcome_to_vpython#/welcome-to-vpython/getting-started">&nbsp;&nbsp;&quot;Welcome to VPython&quot; tutorial</a></p>
18+
<p class="Normal"><a href="videos.html">&nbsp;&nbsp;Introductory Videos</a></p>
1919
<p class="Normal"><a href="primitives.html">&nbsp;&nbsp;Pictures</a> of 3D objects</p>
2020
<p>&nbsp;&nbsp;<select id="menu1" onChange="jumpMenu(this)"></select></p>
2121
<p>&nbsp;&nbsp;<select id="menu2" onChange="jumpMenu(this)"></select></p>
@@ -30,12 +30,12 @@
3030
<div id="content">
3131
<!-- InstanceBeginEditable name="content" -->
3232
<div>
33-
<h1 class="Heading-1"><font color="#0000A0">Math displays using LaTeX</font> - GlowScript VPython only</h1>
33+
<h1 class="Heading-1"><font color="#0000A0">Math displays using LaTeX</font> - Web VPython only</h1>
3434
</div>
3535
<div>
36-
<p class="Normal">In GlowScript VPython (but not currently in VPython 7) you can display complex mathematical expressions expressed in the widely used math editing format, <a href="http://www.latex-project.org/" target="_blank">LaTeX</a>. Here is <strong><a href="https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/LaTexMathDisplay" target="_blank">an example</a></strong>. The LaTeX capability is provided by <a href="http://www.mathjax.org/" target="_blank">MathJax</a>, which is imported by GlowScript. For example, consider this mathematical display:</p>
36+
<p class="Normal">In Web VPython (but not currently in VPython 7) you can display complex mathematical expressions expressed in the widely used math editing format, <a href="http://www.latex-project.org/" target="_blank">LaTeX</a>. Here is <strong><a href="https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/LaTexMathDisplay" target="_blank">an example</a></strong>. The LaTeX capability is provided by <a href="http://www.mathjax.org/" target="_blank">MathJax</a>, which is imported by Web VPython. For example, consider this mathematical display:</p>
3737
<p class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/MathJax.jpg" width="350" height="48" alt="equation" /></p>
38-
<p class="Normal">You can display this in the caption of an existing GlowScript canvas with the following statements:</p>
38+
<p class="Normal">You can display this in the caption of an existing Web VPython canvas with the following statements:</p>
3939
<p class="program"> box()<br />
4040
scene.caption = &quot;Final kinetic energy = \\( \\dfrac {1} {2}mv_i^{2}+\\int _{i}^{f}\\vec{F}\\circ d \\vec{r} \\)&quot;<br />
4141
<br />

GlowScriptOffline/VPythonDocs/Templates/template.dwt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<div id="wrapper">
1111
<div id="leftmenu">
1212
<p class="Normal"><a href="index.html">&nbsp;&nbsp;Home</a></p>
13-
<p class="Normal">&nbsp;&nbsp;If you're new to Python <br />
14-
&nbsp;&nbsp;and VPython: <a href="VisualIntro.html">Introduction</a></p>
15-
<p class="Normal">&nbsp;&nbsp;A VPython <a href="VPython_Intro.pdf" target="_blank">tutorial</a></p>
16-
<p class="Normal"><a href="videos.html">&nbsp;&nbsp;Introductory Videos</a></p>
13+
<p class="Normal">&nbsp;&nbsp; <a href="VisualIntro.html">Overview of Python &amp; VPython<br>
14+
</a></p>
15+
<p class="Normal"><a href="https://trinket.io/matter-interactions/courses/00_welcome_to_vpython#/welcome-to-vpython/getting-started">&nbsp;&nbsp;&quot;Welcome to VPython&quot; tutorial</a></p>
16+
<p class="Normal"><a href="videos.html">&nbsp;&nbsp;Introductory Videos</a></p>
1717
<p class="Normal"><a href="primitives.html">&nbsp;&nbsp;Pictures</a> of 3D objects</p>
1818
<p>&nbsp;&nbsp;<select id="menu1" onChange="jumpMenu(this)"></select></p>
1919
<p>&nbsp;&nbsp;<select id="menu2" onChange="jumpMenu(this)"></select></p>

GlowScriptOffline/VPythonDocs/VisualIntro.html

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" --><head>
22
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
33
<!-- InstanceBeginEditable name="doctitle" -->
4-
<title>VPython Help</title>
4+
<title>VPython Introduction</title>
55
<!-- InstanceEndEditable -->
66
<!-- InstanceBeginEditable name="head" -->
77
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
@@ -12,10 +12,10 @@
1212
<div id="wrapper">
1313
<div id="leftmenu">
1414
<p class="Normal"><a href="index.html">&nbsp;&nbsp;Home</a></p>
15-
<p class="Normal">&nbsp;&nbsp;If you're new to Python <br />
16-
&nbsp;&nbsp;and VPython: <a href="VisualIntro.html">Introduction</a></p>
17-
<p class="Normal">&nbsp;&nbsp;A VPython <a href="VPython_Intro.pdf" target="_blank">tutorial</a></p>
18-
<p class="Normal"><a href="videos.html">&nbsp;&nbsp;Introductory Videos</a></p>
15+
<p class="Normal">&nbsp;&nbsp; <a href="VisualIntro.html">Overview of Python &amp; VPython<br>
16+
</a></p>
17+
<p class="Normal"><a href="https://trinket.io/matter-interactions/courses/00_welcome_to_vpython#/welcome-to-vpython/getting-started">&nbsp;&nbsp;&quot;Welcome to VPython&quot; tutorial</a></p>
18+
<p class="Normal"><a href="videos.html">&nbsp;&nbsp;Introductory Videos</a></p>
1919
<p class="Normal"><a href="primitives.html">&nbsp;&nbsp;Pictures</a> of 3D objects</p>
2020
<p>&nbsp;&nbsp;<select id="menu1" onChange="jumpMenu(this)"></select></p>
2121
<p>&nbsp;&nbsp;<select id="menu2" onChange="jumpMenu(this)"></select></p>
@@ -33,11 +33,12 @@ <h1 class="Title" align="center"> <font color="#FF0000">Simple 3D Programming
3333

3434
Using VPython</font> </h1>
3535
<div>
36-
<h3 class="Heading-1"> <font color="#0000A0">I. Getting started</font></h3>
37-
<p class="Normal">To write a VPython program in the browser, sign in at glowscript.org, click the link to your programs, then click Create New Program. A blank edit page will open with a header line that says something like &quot;GlowScript 3.0 VPython&quot;. Start typing your program on the second line. Click &quot;Run this program&quot; to try out your program.</p>
36+
<h3><font color="#0000A0">1: Getting started</font>
37+
</h3>
38+
<p class="Normal">To write a VPython program in the browser, sign in at webvpython.org, click the link to your programs, then click Create New Program. A blank edit page will open with a header line that says something like &quot;Web VPython 3.2&quot;. Start typing your program on the second line. Click &quot;Run this program&quot; to try out your program.</p>
3839
</div>
3940
<div>
40-
<h3 class="Heading2"> <font color="#0000A0">The canvas</font></h3>
41+
<h5 class="Heading2"> <font color="#0000A0">The canvas</font></h5>
4142
<p class="Normal"> When using VPython the canvas shows objects in 3D.</p>
4243
<p class="Normal"> (0,0,0) is in the center of the canvas<img src="axes.gif" alt="axes" align="right" /> . The +x axis runs to the right, the +y axis runs up, and the +z axis points out of the screen, toward you.</p>
4344
<p class="Normal"> x, y, and z are measured in whatever units you choose;
@@ -50,17 +51,17 @@ <h3 class="Heading2"> <font color="#0000A0">The canvas</font></h3>
5051

5152
to put both of these objects in the same canvas!)</p>
5253

53-
<h3 class="Heading2"> <font color="#0000A0">The Output window</font></h3>
54+
<h5 class="Heading2"> <font color="#0000A0">The Output window</font></h5>
5455
<p class="Normal"> The output of any -print- statements you execute in your program goes to a scrolling text window underneath the graphics window. You can use this window to print values of variables, print lists, print messages, etc.</p>
5556

56-
<h3 class="Heading2"> <font color="#0000A0">The Code window</font></h3>
57+
<h5 class="Heading2"> <font color="#0000A0">The Code window</font></h5>
5758
<p class="Normal">If you type or copy the following simple program into the program editor and run it (click &quot;Run this program&quot; or press Ctrl-1 or Ctrl-2), you will see
5859
a canvas conatining a red box and a green sphere, as shown in the figure. </p>
5960
<p class="program"> redbox=box(pos=vector(4,2,3),<br />
6061
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size=vector(8,4,6),color=color.red)<br />
6162
ball=sphere(pos=vector(4,7,3),radius=2,color=color.green)</p>
6263
<p class="Normal"> <span class="Heading-1"><img src="spherebox.gif" alt="sphere" align="right" /></span></p>
63-
<h3 class="Heading2"><font color="#0000A0">Viewing the scene</font></h3>
64+
<h5 class="Heading2"><font color="#0000A0">Viewing the scene</font></h5>
6465
<p class="Normal"> In the canvas, click and drag with the right mouse
6566
button (or hold down the Ctrl key while dragging). Drag left or right, and
6667
you rotate around the scene. To rotate around a horizontal axis, drag up
@@ -69,9 +70,10 @@ <h3 class="Heading2"><font color="#0000A0">Viewing the scene</font></h3>
6970
mouse, hold down the left and right buttons; on a 1-button mouse, hold down
7071
the Alt key). To pan left/right and up/down, drag with the shift key held down.</p>
7172

72-
<h3 class="Heading-1"> <font color="#0000A0">II. VPython Entities</font></h3>
73-
74-
<h3 class="Heading2"> <font color="#0000A0">Objects, names, and attributes</font></h3>
73+
<h3><font color="#0000A0">2: VPython Entities</font>
74+
75+
</h3>
76+
<h5 class="Heading2"> <font color="#0000A0">Objects, names, and attributes</font></h5>
7577
<p class="Normal"> The graphical objects you create, such as spheres, boxes,
7678

7779
and curves, continue to exist for the duration of your program, and the
@@ -98,8 +100,7 @@ <h3 class="Heading2"> <font color="#0000A0">Objects, names, and attributes</font
98100
in addition to its radius and location, you might give it attributes such
99101

100102
as mass (<span class="attribute">moon.mass</span>) and momentum (<span class="attribute">moon.momentum</span>).</p>
101-
<h3 class="Heading2"><font color="#0000A0">Vectors</font> </h3>
102-
<p class="program"></p>
103+
<h5 class="Heading2"><font color="#0000A0">Vectors</font> </h5>
103104
<p class="Normal"><span class="Normal">Not all objects in VPython are visible objects. For example,
104105

105106
VPython allows you to create 3D vector quantities, and to perform vector
@@ -115,38 +116,39 @@ <h3 class="Heading2"><font color="#0000A0">Vectors</font> </h3>
115116
<p class="Normal"> If you include print(c), you will see that
116117

117118
it is a vector with components &lt;5, 7, 9&gt;.</p>
118-
<h3 class="Heading2"><font color="#0000A0">Scalar multiplication</font></h3>
119-
<p class="program">d = 3*a # d is a vector with components &lt;3, 6, 9&gt;</p>
119+
<h5 class="Heading2"><font color="#0000A0">Scalar multiplication</font></h5>
120+
<p class="program">d = 3*a # d is a vector with components &lt;3, 6, 9&gt;</p>
120121

121-
<h3 class="Heading2"><font color="#0000A0">Vector magnitude</font> </h3>
122+
<h5 class="Heading2"><font color="#0000A0">Vector magnitude</font> </h5>
122123
<p class="program">s = mag(c) &nbsp;&nbsp;&nbsp;# s is a scalar magnitude<br />
123124
z = mag(c)**2 # square the magnitude of the vector; ** means &quot;to the power of&quot;</p>
124125

125-
<h3 class="Heading2"><font color="#0000A0">Vector products</font> </h3>
126+
<h4 class="Heading2"><font color="#0000A0">Vector products</font> </h4>
126127
<p class="program">f = cross(a,b) # cross product<br />
127128
g = dot(a,b)&nbsp;&nbsp; # dot product<br />
128-
h = norm(a) &nbsp;&nbsp;&nbsp;# normalized (unit) vector; a/mag(a); same as hat(a) or a.hat</p>
129+
h = hat(a) &nbsp;&nbsp;&nbsp;&nbsp;# normalized (unit) vector a/mag(a); same as a.hat and a.norm() or norm(a)</p>
129130
<p class="Normal"> The attributes of VPython objects can be vectors, such
130131

131132
as velocity or momentum.</p>
132133

133-
<h3 class="Heading-1"> <font color="#0000A0">III. Simple Python Programming</font></h3>
134-
135-
<h3 class="Heading2"><font color="#0000A0">Using the 3D Graphics Module</font></h3>
134+
<h3><font color="#0000A0">3: Simple Python Programming</font>
135+
136+
</h3>
137+
<h5 class="Heading2"><font color="#0000A0">Using the 3D Graphics Module</font></h5>
136138

137-
<p class="Normal"> The necessary first line of your program is created for you, and looks like this, if the current version is 3.0:</p>
138-
<p class="program"> GlowScript 3.0 VPython</p>
139+
<p class="Normal"> The necessary first line of a Web VPython program is created for you, and looks like this, if the current version is 3.2:</p>
140+
<p class="program"> Web VPython 3.2</p>
139141

140-
<h3 class="Heading2"><font color="#0000A0">Comments</font></h3>
142+
<h5 class="Heading2"><font color="#0000A0">Comments</font></h5>
141143
<p class="Normal"> A comment in a Python program starts with &quot;#&quot;</p>
142144
<p class="program"> # This line is a comment</p>
143145

144-
<h3 class="Heading2"><font color="#0000A0">Variables</font></h3>
146+
<h5 class="Heading2"><font color="#0000A0">Variables</font></h5>
145147

146148
<p class="Normal"> Variables can be created anywhere in a Python program, simply by assigning a variable name to a value. The type of the variable is determined by the assignment statement.</p>
147149
<p class="program"> a = 3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# an integer<br />
148150
b = -2.4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# a floating-point number<br />
149-
c = vector(0.4, 3e3, -1e1) # a vector<br />
151+
c = vector(0.4, 3e3, -1e1) # a vector; can abbreviate to vec<br />
150152
Earth = sphere(pos=vector(0,0,0), radius=6.4e6) # a 3D object<br />
151153
bodies = [ship, Earth, Moon]
152154

@@ -158,12 +160,11 @@ <h3 class="Heading2"><font color="#0000A0">Variables</font></h3>
158160
as mass or velocity. Other objects, such as vector(), have built-in
159161
attributes
160162
but you cannot create additional attributes. </p>
161-
<h3 class="Heading2"><font color="#0000A0">Exponentiation</font></h3>
163+
<h5 class="Heading2"><font color="#0000A0">Exponentiation</font></h5>
162164

163165
<p class="program"> x**2 # Not x^2, which is a bit operation in Python</p>
164166

165-
<h3 class="Heading2"> <font color="#0000A0">Logical Tests</font></h3>
166-
<p class="program"></p>
167+
<h5 class="Heading2"> <font color="#0000A0">Logical Tests</font></h5>
167168
<p class="program"> # Note the obligatory indentation here.<br />
168169
if a == b:&nbsp;&nbsp;&nbsp;# note the double equal sign for &quot;is equal&quot;<br />
169170
&nbsp;&nbsp;&nbsp;&nbsp;c = 5 &nbsp;&nbsp;&nbsp;# executed if a is equal to b<br />
@@ -172,7 +173,7 @@ <h3 class="Heading2"> <font color="#0000A0">Logical Tests</font></h3>
172173
&nbsp;&nbsp;&nbsp;&nbsp;x = a+b<br />
173174
else:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# any other case<br />
174175
&nbsp;&nbsp;&nbsp;&nbsp;x = b/a </p>
175-
<h3 class="Heading2"><font color="#0000A0">Logical expressions</font></h3>
176+
<h5 class="Heading2"><font color="#0000A0">Logical expressions</font></h5>
176177
<table border="1">
177178
<tr>
178179
<td rowspan="1" colspan="1"><p class="program"> ==</p></td>
@@ -216,7 +217,7 @@ <h3 class="Heading2"><font color="#0000A0">Logical expressions</font></h3>
216217
</tr>
217218
</table>
218219

219-
<h3 class="Heading2"><font color="#0000A0">Lists</font></h3>
220+
<h5 class="Heading2"><font color="#0000A0">Lists</font></h5>
220221
<p class="Normal"> A list is an ordered sequence of any kind of object. It is delimited by square brackets.</p>
221222
<p class="program"> moons = [Io, Europa, Ganymede, Callisto]</p>
222223
<p class="Normal"> The function &quot;arange&quot; (short for &quot;arrayrange&quot;)
@@ -228,7 +229,7 @@ <h3 class="Heading2"><font color="#0000A0">Lists</font></h3>
228229
for i in numbers:<br>
229230
&nbsp;&nbsp;&nbsp;&nbsp;print(i) # prints 0, 1, 2, 3, 4</p>
230231

231-
<h3 class="Heading2"> <font color="#0000A0">Loops</font></h3>
232+
<h5 class="Heading2"> <font color="#0000A0">Loops</font></h5>
232233
<p class="Normal"> The simplest loop in Python is a &quot;while&quot; loop. The loop continues as long as the specified logical expression is true (note the obligatory indentation):</p>
233234
<p class="program"> while x &lt; 23:<br />
234235
&nbsp;&nbsp;&nbsp;&nbsp;x = x + vx*dt</p>
@@ -252,15 +253,15 @@ <h3 class="Heading2"> <font color="#0000A0">Loops</font></h3>
252253
<p class="program">if a == b: continue # go back to the start of the loop<br />
253254
if a &gt; b: break &nbsp;&nbsp;&nbsp;&nbsp;# exit the loop</p>
254255

255-
<h3 class="Heading2"> <font color="#0000A0">Printing results</font></h3>
256+
<h5 class="Heading2"> <font color="#0000A0">Printing results</font></h5>
256257
<p class="Normal"> To print a number, a vector, a list, or anything else,
257258
use the &quot;print&quot; option:</p>
258259
<p class="program"> print(Europa.momentum)</p>
259260
<p class="Normal"> To print a text message, enclose it in quotes:</p>
260261
<p class="program"> print(&quot;We crashed with speed&quot;, v, &quot;m/s.&quot;)</p>
261262
<p class="Normal"> This could also be done like this (note the initial &quot;f&quot; that makes this work):</p>
262263
<p class="program"> print(f&quot;We crashed with speed {v} m/s.&quot;)</p>
263-
<h3 class="Heading2"><font color="#0000A0">More Information about Python</font></h3>
264+
<h5 class="Heading2"><font color="#0000A0">More Information about Python</font></h5>
264265
<p class="Normal">We have summarized a small but important subset of the Python programming
265266
language. Extensive Python information is available on the internet.</p>
266267
<p class="Normal">&nbsp;</p>

0 commit comments

Comments
 (0)