• ### Hack Chat Transcript, Part 2

Steve Pomeroy12:23 PM
@Jason Moungey that's a disco stick if I've ever seen one!

Jason Moungey12:23 PM
Either way I am in love with it

Jason Moungey12:23 PM
@Steve Pomeroy :)))))

Garrett Mace12:24 PM
Once you do your transforms, you can step through the physical pixels you have, pull out their coordinates of interest, and feed that into your generation algorithm

Garrett Mace12:24 PM

Steve Pomeroy12:24 PM
I'm loving these explainer gifs!

Garrett Mace12:25 PM
I definitely recommend perusing some old math texts, maybe Khan Academy or something...it really helps! And I do love my Python and matplotlib!

Orlando Hoilett12:25 PM
@Dan Maloney are we still saving HackChat transcripts?

Ben Hencke12:25 PM
@Garrett Mace what did you end up using to make these explainer gifs? good stuff

reynolds.garrett12:26 PM
What software are you using to simulate your end result?

Garrett Mace12:26 PM
Most of the patterns on that LED Nonagon are very simple. I have it run through the pixels and feed coordinates to generator classes. The core algorithm for many patterns is a oneliner

Garrett Mace12:26 PM

1

`CRGB render(pixel_info pix) {`

2

`    int8_t color = (int32_t)(pix.r/12*(int32_t)(sin16(angle))/256) + pix.angle*256/PI*1;`

3

`    CRGB ret_color;`

4

`    ret_color = ColorFromPalette(palette, color+hue, 255);`

5

`    return ret_color;`

6

`    }`

Garrett Mace12:27 PM
Ben: I'm rendering them in Matplotlib, frame by frame, from within jupyter notebook

Garrett Mace12:27 PM
reynolds: I usually dev actual patterns on the device itself. However, there are some great FastLED simulator projects on github

Garrett Mace12:28 PM
I know hackaday posted one pretty recently?

Garrett Mace12:28 PM
I would like to figure out how to feed LED algorithms directly into Blender and render the results in EEvee

Garrett Mace12:29 PM
In any case....if you precalculate the math, use a "shader" style approach to generating physical-space patterns, you might forget the actual complexity looks like this:

reynolds.garrett12:29 PM
That would be slick, and thanks I will have a look around on github for some simulators

Garrett Mace12:29 PM

Steve Pomeroy12:29 PM
Do you do most of your project mockups/renders in Blender?

reynolds.garrett12:29 PM
😱

Garrett Mace12:30 PM
Steve: I've done a few, but definitely not most. Lots of pencil sketches, and some guesstimations

Steve Pomeroy12:30 PM
Gotcha. I've been trying to figure out a good workflow for LED-based sim there. Sounds like Eevee? :-)

Garrett Mace12:30 PM
You can build the thing, and then measure where the pixels are, or where a strip starts and ends and what the pixel spacing is

LqqkOut12:31 PM
🤯 Incredible images! Maybe a chicken and egg question, but did you have the mathematics background when you started doing animations or did it evolve from these projects?

Garrett Mace12:31 PM
Eevee is a graphics-card based render option in newest Blender releases, it's a lot faster

Garrett Mace12:32 PM
LqqkOut I graduated as an EE with pretty heavy math along the way, but that was almost 20 years ago. Knowing where to look helped (hence this hack chat) but I did have to relearn a lot

Garrett Mace12:34 PM
Any other questions about the above projects, approaches to LED mapping, how to even use this, or random thoughts about the state of LED tech today?

Ben Hencke12:34 PM
I found this bit to be really good at explaining transformation matrix math: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Matrix_math_for_the_web

Garrett Mace12:36 PM
That looks pretty good! I'm thinking about switching to Javascript (as in your link) because I think it'll be a bit more performant, easier to share, interactive

Garrett Mace12:36 PM
I mean look at all this cool stuff: https://www.falstad.com/mathphysics.html

