{ Solutions to the Advent Of Code. Copyright (C) 2024 Stefan Müller This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . } unit UVector; {$mode ObjFPC}{$H+} interface uses Classes, SysUtils; type TVector3DataRange = 0..2; TVector3Int64Data = array[TVector3DataRange] of Int64; { TVector3Int64 } TVector3Int64 = object private function GetX: Int64; function GetY: Int64; function GetZ: Int64; procedure SetX(AValue: Int64); procedure SetY(AValue: Int64); procedure SetZ(AValue: Int64); public Data: TVector3Int64Data; property X: Int64 read GetX write SetX; property Y: Int64 read GetY write SetY; property Z: Int64 read GetZ write SetZ; constructor Init(const AX, AY, AZ: Int64); end; //// Component-wise binary operators. //operator - (const A, B: TVector3Int64): TVector3Int64; //operator / (const A, B: TVector3Int64): TVector3Int64; implementation //operator - (const A, B: TVector3Int64): TVector3Int64; //var // i: TVector3DataRange; //begin // for i in TVector3DataRange do // Result.Data[i] := A.Data[i] - B.Data[i]; //end; // //operator / (const A, B: TVector3Int64): TVector3Int64; //var // i: TVector3DataRange; //begin //for i in TVector3DataRange do // Result.Data[i] := A.Data[i] / B.Data[i]; //end; { TVector3Int64 } function TVector3Int64.GetX: Int64; begin Result := Data[0]; end; function TVector3Int64.GetY: Int64; begin Result := Data[1]; end; function TVector3Int64.GetZ: Int64; begin Result := Data[2]; end; procedure TVector3Int64.SetX(AValue: Int64); begin Data[0] := AValue; end; procedure TVector3Int64.SetY(AValue: Int64); begin Data[1] := AValue; end; procedure TVector3Int64.SetZ(AValue: Int64); begin Data[2] := AValue; end; constructor TVector3Int64.Init(const AX, AY, AZ: Int64); begin X := AX; Y := AY; Z := AZ; end; end.