Kyma Forum
  Kyma Support
  hexagonal grid?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   hexagonal grid?
Phi Curtis
Member
posted 02 January 2009 14:27         Edit/Delete Message   Reply w/Quote
Happy New Year!

I have this code that turns the wacom tablet into a square grid pattern:

(!PenY * 5.99) of: #(
{(!PenX * 5.99) of: #(0 1 2 3 4 5)}
{(!PenX * 5.99) of: #(6 7 8 9 10 11)}
{(!PenX * 5.99) of: #(12 13 14 15 16 17)}
{(!PenX * 5.99) of: #(18 19 20 21 22 23)}
{(!PenX * 5.99) of: #(24 25 26 27 28 29)}
{(!PenX * 5.99) of: #(30 31 32 33 34 35)}
)

[Or you could do this:
((!PenX * 5.99) of: #(0 1 2 3 4 5)) + ((!PenY * 5.99) of: #(0 6 12 18 24 30))

(the advantage of the first is that you can put any number in a specific square without affecting other squares).]

Is there a relatively simple way to make a hexagonal grid? (As in http://en.wikipedia.org/wiki/File:Tiling_Regular_6-3_Hexagonal.svg). How about formulas to create regular tilings of any numbers of sides?

What I find interesting about this is that, for example with the hexagonal grid, I think you would define arrays going in two directions and values for the third direction would arise from the interaction of the other two.

Of course, the square of the wacom tablet wouldn't subdivide evenly, so you'd have little bits of incomplete shapes around the edges.

If anyone can point me to a solution, I'd appreciate it!

best,
Phil

[This message has been edited by Phi Curtis (edited 02 January 2009).]

IP: Logged

Luddy
Member
posted 02 January 2009 22:28         Edit/Delete Message   Reply w/Quote
Hi,

A thought on the hexagonal tiling thing: imagine three lines passing through each hexagon, intersecting at the center of the hexagon, the lines 120 degrees w.r.t. one another. For the sake of being completely unambiguous, let's say that each line is normal (perpendicular) to the two faces of the hexagon that it passes through (or, equivalently, each line passes through the center of two opposing sides of the hexagon).

Now, given any position in the plane, you can "round" that position three times to the nearest such line. The first rounding takes you to (say) one of the up-and-down lines. The next one takes you to one of the lower-left-to-upper-right lines. After the third rounding you are sitting exactly in the center of a hexagon. This is not the same as a true containment test, but if you focus on the centers of the hexagons and think of the edges as a bit blurry, it is probably not bad for use as a controller (and simpler than the linear algebra needed for a proper solution).

If you combine this with a means of mapping the center of a hexagon to a unique number, then you've got your grid mapping. Each line as described above has a unique zero-crossing (value of X for which Y=0). These three X values could be used as a cartesian product to give a unique encoding of the center of the hexagon, for example.

hth,

-Luddy

[This message has been edited by Luddy (edited 02 January 2009).]

IP: Logged

Phi Curtis
Member
posted 03 January 2009 15:10         Edit/Delete Message   Reply w/Quote
Hi Luddy,

Thanks again. It's definitely a bit more complicated than making a grid of squares.

Now I'm thinking, if I decide that's important enough to go to the trouble, that I could make a visual grid in Processing and display the wacom pen position there so I have visual feedback on where I am. If I made every hexagon a different color, I could do a simple check on the pen position's current pixel color and then send the info to Kyma via OSC/OSCulator...

But it would be a project, not something I could whip up in an afternoon.

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c