LqqkOut12:36 PM
(hold for later if it's coming up!) Any lessons-learned or tips re: power and power distribution? I imagine these can be pretty hungry

Garrett Mace12:37 PM
Yes

brainsmoke12:37 PM
are you using normal vectors for LED orientations in your 3d animations as well? (I've been using them to simulate artificial light sources, where the LEDs simulate reflective surfaces)

Garrett Mace12:37 PM
I don't have more loaded into the chat cannon, so we're well into freeform chat now

Garrett Mace12:38 PM
LqqkOut: I stick with 48V or lower distribution, and point-of-load DC-DC converters for large projects

Garrett Mace12:38 PM
Each node in that ceiling project needed to handle up to 400 watts

Dan Maloney12:38 PM
More of a hardware question. The link someone posted for the ceiling LED project mentioned "custom connectors". With the huge range of connectors available, why would it have to be something custom? And how does one get custom connectors made?

Dan Maloney12:38 PM

https://www.tangibleinteraction.com/artworks/summit

#### summit

Garibaldi Mountain is one of the greatest natural beauties in British Columbia, towering majestically above the small town of Squamish. Every time you drive by or see it in the distance, the extraordinary view of the impressively peaked ridge inherently steals your breath away.

Read this on summit | Tangible Interaction

Garrett Mace12:39 PM
brainsmoke: I haven't needed to worry about normal vectors yet, but on that summit project they were very important. We had the three sides of the sticks modeled, and wanted self-shadowing effects so we needed to know what direction each LED pointed

Garrett Mace12:40 PM
The person who set that up was a data scientist, I definitely recommend getting one on the team if you have a similar scale of problem!

grcornwe12:40 PM
Any thoughts on MicroPython on the microcontrollers you use?

Garrett Mace12:41 PM
Dan: The custom connectors were mostly to handle the long strips we were using, the default connectors were not strong enough or high enough current for a semi-industrial application. So custom was mostly "hey Ray Wu, can you put these on instead" and he said yeah

Garrett Mace12:42 PM
grcornwe: Loving MicroPython. I haven't used it for a high-update-rate LED application yet, but for small info display type projects it's so nice to not dig deep into C to handle network comms, text processing etc

Steve Pomeroy12:44 PM
One of the things I've heard people talk about in terms of pixel mapping is the idea of using a network of smarter pixel drivers + more parametric control signals instead of raw pixel data. Have you explored that at all?

grcornwe12:44 PM
Thanks, I've been struggling with a higher-update-rate application, drove me back to C :)

Garrett Mace12:44 PM
The micropython and circuitpython implementations have high speed pixel drivers under the hood. Might be cool to do a similar approach with a lookup table and shader kernels written in C

brainsmoke12:45 PM
I've written a jitter-hiding driver for micropython, to hide garbage collection cycles :-)

Steve Pomeroy12:45 PM
(I imagine the idea of JPEG-like frames being sent to a controller instead of raw pixels.)

Garrett Mace12:45 PM
Steve: Sort of a game of life approach? Rules-based pattern generation? I haven't done that but see great things on twitter with interchangeable modules

Garrett Mace12:47 PM
That is a fourth approach to the problem though. I know that Paul does demos with a rectangular array from a Teensy, and a computer pipes pixel data to it over USB. However, you could do the heavy processing on the computer and send pre-mapped data to pixel chains or strings

LqqkOut12:47 PM
Are most of your projects for specific clients or are they personal projects? If clients, do you get to design collaboratively or is it more prescriptive?

Garrett Mace12:47 PM
There are a lot of commercial applications that do this, mostly with DMX but some Artnet

Garrett Mace12:48 PM
LqqkOut: It's definitely more personal projects these days, or no-money projects (collab with Burning Man sculptor etc)

LqqkOut12:48 PM
[thank you for all of the answers, I wish the chat had response icons to show the love]

Garrett Mace12:49 PM
Maybe someday

Garrett Mace12:49 PM
It'll be next to the edit button

Steve Pomeroy12:49 PM
haha

Ben Hencke12:49 PM
good stuff

Ben Hencke12:49 PM
thanks, @Garrett Mace

Garrett Mace12:50 PM
If it's all right, I'm going to grab some lunch. If you'd like to continue discussion over the next few days, or have questions for many other experienced LED artists and coders, hop over to the LED Art Ongoing/Weekly Chat

Steve Pomeroy12:50 PM
Indeed, thanks so much!

Garrett Mace12:50 PM

#### Public chat for LED Art Ongoing/Weekly Chat | Hackaday.io

Participate in the public chat for LED Art Ongoing/Weekly Chat!

Darrin B left  the room.12:50 PM

Garrett Mace12:50 PM
I'll try to spend some more time in there too!

Jason Moungey12:51 PM
👍

Garrett Mace12:51 PM
Thank you all for a great discussion and great questions!

Dan Maloney12:51 PM
Sounds goos Garrett, we're almost at the end of the hour anyway.

Dan Maloney12:51 PM
*good

Louis Beaudoin12:51 PM
Great chat Garrett, and thanks for linking to the LED Art Chat group!

Dan Maloney12:52 PM
Thanks so much for dropping by today, interesting stuff. I never thought there's be so much math involved, but it makes sense once you think about it.

Garrett Mace12:52 PM
Thanks for inviting me, Dan. Was a lot of fun!

Ben Hencke12:52 PM
favorite c matrix math library? I've picked up https://github.com/felselva/mathc - seems a good mix of simple, capable, and fast

Dusan Petrovic12:52 PM
Thanks @Garrett Mace and everyone!

grcornwe12:52 PM
Thank you Garrett!

Dan Maloney12:52 PM
You bet. And thanks all for turning out today with great questions.

Garrett Mace12:52 PM
Ben: I'm doing the math in Python so that I don't have to do it in C :) Uh, eventually will probably need that though. Thanks for the link!

Dan Maloney12:52 PM
Next week we'll be talking with Cory Collins about Art with Technology:

Dan Maloney12:53 PM

#### Art with Technology Hack Chat

Cory Collins will host the Hack Chat on Wednesday, June 16 at noon Pacific. Time zones got you down? Try our handy time zone converter. As hackers, we naturally see the beauty of technology.

Dan Maloney12:53 PM
Transcript for today's chat coming right up...

Paul Stoffregen12:54 PM
thanks - I only caught little parts of this - looking forward to reading the transcript later tonight

Garrett Mace12:55 PM
Smae

Garrett Mace12:55 PM
Er, same

• ### Hack Chat Transcript, Part 1

Dan Maloney12:00 PM
OK, people are still coming in but I think we can get started. Hello everyone, thanks for coming out today. I'm Dan and I'll be moderating along with Dusan today as we welcome Garrett Mace to the Hack Chat. We'll be talking about cool tricks to making LED matrix project easier and better.

Garrett Mace12:00 PM
Hey everyone!

Dan Maloney12:00 PM
Hi Garrett! Can you tell us a little about how LEDs became your thing?

Dusan Petrovic12:00 PM
Hello and welcome!

Garrett Mace12:01 PM
They always were! I started experimenting with electronics while LEDs existed, so my first circuits of course blinked an LED or two

Dan Maloney12:01 PM
"Hello world" of hardware, right?

Garrett Mace12:01 PM
Once you go from one LED to two LEDs, it's a slippery slope. You never come back!

Garrett Mace12:02 PM
I have some intro material if it's OK to launch it?

Dan Maloney12:02 PM
Yeah, go for it

Tim Slagle joined  the room.12:02 PM

Garrett Mace12:02 PM
Hi, I'm Garrett Mace of macetech.com. I work on lots of projects, but in this chat will focus on LED stuff. Specifically LED matrixes, non-rectangular LED arrays, and LED matrixes in non-rectangular arrays ;) Here are some examples of projects I've worked on:

Garrett Mace12:03 PM

Darrin B joined  the room.12:03 PM

Garrett Mace12:03 PM

Steve Pomeroy joined  the room.12:03 PM

Garrett Mace12:03 PM

Garrett Mace12:03 PM

Garrett Mace12:04 PM
So you can see that while some of them involve 1D and 2D LED arrays, they may not confirm to regular grids

Dan Maloney12:04 PM
Whoa - just the logisitics of installing that ceiling project must be a story worth telling.

Garrett Mace12:04 PM
This poses several problems, if you want to make your LED animations make sense in the physical world

Jason Moungey joined  the room.12:05 PM

Garrett Mace12:05 PM
The ceiling install was a lot of fun: I got to design and order custom extrusion for example!

Pete Willard12:05 PM
neat

Garrett Mace12:05 PM
We used about 35 networked Teensy 3.6's (thanks Paul)

Paul Stoffregen12:05 PM
:)

