openpixelcontrol icon indicating copy to clipboard operation
openpixelcontrol copied to clipboard

Documentation of freespace.py

Open osmithy opened this issue 7 years ago • 2 comments

The example suggests starting with the freespace layout, which works, but I have no idea how to change the layout because the code in freespace.py has no comments that explain what it does. Any chance you could add a few?

osmithy avatar Jun 09 '18 08:06 osmithy

Hey Osmithy, we had trouble with the how the points were mapped also. From messing around with freespace.py it looks like the coordinates for the line

"point" ( 0, 0, 0,)

Map to the colored axis (red, green, blue) on the visual interface.

It's still not completely clear what inputs OPC will recognize for shapes though but from looking at the provided files it looks like "point" and "circle" are used.

Hope that helps.

willisk-main avatar Jul 08 '18 01:07 willisk-main

A layout file is a list of points in 3d space, in json, representing each LED. The numbers are x, y, z coordinates. The order of points should be the same order they occur on your LED string.

  {"point": [1.32, 0.00, 1.32]},
  {"point": [1.32, 0.00, 1.21]},
  {"point": [1.32, 0.00, 1.10]},

This format is not part of the OPC spec, which is only about sending colors to LEDs.

The spatial information from the layout file is used by:

  • gl_server.c to draw a preview of the points
  • Most of the included python pattern generators like spatial_stripes.py which use an LED's location to procedurally generate its color.
  • Other tools like pixelslinger

gl_server.c draws a little red-green-blue axis marker at the origin to help you get oriented. Red is x, green is y, and blue is z.

I see that gl_server.c also supports lines in addition to points. Looks like it expects this format:

    {"line": {"start": [11, 22, 33], "end": [77, 88, 99]}}

...but I don't see any example layout files that use lines.

I think there were once "circles" or maybe "spheres" which were drawn as extra large spheres in the 3d preview, but I don't see that code here.

The purpose of freespace.py is to generate a layout file representing an installation that was at Freespace in SF which was a grid folded in half in the middle.

In my fork I have some more JSON layouts to play with and also a script objToLayout.py which converts the vertices of an OBJ file into a JSON layout.

longears avatar Jul 08 '18 18:07 longears