8000 Implement helix ccw · vpython/vpython-jupyter@3afbc0d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3afbc0d

Browse files
committed
Implement helix ccw
1 parent 92db49f commit 3afbc0d

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

vpython/vpython.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def Exit():
7777
# attrs are X in {'a': '23X....'}
7878
__attrs = {'pos':'a', 'up':'b', 'color':'c', 'trail_color':'d', # don't use single and double quotes; available: comma, but maybe that would cause trouble
7979
'ambient':'e', 'axis':'f', 'size':'g', 'origin':'h',
80-
'direction':'j', 'linecolor':'k', 'bumpaxis':'l',
80+
'direction':'j', 'linecolor':'k', 'bumpaxis':'l',
8181
'foreground':'n', 'background':'o', 'ray':'p', 'center':'E', 'forward':'#', 'resizable':'+',
8282

8383
# scalar attributes
@@ -109,7 +109,7 @@ def Exit():
109109
'logx':'u', 'logy':'v', 'dot':'w', 'dot_radius':'x',
110110
'markers':'y', 'legend':'z', 'label':'A', 'delta':'B', 'marker_color':'C',
111111
'size_units':'D', 'userpan':'E', 'scroll':'F', 'choices':'G', 'depth':'H',
112-
'round':'I', 'name':'J', 'offset':'K', 'attach_idx':'L'}
112+
'round':'I', 'name':'J', 'offset':'K', 'attach_idx':'L', 'ccw':'M'}
113113

114114
# methods are X in {'m': '23X....'}
115115
# pos is normally updated as an attribute, but for interval-based trails, it is updated (multiply) as a method
@@ -529,7 +529,7 @@ class standardAttributes(baseObj):
529529
'helix':[['pos', 'color', 'trail_color'],
530530
['axis', 'size', 'up'],
531531
['visible', 'opacity','shininess', 'emissive',
532-
'make_trail', 'trail_type', 'interval',
532+
'make_trail', 'trail_type', 'interval', 'ccw',
533533
'retain', 'trail_color', 'trail_radius', 'coils', 'thickness', 'pickable'],
534534
['red', 'green', 'blue','length', 'width', 'height', 'radius']],
535535
'curve':[['origin', 'color'],
@@ -1137,7 +1137,7 @@ def clone(self, **args):
11371137
'visible':True, 'pickable':self._pickable}
11381138
elif objName == 'helix':
11391139
oldargs = {'pos':self.pos, 'color':self._color,
1140-
'thickness':self._thickness, 'coils':self._coils,
1140+
'thickness':self._thickness, 'coils':self._coils, 'ccw':self._ccw,
11411141
'size':self._size, 'axis':self._axis, 'up':self._up,
11421142
'shininess':self._shininess, 'emissive':self._emissive,
11431143
'visible':True, 'pickable':self._pickable}
@@ -1503,6 +1503,7 @@ def __init__(self,**args):
15031503
args['_objName'] = 'helix'
15041504
args['_default_size'] = vector(1,2,2)
15051505
self._coils = 5
1506+
self._ccw = True
15061507
self._thickness = 1/20 ## radius/20
15071508

15081509
super(helix, self).setup(args)
@@ -1525,6 +1526,15 @@ def coils(self,value):
15251526
if not self._constructing:
15261527
self.addattr('coils')
15271528

1529+
@property
1530+
def ccw(self):
1531+
return self._ccw
1532+
@ccw.setter
1533+
def ccw(self,value):
1534+
self._ccw =value
1535+
if not self._constructing:
1536+
self.addattr('ccw')
1537+
15281538
@property
15291539
def radius(self):
15301540
return self._size.y/2

vpython/vpython_libraries/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.

vpython/vpython_libraries/glowcomm.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@
364364
events.push(evt)
365365
}
366366

367-
// attrs are X in {'a': '23X....'} avaiable: none
367+
// attrs are X in {'a': '23X....'} available: none
368368
var attrs = {'a':'pos', 'b':'up', 'c':'color', 'd':'trail_color', // don't use single and double quotes; available: comma, but maybe that would cause trouble
369369
'e':'ambient', 'f':'axis', 'g':'size', 'h':'origin', 'i':'textcolor',
370-
'j':'direction', 'k':'linecolor', 'l':'bumpaxis', 'm':'dot_color',
370+
'j':'direction', 'k':'linecolor', 'l':'bumpaxis',
371371
'n':'foreground', 'o':'background', 'p':'ray', 'E':'center', '#':'forward', '+':'resizable',
372372

373373
// scalar attributes
@@ -398,7 +398,9 @@
398398
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
399399
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
400400
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
401-
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round'}
401+
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round',
402+
'J':'name', 'K':'offset', 'L':'attach_idx','M':'ccw'
403+
}
402404

403405
// methods are X in {'m': '23X....'}
404406
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB

vpython/vpython_libraries/glowcomm.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ var attrs = {'a':'pos', 'b':'up', 'c':'color', 'd':'trail_color', // don't use s
421421
'q':'graph', 'r':'canvas', 's':'trail_radius',
422422
't':'visible', 'u':'opacity', 'v':'shininess', 'w':'emissive',
423423
'x':'make_trail', 'y':'trail_type', 'z':'interval', 'A':'pps', 'B':'retain',
424-
'C':'red', 'D':'green', 'F':'blue', 'G':'length', 'H':'width', 'I':'height', 'J':'radius',
424+
'C':'red', 'D':'green', 'E':'ccw', 'F':'blue', 'G':'length', 'H':'width', 'I':'height', 'J':'radius',
425425
'K':'thickness', 'L':'shaftwidth', 'M':'headwidth', 'N':'headlength', 'O':'pickable',
426426
'P':'coils', 'Q':'xoffset', 'R':'yoffset',
427427
'S':'border', 'T':'line', 'U':'box', 'V':'space', 'W':'linewidth',
@@ -445,7 +445,9 @@ var attrsb = {'a':'userzoom', 'b':'userspin', 'c':'range', 'd':'autoscale', 'e':
445445
'p':'left', 'q':'right', 'r':'top', 's':'bottom', 't':'_cloneid',
446446
'u':'logx', 'v':'logy', 'w':'dot', 'x':'dot_radius',
447447
'y':'markers', 'z':'legend', 'A':'label','B':'delta', 'C':'marker_color',
448-
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round'}
448+
'D':'size_units', 'E':'userpan', 'F':'scroll', 'G':'choices', 'H':'depth', 'I':'round',
449+
'J':'name', 'K':'offset', 'L':'attach_idx','M':'ccw'
450+
}
449451

450452
// methods are X in {'m': '23X....'}
451453
var methods = {'a':'select', 'b':'pos', 'c':'start', 'd':'stop', 'f':'clear', // unused eghijklmnopvxyzCDFAB

0 commit comments

Comments
 (0)
0