Garrett Mace12:06 PM
And 3D mapping done with Touch Designer. This was a collab with Tangible Interaction up in Vancouver BC

Nick joined  the room.12:06 PM

Orlando Hoilett12:06 PM
Who did you design the ceiling light show for?

reynolds.garrett joined  the room.12:06 PM

Steve Pomeroy12:07 PM
Nice! Do you have any tips/tricks for LED mapping with TouchDesigner? Or resources that explain it well to beginners? (I'm teaching a workshop on doing LED art with TouchDesigner now and looking for intro resources)

reynolds.garrett12:07 PM
TD definitely seems to be the leader in lots of LED projects I see. They keep popping up. A bit of a learning curve, but it's soooo powerful!

Garrett Mace12:07 PM
That was a sort of office HQ for a development up in the Squamish wilds. We had a bear alert on site and had to hide!

TyIsI joined  the room.12:07 PM

Garrett Mace12:07 PM
Steve: On Touch Designer we had someone else do the intense 3D mapping

Steve Pomeroy12:08 PM
Gotcha. Understandable, it can get pretty hairy!

grcornwe12:08 PM
Besides TD, any other tools/techniques you find useful for working with non-rectangular matrices?

Garrett Mace12:08 PM
It was a very complex setup that mapped stick points into 3D space, mapped patterns onto a model of the actual install

Orlando Hoilett12:08 PM
@Dan Maloney can we ask questions here or do we have to fill out the Google Sheet (if we still do that)?

Garrett Mace12:08 PM
I believe he was projecting textures onto the sticks and extracting them to LED colors

Dan Maloney12:09 PM
@Orlando Hoilett - ask away! No formalities here!

Ben Hencke12:09 PM
nice ceiling effect! was that mapped to some kind of cartesian space or work on some kind of connection topology?

Garrett Mace12:09 PM
grcornwe: I have lots of material on that aspect :)

