How can I change the distances between points in a hexagonal grid?
1 view (last 30 days)
Show older comments
I'm trying to project some vectors in a hexagonal grid which is done with the hextop function.
Does anybody know how to change the distance between th points in the hexagonal grid?
vpos=[8,8];
pos=hextop(vpos);
0 Comments
Answers (1)
Kiran Felix Robert
on 14 Aug 2020
Hi Clara,
It is my understanding that you are trying to scale the hexagonal grid created by the hextop function. The output of the hextop function is a 2-by-N matrix such that, Row 1 corresponds to the x-value and Row-2 corresponds to the y-Value in a rectangular grid. So, to scale the grid, you can scale the grid points in the ‘pos’ vector by the required scaling factor.
For example, if you want to scale the horizontal distance by ‘a’ and vertical distance by ‘b’, this can be done as shown below,
vpos = [8,8];
pos = hextop(vpos);
pos(1,:) = pos(1,:).*a;
pos(2,:) = pos(2,:).*b;
Hope this Helps.
Kiran Felix Robert
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!