To make smaller hexagons at the points marked with cross in black
1 回表示 (過去 30 日間)
古いコメントを表示
We have the 2x2 hexagonal structure as shown in above figure.
Please take a note of the numbering of the vertices which is following a specific pattern.
I have numbered the smaller red coulured hexagons too for understanding, the further continued numbering can be understood by the pattern.
Please take a note that the read colured hexagons are formed at such vertices where three edges meet each other. The centers for drawing red coloured hexagons are saved in a separate matrix named second_matrix_values as shown below:
second_matrix_values =
1.0000 6.3480 3.6650
2.0000 0 7.3300
6.0000 6.3480 -3.6650
7.0000 12.6960 14.6600
10.0000 12.6960 7.3300
11.0000 19.0430 3.6650
Now I have shown one black coulred small hexagon and how it is formed at its positon. We need to make such black coulred hexagons at all the balck cross marks which i have provided in the image.
We have input as the side for the hexagons. Also we have cooridnates of blue coloured and red coloured hexagons.Thus using them we need to plot cooridnates for black coloured hexagon and thus make them.
please if any queries while understanding the problem then let us know.
0 件のコメント
採用された回答
Matt J
2023 年 7 月 1 日
編集済み: Matt J
2023 年 7 月 1 日
Forming the hexagons is easy enough using nsidedpoly (see below), but you need to use the delaunay triangulation to determine whether the intersection of the blue lines is a 'Y' or an upside down 'Y'.
s=1;
red=rotate(nsidedpoly(6,'SideLength',2*s),30);
black=arrayfun(@(i)subhex(red.Vertices(i,:),s) , [2,4,6] );
figure
plot(red,'FaceColor','r'); hold on
plot(black,'FaceColor','k'); hold off
axis equal
figure
plot(red,'FaceColor','r'); hold on
plot(rotate(black,60),'FaceColor','k'); hold off
axis equal
function p=subhex(v,s)
p=rotate(nsidedpoly(6,'SideLength',s,'Center',v),30,v);
end
7 件のコメント
Matt J
2023 年 7 月 1 日
編集済み: Matt J
2023 年 7 月 1 日
Using isConnected, you can find, for a given point, the edge directions radiating out to nearby neighbors. Once you have those edges, you can start to analyze their geometry to see if they have the properties you want. I assume you want those separated by about 120 degrees and I assume you only want to consider edges of a certain length range, but I don't know what tolerances and ranges you plan to use. Likewise, you will want to test whether there is an edge that points straight up or down, which will determine whether you have an upright Y or an upside down Y. However, no edge will be perfectly horizontal or vertical, so you will need to decide on a tolerance for that as well.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Delaunay Triangulation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!