TVector3DAddVector3D (Delphi)
Description
This example illustrates how to use the operator Addition method to add a given 3D vector to Self.
Code
uses
System.SysUtils,
System.Types;
var
aVector1,aVector2: TVector3D;
begin
aVector1.Create(1,2,4);
writeln(Format('%2.2f %2.2f %2.2f',[aVector1.X,aVector1.Y,aVector1.Z]));
// The console will output: 1.00 2.00 4.00, representing the coordinates for aVector1.
aVector2.Create(2,2,2);
writeln(Format('%2.2f %2.2f %2.2f',[aVector2.X,aVector2.Y,aVector2.Z]));
// The console will output: 2.00 2.00 2.00, representing the coordinates for aVector2.
aVector1.AddVector3D(aVector2);
writeln(Format('%2.2f %2.2f %2.2f',[aVector1.X,aVector1.Y,aVector1.Z]));
// The console will output: 3.00 4.00 6.00, representing the coordinates for aVector1 after adding aVector2.
end.