/* * y h1 / * 12_ _ _ _ _ _ _\____________/ * \ \ /\ /\ /\ * \ / \ / \ / \ * h2 6_\_ _ _\/____\/____\/____\ h0 * \ /\ /\ /\ /\ * \ / \ / \ / \ / \ * 0_\/____\/____\/____\/____\__x * \ /\ /\ /\ /\ * \ / \ / \ / \ / * h3 -6_\/____\/____\/____\/_ _ \ h5 * \ /\ /\ / * \ / \ / \ / \ \ * -12_\/____\/____\/_ _ _ _ _ _ * /\ \ \ \ \ * /-12 -6 0 6 12 * / h4 \ * * Above is the grid of didopu2 in our skewed coordinate system. * Just as the normal cartesian coordinate system is divided in quadrants, * this is divided in hexants: h0..h5. For our purpose, the positive x-axis * is considered to be a part of h0, the line y = x > 0 is considered to be a * part of h1, etc... The origin does not belong to any hexant. * * Two things are interesting about this coordinate system: * * - rotations over 60 degrees can be done by matrix multiplication, * rotation matrix: [ [ 1, -1 ], [ 1, 0 ] ] * * - all important stuff (vertices, edges and triangles) can be represented * in a natural way * * * Vertices have coordinates that are multiples of 6. * * * Edges are represented by the midpoints of two neighboring vertices, * their coordinates are multiples of 3 (but not both a multiple of 6) * * * Triangles are represented by their center of gravity, there are * two kinds of triangles: upward facing triangles /\ have a center (x, y) * with mod6(x) == 4 and mod6(y) == 2, downward facing triangles \/ have * mod6(x) == 2 and mod6(y) == 4. * * The system can be extended to directed vertices, edges and triangles (as in: * an edge can have two directions, a triangle can have three orientations and even * a vertex can have an associated direction). But we don't go into that. * * 1: 6 triangles, 3 rectangles * 2: 24 triangles, 21 rectangles * 3: The origin is at (0, 0), rotations around 60 degrees can be done with matrix multiplication [ 1, -1 ] [ x ] [ x - y ] [ 1, 0 ] [ y ] = [ x ] [ 1, -1 ] [ x - y ] [ - y ] [ 1, 0 ] [ x ] = [ x - y ] [ 1, -1 ] [ - y ] [ -x ] [ 1, 0 ] [ x - y ] = [ - y ] [ 1, -1 ] [ -x ] [ -x + y ] [ 1, 0 ] [ - y ] = [ -x ] [ 1, -1 ] [ -x + y ] [ y ] [ 1, 0 ] [ -x ] = [ -x + y ] [ 1, -1 ] [ y ] [ x ] [ 1. 0 ] [ -x + y ] = [ y ] [ 1, -1 ]^2 [ 0, -1 ] [ 1, 0 ] = [ 1, -1 ] [ 1, -1 ]^3 [ -1, 0 ] [ 1, 0 ] = [ 0, -1 ] [ 1, -1 ]^4 [ -1, 1 ] [ 1, 0 ] = [ -1, 0 ] [ 1, -1 ]^5 [ 0, 1 ] [ 1, 0 ] = [ -1, 1 ] y h1 x = y 6_ _ _ _ _ _ \____________ \ /\ /\ C - 5 / \ / \ C C - 4 \ h2 / \ / \ h0 M S L - 3 / \ / \ M M L L - 2 \ / \ / \ A S K S B - 1 0_/__________\/__________\_ x A A K K B B - 0 \ /\ /\ \ \ \ \ \ \ \ / \ / 0 1 2 3 4 5 \ / \ / \ h3 \ / \ / h5 \ / \ / \ -6_\/__________\/_ _ _ _ _ _ _ _ \ \ \ -6 h4 0 6 B1 B0 K1 K0 A1 A0 / * --- 0 / B2 S1 K2 S0 A2 / C2 * --- 1 / L1 L0 M1 M0 / C0 C1 * --- 2 / L2 S2 M2 / M2 S2 L2 * --- 3 / C1 C0 / M0 M1 L0 L1 * --- 4 / C2 / A2 S0 K2 S1 B2 * --- 5 / / A0 A1 K0 K1 B0 B1 * --- 6 \ \ \ \ \ \ \ 0 1 2 3 4 5 6 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 D D D D D 2 1 1 D D D D 2 2 1 1 1 D D D 2 2 2 1 1 1 1 D D 2 2 2 2 1 1 1 1 1 D 2 2 2 2 2 1 1 1 1 1 1 2 2 2 2 2 2 * * * L * S * * * B A * * * * K C M M C K * * * * A B * * * S * L * * * * * B L * * * K S A M C * C M A S K * * * L B * * * B L A C\K S M M S K\C A L B * Symmetrie are always 0, 1 and 2. A, B, C: standing on the top of the cage with tip in associated vertex S: standing on the base of the cage on associated vertex K, L, M: laying on the side with top horizontal bar on associated edge, vertex accross must be an internal vertex 12 _______________________ /\ /\ /\ /--\--/--\--/--\ 6 ______/____\/____\/____\ /\ /\ /\ /\ /--\--/--\--/--\--/--\ 0 _/____\/____\/____\/____\ \ /\ /\ /\ /\ \--/--\--/--\--/--\--/ \ -6 _\/____\/____\/____\/ \ \ /\ /\ /\ \ \--/--\--/--\--/ \ \ -12 _\/____\/____\/ \ \ \ \ \ \ \ -12 -6 0 6 12 2D coord system /* * View from the top * 0 * ________ * /\ \ / * 2 / \ 1 \ <> / * / <> \ 1 \ / 2 * /______\ \/ * * 0 * 1 * ________ * /\ \ / * 0 / \ 2 \ <> / * / <> \ 2 \ / 0 * /______\ \/ * * 1 * 2 * ________ * /\ \ / * 1 / \ 0 \ <> / * / <> \ 0 \ / 1 * /______\ \/ * * 2 */ /* * _________________________ * /C\B K A/C\B K A/C\ * / \ / \ / \ * 0 - /M S L\L S M/M S L\L S M/M S L\ * / \ / \ / \ * /A___K___B\C/A___K___B\C/A___K___B\ * \B K A/C\B K A/C\B K A/ * \ / \ / \ / * 1 - \L S M/M S L\L S M/M S L\L S M/ * \ / \ / \ / \ * \C/A___K___B\C/A___K___B\C/ \ * \B K A/C\B K A/ \ * \ / \ / \ * 2 ----- \L S M/M S L\L S M/ \ * \ / \ / \ \ * \C/A___K___B\C/ \ \ * \ \ \ * 0 1 2 */ directions Nn Northnorth Ne Northeast En Eastnorth Ee Easteast Es Eastsouth Se Southeast Ss South Sw Ws Ww Wn Nw when coordinates part of the triange in the drawing in h0, then this means that the roof of the cage is above this triangle coordinates inside h0 and their meaning (2, 1) A cage on side, center on (0,0) pointing at this direction (3, 1) (4, 1) (5, 1) B cage on side, center on (6, 0) pointing at this direction (3, 2) (4, 2) S cage straight up (5, 2) (4, 3) (5, 3) (5, 4) C cage on side, center on (6, 6) pointing at this direction x, y, can be one of six coordinates around an internal vertex then the cage lies on it's side, z specifies ho In this image are: - 6 triangles, with each 3 orientations - 7 vertices, with 12 orientations - 12 edges with 2 orientations each hexant has: - 1 triangle - 2 edges (the edge from the origin and the other edge) - 1 vertex Let's review the coordinates of the origin the coordinates of the origin are (0, 0) orientated towards the axis in h0: ( 1, 0) orientated towards the axis in h1: ( 1, 1) orientated towards the axis in h2: ( 0, 1) orientated towards the axis in h3: (-1, 0) orientated towards the axis in h4: (-1,-1) orientated towards the axis in h5: ( 0,-1) oriented towards the triangle in h0 ( 2, 1) oriented towards the triangle in h1 ( 1, 2) oriented towards the triangle in h2 (-1, 1) oriented towards the triangle in h3 (-2,-1) oriented towards the triangle in h4 (-1,-2) oriented towards the triangle in h5 ( 1,-1) Let's review the trianges - the traingle in h0 has coordinates (4, 2) orientation * up left (2, 3) * up right (5, 3) * down ( 3, 1 ) - the triangle in h1 has coordinates (2, 4) orientation * up (3, 5) * down left ( 1, 3 ) * down right (3, 4 ) - the triangle in h2 has coordinates (-2. 2) orientation * up left (-3. 3) - the vertex as coordinates (6, 0) - the edge from the origin has coordinates (3, 0) - the other edge has coordinates (6, 3)