Sign in to follow this  
dnaxx

Formula for points on hexagonal structure

Recommended Posts

Hello, I have the following hexagonal structure, which is created around a central point (color orange): Hexagonal structure (The structure in the picture is a bit irregular, but it should be a regular grid.) Now I want to get the coordinates of vertices, e.g. all vertices that are located on the thick circle. Is there a generic way to get all vertex coordinates on a specific circle around the center? Regards,

Share this post


Link to post
Share on other sites
You could pick all the vertices within X "hops" from the center. In your picture choosing all vertices with 3 hops from the center gives you all the vertices on the circle, plus a few others.

Share this post


Link to post
Share on other sites
If you are having trouble with the trigonometry, you have 3 types of hoops:
- East, which corresponds to the vector (1,0)
- Northwest, which corresponds to the vector (-1/2, sqrt(3)/2)
- Southwest, which corresponds to the vector (-1/2, -sqrt(3)/2)

Now moving through your grid can be done by starting at (0,0) and then doing a sequence of alternatingly adding and subtracting one of those three values.

Another way of generating all the points in the grid is to consider all the points with coordinates (a + b/2, b*sqrt(3)/2), where a and b are integers such that (a-b+1) is not a multiple of 3.

[Edited by - alvaro on June 10, 2009 8:31:16 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this