Garrett Mace12:09 PM
You can draw shapes pretty easily using (x,y) coordinates just like a computer screen. But what if your project isn't a grid? Maybe it's some other shape, or is distributed within 3D space. The coordinates aren't as predictable, may not be regularly spaced integers...or you might not even want to use Cartesian coordinates.

Garrett Mace12:10 PM
If your grid is still a grid, but has weird shapes (a grid with holes pretty much) I made a tool for that:

Garrett Mace12:10 PM

Orlando Hoilett12:10 PM
@Garrett Mace so would you consider this a "finished" product? I'm curious how the client deals with systems and hardware that are often considered "prototype-friendly" but not necessarily "deployable" friendly, at least in their breakout forms.

Garrett Mace12:10 PM

https://macetech.github.io/FastLED-XY-Map-Generator/

#### FastLED XY Map Generator

by Garrett Mace (macetech.com), inspired by Mark Kriegsman Code: https://github.com/macetech/FastLED-XY-Map-Generator Set the maximum x and y dimensions, layout style (how the LEDs are actually wired), and click Rebuild. Then click LEDs to edit the shape of the array by enabling and disabling pixels. The code is updated in realtime.

Steve Pomeroy12:10 PM
haha, I think I came across that generator before and didn't know it was you :-)

Orlando Hoilett12:10 PM
And I mean the ceiling LED light show. (Sorry for asking out of turn...it's hard to find a good place to jump in).

Garrett Mace12:11 PM
Orlando: it was a finished install, but yes: we could really have used OTA. There was a startup reset sync issue on the Teensy that was a bit difficult when you need a lift to go fix it

Orlando Hoilett12:11 PM
Interesting.

Pete Willard12:12 PM
yuck, yeah OTA would be good

Garrett Mace12:12 PM
Other ways to map LEDs to physical space: you can make a 3D model and find a way to extract the LED point coordinates

Orlando Hoilett12:12 PM
I would love to see a picture of the hardware brains. 35 Teensys is pretty intense. Lol.

Garrett Mace12:12 PM

Pete Willard12:12 PM
35 teensy's working together in concert? wow

anfractuosity12:12 PM
are the teensy boards are connected to a computer which provides the display data? if so, what interface does that use

Garrett Mace12:13 PM
I made an LED project for my house, and modeled it in Blender. Sometimes you can just draw your object in a 3D CAD program and extract the coordinates directly.In the following case I used Blender to generate some of the geometry, and calculated an X, Y, Z, radius, theta, and phi angle lookup table.

SimonAllen12:13 PM
Are the LED Matrix Shades a kit or do they come already assembled?

Garrett Mace12:14 PM
anfractuosity: Yep, all ethernet to a pretty intense server :) SACN was not able to keep up so I had to write my own trimmed down protocol

