Hi everyone,

I have a equilateral triangle (of side length 1) lattice and I want to map a 2D grid of points to the closest point on the lattice. So given a randomgridpoint (x,y), I want to know the correspondinglatticepoint (u,v).

I've worked out that I could use a matrix to define the affine transformation (shear). Just dont know how to go about it.

The first four points on the grid are (0,0) (1,0), (0,1) (1,1) and the corresponding first four points on the lattice are triangle 1: (0,0) (1,0) (cos60,sin60) and triangle 2: (cos60,sin60) (1, 0) (cos60+1, sin60). You can imagine this structure as repeating in the positive R^2 domain.

I realised that the lattice has some parallel lines, there are three (using vector notation):

v1: i

v2: cos60 i + sin60 j

v3: cos60 i - sin60 j

their intersection correspond to a point in the lattice. I thought of drawing the (u,v) coordinate space as a grid where u = v1, v = v2

It might be more accurate to describe line v1 as a set of parallel lines separated by distance sin60 (considering the equilateral triangle has side length 1), same goes for v2, v3 they are a set of lines separated by that perpendicular distance within the equilateral triangle.

I am hoping that I could use all this information to shear the square into the parallelogram of two equilateral triangles, then describe it that way...well I am stuck after all.

Thanks in advance

oh and I realise this is my first post so forgive any etiquette issues :P