Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
21563bb
Quiet down logging from select packages
sul3n3t Jul 22, 2019
43b9288
Only enable streaming logging for project
sul3n3t Jul 22, 2019
cba7723
?
iamh2o Jul 22, 2019
2f18349
Rename test_shows to match style of others
sul3n3t Jul 22, 2019
d3a001f
Import Ponzi color code
sul3n3t Jul 19, 2019
3332dc1
Minor simulator class cleanup
sul3n3t Jul 22, 2019
b6f3832
...
iamh2o Jul 23, 2019
cc2d135
moved color.py from my GD fork to here, fixed the shows trying to nat…
iamh2o Jul 23, 2019
8835e03
missing show
iamh2o Jul 23, 2019
a5fdc0a
fixed RGBW dependency
iamh2o Jul 23, 2019
869e4e5
Edge of strobing ability
iamh2o Jul 23, 2019
3437e89
ok, moving to a branch
iamh2o Jul 23, 2019
1959f04
Fixed simulator to pull RGB values from color object instead of rgb f…
iamh2o Jul 23, 2019
f5b2d6f
Import simplification
sul3n3t Jul 22, 2019
5dc8a7e
__init__ and import changes to make tests easier
sul3n3t Jul 21, 2019
eaf287c
Whitespace and formatting only
sul3n3t Jul 21, 2019
19960e7
Initial test and refactor
sul3n3t Jul 21, 2019
006a512
Bunch of changes, still need mapping of cell to pixel in models
sul3n3t Jul 23, 2019
92dba7c
Implemented old (incorrect) mapping
sul3n3t Jul 24, 2019
cbfacc3
Solve conflicts
sul3n3t Jul 24, 2019
1e7e9fe
More tests and fixes some bugs
sul3n3t Jul 24, 2019
622abf2
Fix shows
sul3n3t Jul 24, 2019
4d6b660
Introduce traversals
sul3n3t Jul 24, 2019
a1192c6
Clearer coords on Cell
sul3n3t Jul 24, 2019
1ccac12
Merge pull request #5 from pyramidscheme/grid-tests
sul3n3t Jul 24, 2019
daf54d7
More type hints
sul3n3t Jul 24, 2019
b8b8601
Remove unnecessary memoization
sul3n3t Jul 24, 2019
39b1737
correct cell mapping for 2 row triangle wirred from bottom left. We …
iamh2o Jul 25, 2019
90624ac
Added some object setters, added hex finding (it's clunky w/out the 2…
iamh2o Jul 25, 2019
60c0029
Unable to auto merge...?
iamh2o Jul 25, 2019
9c187c0
remove embed from being triggered
iamh2o Jul 25, 2019
8a2397b
Rename pixel setter to be clearer
sul3n3t Jul 25, 2019
99b5eca
Warp show
sul3n3t Jul 26, 2019
6cd98ee
Fix Warp show
sul3n3t Jul 26, 2019
3771579
trying to sweep left to right pixel lighting
iamh2o Jul 26, 2019
2628ca4
..
iamh2o Jul 26, 2019
a44db53
mapped 11 row panel. Needs IRL testing
iamh2o Jul 31, 2019
8b73c65
oops- 0 not 1
iamh2o Aug 1, 2019
5737ee2
fixed f'd up first attemt at mapping
iamh2o Aug 1, 2019
d6f97a6
New pixel mapping assuming 4 full strands per triangle
iamh2o Aug 2, 2019
fa255d9
sort of working mapping
iamh2o Aug 3, 2019
4a56955
Add new coordinate to address mapping
silverlyra Aug 4, 2019
b7a57d9
Add new coordinate to address mapping
silverlyra Aug 5, 2019
be12400
Integrate new grid cell code
silverlyra Aug 6, 2019
a15416c
Remove cruft
silverlyra Aug 6, 2019
c624ccc
Merge pull request #10 from pyramidscheme/cell-integration
sul3n3t Aug 7, 2019
2e4c09c
Fix IP detection
silverlyra Aug 8, 2019
ebe1258
Fixes simulator with a little hack on model.set()
sul3n3t Aug 15, 2019
cd04eb0
Pass cell in addition to address to model
sul3n3t Aug 16, 2019
56119bc
small fixes
silverlyra Aug 16, 2019
42a7e7c
Merge pull request #15 from pyramidscheme/aug-15-fixes
silverlyra Aug 16, 2019
69d0ada
Merge pull request #14 from pyramidscheme/fix-simulator
sul3n3t Aug 16, 2019
57eeb2c
ok, I can light pixels again
iamh2o Aug 16, 2019
633ee87
Adds a comment to hexagon()
sul3n3t Aug 16, 2019
3d21499
Geometry fixes
silverlyra Aug 16, 2019
76a01b7
playing with shows
iamh2o Aug 17, 2019
37879ce
Repaired the LeftToRightAndBackAgain Show
iamh2o Aug 17, 2019
8d22aa0
Comment edits to incoporate jem's comments
sul3n3t Aug 17, 2019
1118578
Merge pull request #17 from pyramidscheme/hexagon-comments
sul3n3t Aug 17, 2019
c485262
Merge pull request #19 from pyramidscheme/fix-indexing
sul3n3t Aug 17, 2019
6f8bd4e
Fixes grid tests (and some bugs) in the new paradigm
sul3n3t Aug 16, 2019
56c4e48
Restore warp show
sul3n3t Aug 16, 2019
9df79a0
Merge pull request #16 from pyramidscheme/fix-grid-tests
sul3n3t Aug 18, 2019
f2ab8ec
Merge branch 'master' into warp-show
sul3n3t Aug 18, 2019
f108532
Merge pull request #18 from pyramidscheme/warp-show
sul3n3t Aug 18, 2019
aaa71c6
Adds Coordinate for alternate spatial reasoning
sul3n3t Aug 18, 2019
2b53242
FuckYourBurn show, developed by Kevmo
sul3n3t Aug 18, 2019
9b4a490
moving branches
iamh2o Aug 18, 2019
51bea48
Merge pull request #22 from pyramidscheme/coordinates
silverlyra Aug 19, 2019
305aec7
working tendrils show
iamh2o Aug 19, 2019
e010fc3
Merge branch 'master' into jem-shows-tinkering-2
iamh2o Aug 19, 2019
c990d0b
row_length moved
iamh2o Aug 19, 2019
21671ef
some util functions
iamh2o Aug 19, 2019
b04686c
what the fuck is going on....
iamh2o Aug 19, 2019
3672fca
left out crap
iamh2o Aug 19, 2019
efebb13
...
iamh2o Aug 19, 2019
d74f62d
Merge branch 'master' into jem-shows-tinkering-2
iamh2o Aug 19, 2019
5ada5f0
Merge pull request #24 from pyramidscheme/jem-shows-tinkering-2
iamh2o Aug 19, 2019
f72c9f4
Fix row_length move to Geometry
silverlyra Aug 19, 2019
5709338
Undo partial revert of Cell geometry
silverlyra Aug 19, 2019
890eaef
mess rsolved
iamh2o Aug 19, 2019
d4e5f38
tendrils
iamh2o Aug 19, 2019
bca83f5
Dudeks First Show Ported
iamh2o Aug 19, 2019
edec06a
added Gears show from dudek
iamh2o Aug 19, 2019
7397746
Implement shows across a whole pyramid side
silverlyra Aug 19, 2019
8585373
Behavior and test fixes
silverlyra Aug 20, 2019
9b53b3d
Merge pull request #25 from pyramidscheme/whole-face
silverlyra Aug 20, 2019
70f7436
Support shows spanning the entire pyramid
silverlyra Aug 20, 2019
e789b05
Merge pull request #23 from pyramidscheme/fuck-your-burn
sul3n3t Aug 20, 2019
e575203
Merge pull request #26 from pyramidscheme/full-geom
silverlyra Aug 21, 2019
26039f3
Add Raspberry Pi launch script
silverlyra Aug 21, 2019
300cee8
Ton of changes to prepare for the Folsom Install. Fixed with a sledg…
iamh2o Sep 27, 2019
2c1f0f1
package to enable my sledgehammer
iamh2o Sep 27, 2019
aa7047a
Added steves code for Tom as reference
iamh2o Sep 27, 2019
2fcee5c
Merge branch 'master' into roar
iamh2o Sep 28, 2019
0409d05
new shows
iamh2o Sep 28, 2019
a19e6fd
Merge pull request #27 from pyramidscheme/roar
iamh2o Sep 28, 2019
6a58d93
Fix activate method in other models
sul3n3t Sep 28, 2019
b306597
Changes for hack building pyramid of single panel
sul3n3t Sep 28, 2019
28d31cb
updates to steves shows
iamh2o Sep 28, 2019
c94d91f
random show hacking stuff
iamh2o Sep 28, 2019
0d1f2cb
Ran poetry update to include psutil in lockfile
sul3n3t Sep 28, 2019
d300986
Add ColorPulse show
sul3n3t Sep 28, 2019
e2fc9fe
clean and tidy
iamh2o Sep 28, 2019
8011df4
some color flashing
iamh2o Sep 28, 2019
c42cd4a
hacked in some basic controls to shows.... needs help
iamh2o Sep 28, 2019
b58046b
changes made during New Breed
iamh2o Sep 29, 2019
9c84cf1
Merge branch 'master' into roar
iamh2o Oct 14, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 234 additions & 0 deletions HelperClasses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
from HelperFunctions import*
from color import RGB
from grid.cell import Direction, Position, Coordinate

#
# Fader class and its collection: the Faders class
#
class Faders(object):
def __init__(self, grid):
self.grid= grid
self.fader_array = []
self.max_faders = 1000

def add_fader(self, color, pos, change=0.1, intense=1.0, growing=False):
new_fader = Fader(self.grid, color, pos, change, intense, growing)
self.add_fader_obj(new_fader)

def add_fader_obj(self, new_fader):
if self.num_faders() < self.max_faders:
self.fader_array.append(new_fader)

def cycle_faders(self, refresh=True):
if refresh:
self.grid.clear()

# Draw, update, and kill all the faders
for f in self.fader_array:
if f.is_alive():
f.draw_fader()
f.fade_fader()
else:
f.black_cell()
self.fader_array.remove(f)

def num_faders(self):
return len(self.fader_array)

def fade_all(self):
for f in self.fader_array:
f.black_cell()
self.fader_array.remove(f)


class Fader(object):
def __init__(self, grid, color, pos, change=0.25, intense=1.0, growing=False):
self.grid = grid
self.pos = pos
self.color = color
self.intense = intense
self.growing = growing
self.decrease = change

def draw_fader(self):
# from IPython import embed; embed()

gw = gradient_wheel(self.color, self.intense)
self.grid.set(Coordinate(x=self.pos[0],y=self.pos[1]), RGB(gw[0],gw[1],gw[2]))

def fade_fader(self):
if self.growing:
self.intense += self.decrease
if self.intense >= 1.0:
self.intense = 1.0
self.growing = False
self.intense -= self.decrease
else:
self.intense -= self.decrease

def is_alive(self):
return self.growing or self.intense > 0.01

def black_cell(self):
self.grid.set(Coordinate(x=self.pos[0],y=self.pos[1]),RGB(0,0,0))


#
# Brick class and its collection: the Bricks class
#
class Bricks(object):
def __init__(self, trianglemodel, bounce=False):
self.triangle = trianglemodel
self.bounce = bounce
self.brick_array = []

def add_brick(self, color, life, pos, length, pitch, length_x, length_y, dx, dy, accel_x=0, accel_y=0, use_faders=False, change=0.25):
new_brick = Brick(self.triangle, color, life, pos, length, pitch, length_x, length_y, dx, dy, accel_x, accel_y, use_faders, change)
self.brick_array.append(new_brick)

def move_bricks(self, refresh=True):
if refresh:
self.triangle.black_all_cells()

# Draw, move, update, and kill all the bricks
for b in self.brick_array:
b.draw_brick()
b.move_brick(self.bounce)
b.age_brick()

for b in self.brick_array:
if not b.is_alive():
self.brick_array.remove(b)

def kill_brick(self, b):
if b in self.brick_array:
b.kill_faders()
self.brick_array.remove(b)

def set_all_dx(self, dx):
for b in self.brick_array:
b.set_dx(dx)

def set_all_dy(self, dy):
for b in self.brick_array:
b.set_dy(dy)

def set_all_accel_x(self, accel_x):
for b in self.brick_array:
b.set_accel_x(accel_x)

def set_all_accel_y(self, accel_y):
for b in self.brick_array:
b.set_accel_y(accel_y)

def num_bricks(self):
return len(self.brick_array)

def get_bricks(self):
return self.brick_array


class Brick(object):
def __init__(self, trianglemodel, color, life, pos, length, pitch, length_x, length_y, dx, dy, accel_x=0, accel_y=0,
use_faders=False, change=0.25):
self.triangle = trianglemodel
self.color = color
self.life = life
self.pos = pos
self.length = length
self.pitch = pitch
self.length_x = length_x
self.length_y = length_y
self.dx = dx
self.dy = dy
self.accel_x = accel_x
self.accel_y = accel_y
self.use_faders = use_faders
self.faders = Faders(trianglemodel) if self.use_faders else None
self.change = change

def draw_brick(self):
for i in range(int(round(self.length / self.pitch)) + 1):
pos = (round(self.pos[0] + (i * self.pitch * self.length_x)),
round(self.pos[1] + (i * self.pitch * self.length_y)))
if self.use_faders:
self.faders.add_fader(self.color, pos, intense=1.0, growing=False, change=self.change)
else:
self.triangle.set_cell(pos, self.color)

if self.use_faders:
self.faders.cycle_faders(False)

def move_brick(self, bounce):
new_x = self.pos[0] + self.dx
new_y = self.pos[1] + self.dy

if bounce:
if new_x < 0 or new_x >= self.triangle.width:
self.dx *= -1
new_x = self.pos[0] + self.dx
if new_y < 0 or new_y >= self.triangle.height:
self.dy *= -1
new_y = self.pos[1] + self.dy

self.pos = (new_x, new_y)
self.dx, self.dy = self.dx + self.accel_x, self.dy + self.accel_y

def age_brick(self):
self.life -= 1

def is_alive(self):
return self.life > 0

def get_coord(self):
return self.pos

def get_x(self):
(x,y) = self.pos
return x

def get_y(self):
(x,y) = self.pos
return y

def get_dx(self):
return self.dx

def get_dy(self):
return self.dy

def get_life(self):
return self.life

def set_dx(self, dx):
self.dx = dx

def set_dy(self, dy):
self.dy = dy

def set_accel_x(self, accel_x):
self.accel_x = accel_x

def set_accel_y(self, accel_y):
self.accel_y = accel_y

def set_length_x(self, length_x):
self.length_x = length_x

def set_length_y(self, length_y):
self.length_y = length_y

def set_x(self, x):
(old_x, y) = self.pos
self.pos = (x, y)

def set_y(self, y):
(x, old_y) = self.pos
self.pos = (x, y)

def set_life(self, life):
self.life = life

def kill_faders(self):
if self.faders:
self.faders.fade_all()
Loading