Skip to content

Commit 51f93ef

Browse files
committed
fix extrusion bug
1 parent 6c58e33 commit 51f93ef

10 files changed

Lines changed: 15 additions & 11 deletions

File tree

‎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‎

-6.33 MB
Binary file not shown.

‎lib/compiling/GScompiler.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ where compile() was called, in untrusted/run.js.
874874
vars = vars.slice(0,-2)+'}\n'
875875
purge = purge.slice(0,-2)
876876
}
877+
prog += " print = GSprint\n"
877878
prog += " arange = range\n"
878879
prog += " __name__ = '__main__'\n" // handles common Python test: if __name__ == '__main__':
879880
prog += " type = pytype\n" // override RapydScript type() function
@@ -922,7 +923,7 @@ where compile() was called, in untrusted/run.js.
922923
// Python and VPython and RapydScript and JavaScript key words that can precede '(':
923924
let no_await = ['if', 'elif', 'return', 'for', 'while', 'function', 'else', 'dict', 'str',
924925
'float', 'hex', 'int', 'iter', 'len', 'list', 'vec', 'vector', 'catch', 'enumerate',
925-
'oct', 'ord', 'print', 'range', 'arange', 'update', 'print', 'clock', 'msclock',
926+
'oct', 'ord', 'print', 'range', 'arange', 'update', 'print', 'GSprint', 'clock', 'msclock',
926927
'canvas', 'graph', 'gcurve', 'gdots', 'gvbars', 'ghbars', 'rotate', 'box', 'cylinder',
927928
'cone', 'pyramid', 'sphere', 'simple_sphere', 'arrow', 'curve', 'points', 'paths',
928929
'shapes', 'helix', 'ring', 'compound', 'vertex', 'triangle', 'quad', 'label',

‎lib/glow/api_misc.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@
800800
print: print,
801801
__convert: convert,
802802
__parsearray: parsearray,
803+
GSprint: print, // avoid a conflict with RapydScript print function by inserting _$rapyd$_print = GSprint
803804
print_to_string: print_to_string,
804805
print_options: print_options,
805806
clock: clock,

‎lib/glow/extrude.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ function extrusion(args) {
597597
throw new Error('The length '+slen+' of the list of scale values does not match the length '+args.path.length+' of the path.')
598598
if (path_closed && (args.scale[slen-1] !== args.scale[0]))
599599
throw new Error('With a closed path, the last scale value, '+args.scale[slen-1]+', must equal the first scale value, '+args.scale[0]+'.')
600+
for (i=0; i<args.scale.length; i++) {
601+
if (args.scale[i] == 0) args.scale[i] = 0.0000001 // prevent error posting
602+
}
600603
}
601604
} else args.scale = null
602605
if (args.xscale !== undefined) {

‎lib/glow/shapespaths.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,13 +1295,12 @@ path_object.prototype.line = function line(args) {
12951295
if (args.yscale === undefined) args.yscale = 1
12961296
if (args.start === undefined) args.start = vec(0,0,0)
12971297
if (args.end === undefined) args.end = vec(0,0,-0.1)
1298-
var v, vline, i
1299-
var cp = [args.start]
1298+
let v, dv, i
1299+
let cp = [args.start]
13001300
v = args.end.sub(args.start)
1301-
vline = v.divide(Math.floor(args.np-1))
1301+
dv = v.divide(Math.floor(args.np-1))
13021302
for (i = 1; i < args.np; i++) {
1303-
cp.push(args.start.add(vline))
1304-
vline = vline.add(vline)
1303+
cp.push(cp[i-1].add(dv))
13051304
}
13061305
return cp
13071306
}

‎package/RScompiler.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.

‎package/compiler.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.

‎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)