Garrett Mace12:14 PM
Simon: those are pre assembled, the RGB Shades are optional assembled

Garrett Mace12:14 PM
For the 3D model above, the lookup table looks like this:

Jason Moungey12:14 PM
@Garrett Mace You type so fast! I was gonna answer that one :p

Steve Pomeroy12:14 PM
"sACN was not able to keep up"

What pixel count / frame rate were you targeting?

anfractuosity12:14 PM
ooh nice, so each teensy board has it's own ethernet jack?

Garrett Mace12:15 PM

1

`// r, phi, theta, x, y, z`

2

`float spherical_map[32][6] = {`

3

`{    19.50,    2.58802,    0.00000,   10.25176,    0.00000,  -16.58769 }, // 0`

4

`{    15.50,    1.57080,   -0.55357,   13.18514,   -8.14874,   -0.00007 }, // 1`

5

`{    19.50,    2.12437,   -1.57079,    0.00016,  -16.58766,  -10.25181 }, // 2`

6

`{    23.50,    2.58802,    3.14159,  -12.35463,    0.00000,  -19.99033 }, // 3`

7

`{    19.50,    2.12437,    1.57079,    0.00016,   16.58766,  -10.25181 }, // 4`

8

`{    19.50,    1.57080,    0.55357,   16.58776,   10.25164,   -0.00009 }, // 5`

9

`{    27.50,    1.01722,   -1.57081,   -0.00022,  -23.39285,   14.45768 }, // 6`

10

`{    19.50,    1.57079,   -2.58803,  -16.58776,  -10.25164,    0.00009 }, // 7`

11

`{    15.50,    1.57079,    2.58803,  -13.18514,    8.14874,    0.00007 }, // 8`

12

`{    27.50,    1.01722,    1.57081,   -0.00022,   23.39285,   14.45768 }, // 9`

13

`{    23.50,    0.55357,    0.00000,   12.35463,    0.00000,   19.99033 }, // 10`

14

`{    19.50,    0.55357,    3.14159,  -10.25176,    0.00000,   16.58769 }, // 11`

15

`{    23.50,    2.18628,   -0.78539,   13.56782,  -13.56756,  -13.56780 }, // 12`

16

`{    27.50,    1.93567,    0.00000,   25.68969,    0.00000,   -9.81277 }, // 13`

17

`{    27.50,    2.77673,   -1.57078,    0.00011,   -9.81249,  -25.68978 }, // 14`

