Skip to content

Commit 7c06413

Browse files
committed
Fix rotation of vertex objects
1 parent bd567d3 commit 7c06413

File tree

6 files changed

+5
-3
lines changed

6 files changed

+5
-3
lines changed

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_libraries/glow.3.2.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.

GlowScriptOffline3.2.zip

8 Bytes
Binary file not shown.

docs/VPythonDocs/triangle.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<p class="Normal">The vertices of a triangle or quad can have their own colors, which are blended between vertices:</p>
7373
<p class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/triangle.png" width="440" height="230" alt="triangle" /></p>
7474
<p align="center" class="Normal">The role of the &quot;normals&quot;, shown here as arrows perpendicular to the plane of the triangle, is discussed in detail below. If you point the thumb of your right hand in the direction of the normal, and curl the fingers of your right hand, your fingers should go from v0 to v1 to v2. To put it another way, looking down the normals from above, going from v0 to v1 to v2 should go counterclockwise.</p>
75+
<p align="center" class="Normal">As with other objects, you can rotate triangles and quads, but only by rotating each of their vertex objects. The reason for this is that vertex objects may be shared between adjacent triangles or quads,</p>
7576
<p class="Normal"><strong><font color="#0000a0">The power of triangles and quads</font></strong></p>
7677
<p class="Normal">There are two powerful capabilities of triangles and/or quads: First, any surface can be approximated by a mesh of triangles, so <em><strong>you can make any shape you like</strong></em>. Second, by changing the attributes of vertex objects, <strong><em>you can change the shape of a surface dynamically</em></strong>. A vertex object can be shared by several adjacent triangles, and changing that vertex object simultaneously affects all of the triangles that include that vertex object.</p>
7778
<p class="Normal">In the <strong><a href="https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/Rug" target="_blank">rug example</a></strong> pictured above, the rug is divided into a rectangular mesh of vertex objects, and quad objects are created from these vertex objects. The same vertex may be shared by as many as four adjacent quad objects. Changing the z position of a shared vertex object affects all those quads that refer to that vertex, which makes it easy to create a moving pulse simply by modifying the vertex positions. In the rug program the quad objects are needed to display the rug, but once the quads have been created all further calculations refer just to the underlying vertex objects.</p>

lib/glow/primitives.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@
12401240
if (args.origin === undefined) { origin = vec(0,0,0) }
12411241
else origin = args.origin
12421242
this.pos = origin.add(this.__pos.sub(origin).rotate({angle:angle, axis:axis}))
1243+
this.normal = this.__normal.rotate({angle:angle, axis:axis})
12431244
this.__change()
12441245
},
12451246
})

package/glow.3.2.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.

0 commit comments

Comments
 (0)