gpt4 book ai didi

delphi - 计算行和列

转载 作者:行者123 更新时间:2023-12-03 15:50:28 24 4
gpt4 key购买 nike

我正在 map 上绘制六边形。由于某种原因它只会创建一行。我相信我的循环是正确的。如果打开

glVertex3f(((sin(i/6.0*2*PI))/10)+RowOffset,((cos(i/6.0*2*pi))/10)+CollumnOffset,-2);

我交换 RowOffsetColumnOffset 然后我得到一列。

procedure TFCreatemap.menuArea;
var
I: Integer;
Row,Collumn: Integer;
RowOffset,CollumnOffset: double;
TotalRow,TotalCollumn:integer;
begin

Row := 0;
Collumn:= 0;
CollumnOffset := -0.9;
TotalRow := 11;
TotalCollumn := 11;

while Collumn < TotalCollumn do
begin
CollumnOffset := CollumnOffset+0.4;
RowOffset:= -0.9;


while Row < TotalRow do
begin
RowOffset := RowOffset+ 0.2;


glBegin(GL_POLYGON);
for I := 0 to 6 do
begin
glVertex3f(((sin(i/6.0*2*PI))/10)+RowOffset,((cos(i/6.0*2*pi))/10)+CollumnOffset,-2);
end; {for}
glEnd;

Row:= Row+1;
end; {end collumns with}


Collumn:= Collumn+1;
end; {end rows with}
end;

我的左侧/顶部也是 -1 到 1

最佳答案

您没有重置循环中的行,IHMO 它应该看起来像这样

  RowOffset:= -0.9;
Row := 0;
while Row < TotalRow do

关于delphi - 计算行和列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14976014/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com