[過去ログ] Delphiゲームプログラミング相談室 (976レス)
1-

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
283: 272 [sage] 03/05/19 00:13 ID:xetwIoTi(1) AAS
>>282
282(2): 名前は開発中のものです。 [sage] 03/05/18 23:17 ID:Vqiijavw(1) AAS
>>280
今度は(1,0)-(0,1)で2になります。

x0=1;
y0=0;
x1=0;
y1=1;
xlen = Abs(0-1) = 1;
ylen = Abs(1-0) = 1;

1 <= (1 div 2) が成立しないので、
hexlen := 1 + 1 - (1 div 2) = 2;

最終的にこれでいけました。
function GetHexLen(const P1, P2: TPoint): Integer;
var
 W, H: Integer;
begin
 W := Abs(P2.X - P1.X);
 H := Abs(P2.Y - P1.Y);
 if H <= W * 2 then
 begin
  if (Odd(P1.Y) and (P1.X >= P2.X)) or
   ((not Odd(P1.Y)) and (P1.X <= P2.X)) then
   Result := H + W - H div 2
  else
   Result := W + H div 2
 end else
  Result := H;
end;
あう。 何度も何度もすいませんでした。
(0,0)からしか検算していなかった私のミスです。
1-
あと 693 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.021s