18

`{    15.50,    2.77673,    1.57078,    0.00006,    5.53068,  -14.47970 }, // 15`

19

`{    15.50,    2.18628,    0.78539,    8.94899,    8.94882,   -8.94898 }, // 16`

20

`{    19.50,    1.20593,    0.00000,   18.21635,    0.00000,    6.95805 }, // 17`

21

`{    27.50,    1.57080,   -1.20593,    9.81269,  -25.68971,   -0.00000 }, // 18`

22

`{    15.50,    2.18628,   -2.35620,   -8.94892,   -8.94889,   -8.94897 }, // 19`

23

`{    23.50,    2.18628,    2.35620,  -13.56772,   13.56767,  -13.56779 }, // 20`

24

`{    23.50,    1.57080,    1.20593,    8.38539,   21.95303,   -0.00000 }, // 21`

25

`{    23.50,    0.95531,   -0.78540,   13.56772,  -13.56767,   13.56779 }, // 22`

26

`{    23.50,    1.57080,   -1.93566,   -8.38539,  -21.95303,    0.00000 }, // 23`

27

`{    27.50,    1.93566,    3.14159,  -25.68973,    0.00000,   -9.81263 }, // 24`

28

`{    27.50,    1.57080,    1.93566,   -9.81269,   25.68971,    0.00000 }, // 25`

29

`{    15.50,    0.95531,    0.78540,    8.94893,    8.94889,    8.94897 }, // 26`

30

`{    15.50,    0.36486,   -1.57081,   -0.00006,   -5.53068,   14.47970 }, // 27`

31

`{    15.50,    0.95531,   -2.35620,   -8.94899,   -8.94882,    8.94898 }, // 28`

32

`{    19.50,    1.20593,    3.14159,  -18.21632,    0.00000,    6.95814 }, // 29`

33

`{    23.50,    0.95531,    2.35620,  -13.56782,   13.56756,   13.56780 }, // 30`

34

`{    27.50,    0.36486,    1.57081,   -0.00011,    9.81249,   25.68978 }, // 31`

35

`};`

36

37

`int pixels_to_verts_map[] = {  5, 22, 17, 10, 27, 9, 26, 25,`

38

`    21,  4, 13,  0, 14, 18, 16, 12,`

39

`    23,  2, 24,  3, 15,  8,  7, 19,`

40

`    20, 30, 31, 29, 11,  6, 28,  1};`

41

42

`typedef struct pixel_info {`

43

`    float r;`

44

`    float theta;`

45

`    float phi;`

46

`    float x;`

47

`    float y;`

48

`    float z;`

49

`} pixel_info;`

50

51

52

`pixel_info get_pixel_info(int pixel) {`

53

`    pixel_info temp_pix;`

54

55

`    temp_pix.r = spherical_map[pixels_to_verts_map[pixel]][0];`

56

`    temp_pix.theta = spherical_map[pixels_to_verts_map[pixel]][1];`

57

`    temp_pix.phi = spherical_map[pixels_to_verts_map[pixel]][2];`

58

`    temp_pix.x = spherical_map[pixels_to_verts_map[pixel]][3];`

59

`    temp_pix.y = spherical_map[pixels_to_verts_map[pixel]][4];`

60

`    temp_pix.z = spherical_map[pixels_to_verts_map[pixel]][5];`

61

62

`    return temp_pix;`

63

`}`

Yannick (Gigawipf)12:15 PM
Currently working on a pi pico based hub75 driver. Great performance overall apart from usb. Only issue is to actually get the data fast enough via usb for actual video.

uart is fast than its onboard usb cdc port... best might be a ft232h with the parallel fifo

Garrett Mace12:15 PM
Steve: We had about 42,000 pixels, it was pretty hard to stay above 30fps

Steve Pomeroy12:15 PM
42,000 is a lot of LEDs.

Paul Stoffregen12:16 PM
wow, 42K

Steve Pomeroy12:16 PM
How do you manage LED failures at that scale?

Garrett Mace12:16 PM
Great question

Steve Pomeroy12:16 PM
haha

Garrett Mace12:16 PM
We used a white-white-white strip, and we're only using one channel :)

Nick12:16 PM
how do you estimate the framerate you'll be able to get while planning?

Garrett Mace12:17 PM
We get three chances to fix a burned out LED. If the controller fails though, it's toast and an on-hands repair

Louis Beaudoin12:17 PM
If like me you wanted more photos and info on the ceiling install: https://www.tangibleinteraction.com/artworks/summit

Garrett Mace12:17 PM
Nick: I've never tried. I usually do stuff on a slow mcu and then switch to a Teensy when it's too slow :)

kate.cebik joined  the room.12:18 PM

Garrett Mace12:18 PM
For the 3D spike ball, a lookup table lets you write simple generative patterns based on physical space instead of having to think about rendering shapes to a grid

Garrett Mace12:18 PM

1

`for (int i = 0; i < NUM_LEDS; i++) {`

2

`    pixel_info pix = get_pixel_info(i);`

3

`    uint8_t pixangle = (pix.theta + PI) * 255 / (2*PI);`

4

`    LEDChannels[i] = ColorFromPalette(currentPalette,pixangle+angle,brightness);`

5

`}`

Garrett Mace12:19 PM
That's an example code that sweeps a pattern from "north pole" to "south pole" on that ball

Garrett Mace12:19 PM
Can also do an "explode" animation by actuating radius, etc

Garrett Mace12:19 PM
For my LED nonagon project, based on nine Pink Pixel Purse 16x32 displays, it was a challenge to map the rotated translated nine-sided circular array to coordinates I could use to generate patterns. I ended up using Python to perform affine matrix transformations on the panels. YES, you DO sometimes use that stuff from way back in school!

Garrett Mace12:20 PM

Garrett Mace12:20 PM
That was HUB75 panels of course. I think it 4 or 5 thousand pixels?

Steve Pomeroy12:20 PM
Are you using Numpy or some other accelerated math?

Garrett Mace12:20 PM

Garrett Mace12:20 PM
Basically, if you can get the starting coordinates of all the pixels in your LED matrix and unwrap them into a row of x values, a row of y values, and a row of ones, you can perform rotation, translation, and scaling operations with a simple matrix multiplication (which in Python is the @ operator). Transform functions do already exist in Python libraries, but I wanted to understand it a bit better so created the transforms myself.

Garrett Mace12:21 PM

1

`def rot_matrix(angle, matrix):`

2

`    rot_sin = np.sin(angle*np.pi/180)`

3

`    rot_cos = np.cos(angle*np.pi/180)`

4

`    rot = np.array([[rot_cos, -rot_sin, 0],`

5

`                [rot_sin, rot_cos,  0],`

6

`                [0,             0,  1]])`

7

`    return rot @ matrix`

8

9

`def trans_matrix(x, y, matrix):`

10

`    trans = np.array([[1,   0,   x],`

11

`                      [0,   1,   y],`

12

`                      [0,   0,   1]])`

13

`    return trans @ matrix`

Garrett Mace12:21 PM
For a 2x2 matrix, you can do a transform and watch how the numbers start simple

Garrett Mace12:21 PM

Steve Pomeroy12:22 PM
Ah, wow, more built-in than I expected. I mean, it's Python so I should have expected that. Guess I need to get good at matrix math (I already knew that)

Jason Moungey12:22 PM
This is my favorite LED matrix Garrett has made: https://www.instagram.com/p/BLmbo7IDnrD/ (Sorry, I didn't have a gif of this to attach)

Garrett Mace12:22 PM
Crank up the resolution and you can see it's not something you'd just tweak to look right. If you want to generate a pattern on a tilted matrix

Garrett Mace12:22 PM

Garrett Mace12:23 PM
That's more of a spiral Jason ha

Steve Pomeroy12:23 PM
@Jason Moungey that's a disco stick if